Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
faae7e6
ワークスペース改修
ivis-kikuchi Dec 19, 2025
6ae33cd
修正
ivis-kikuchi Dec 19, 2025
dc0624b
修正
ivis-kikuchi Dec 19, 2025
1be2a20
Merge remote-tracking branch 'origin/develop_v2.0.0' into feature/W-2…
ivis-kikuchi Dec 20, 2025
c6a1008
修正
ivis-kikuchi Dec 20, 2025
d5b9c44
ログを消した
ivis-kikuchi Dec 20, 2025
6211453
修正
ivis-kikuchi Dec 20, 2025
d09ca63
修正
ivis-kikuchi Jan 5, 2026
132969e
省略を修正
ivis-kikuchi Jan 5, 2026
e120cb8
省力を修正
ivis-kikuchi Jan 6, 2026
e3d54dd
単体テスト
ivis-kikuchi Jan 7, 2026
d83ee27
単体テスト修正
ivis-kikuchi Jan 7, 2026
a6292d2
Merge pull request #1074 from ivis-kikuchi/feature/W-2025-35-2.3
ivis-kikuchi Jan 19, 2026
eb39bea
fix: scroll
ivis-kikuchi Jan 28, 2026
691cfee
update: bulk export
ivis-kikuchi Jan 28, 2026
f5eff74
clean
ivis-kikuchi Jan 28, 2026
a5764dd
clean
ivis-kikuchi Jan 31, 2026
6ad8fde
clean
ivis-kikuchi Jan 31, 2026
e31157b
clean
ivis-kikuchi Jan 31, 2026
d6995e0
fix: space
ivis-kikuchi Feb 2, 2026
944cbad
fix: space
ivis-kikuchi Feb 2, 2026
275a70e
clean
ivis-kikuchi Feb 3, 2026
7e4bbcd
fix: unit_test
ivis-kikuchi Feb 3, 2026
8771157
clean
ivis-kikuchi Feb 3, 2026
d82fb27
fix: unit_test
ivis-kikuchi Feb 4, 2026
2f43fe7
clean
ivis-kikuchi Feb 4, 2026
712f749
Merge pull request #1081 from ivis-kikuchi/feature/W-2025-35-2.2
ivis-kikuchi Feb 4, 2026
906a9f1
fix: export
ivis-kikuchi Feb 4, 2026
403ab4e
fix: space
ivis-kikuchi Feb 5, 2026
fc2673f
fix: length
ivis-kikuchi Feb 14, 2026
9b46d55
fix workspace export header
ryoya-hayase Mar 16, 2026
c7c9f79
Merge pull request #1101 from ryoya-hayase/feature/W2025-35
ryoya-hayase Mar 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions modules/weko-items-autofill/tests/data/itemtypes/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,32 @@
"test_item15":{
"jpcoar_mapping":{"volume": { "@value": "test15_subitem1" } }
},
"test_item16":{
"jpcoar_mapping":{
"relation":{
"@attributes": {"relationType": "subitem_relation_type"},
"relatedIdentifier": {
"@value": "test16_subitem1.test16_subitem2",
"@attributes": {
"identifierType": "test16_subitem1.test16_subitem3"
}
}
}
}
},
"test_item17":{
"jpcoar_mapping":{
"relation":{
"@attributes": {"": ""},
"relatedIdentifier": {
"@value": "test16_subitem1.test16_subitem2",
"@attributes": {
"identifierType": "test16_subitem1.test16_subitem3"
}
}
}
}
},

"test_itemxx":""
}
30 changes: 29 additions & 1 deletion modules/weko-items-autofill/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ def test_get_crossref_relation_data(mocker):
isbn = []
doi = "test_doi"
result = get_crossref_relation_data(isbn, doi)
assert result == [{"@value": "test_doi", "@type": "DOI"}]
assert result == [{"@value": "test_doi", "@type": "DOI","@relation_type": "isVersionOf"}]

isbn = ["test_isbn1", "test_isbn2"]
doi = ""
Expand Down Expand Up @@ -1394,6 +1394,20 @@ def assert_test(item_name, parent_key, value_key, attributes_keys):
test = {"@value":value_key}
test.update(attributes_keys)
assert result == test

def assert_test2(item_name, parent_key, value_key, attributes_keys):
mock_effect = [{"key": value_key}]
mock_effect += [{"key": attributes_key} for attributes_key in attributes_keys.values()]
with patch(
"weko_items_autofill.utils.get_autofill_key_path",
side_effect=mock_effect,
):
result = get_key_value(
schema_form, data[item_name]["jpcoar_mapping"]["relation"][parent_key], parent_key,data[item_name]["jpcoar_mapping"]["relation"]
)
test = {"@value":value_key}
test.update(attributes_keys)
assert result == test


# exist @attributes.xml:lang
Expand Down Expand Up @@ -1436,6 +1450,20 @@ def assert_test(item_name, parent_key, value_key, attributes_keys):
attributes_keys={"@type":"test12_subitem2"}
)

assert_test2(
item_name="test_item16",
parent_key="relatedIdentifier",
value_key="test16_subitem1.test16_subitem2",
attributes_keys={"@type":"test16_subitem1.test16_subitem2","@relation_type":"subitem_relation_type","@type":"test16_subitem1.test16_subitem3"}
)

assert_test2(
item_name="test_item17",
parent_key="relatedIdentifier",
value_key="test17_subitem1.test17_subitem2",
attributes_keys={"@type":"test17_subitem1.test16_subitem2","@type":"test17_subitem1.test16_subitem3"}
)


# def get_autofill_key_path(schema_form, parent_key, child_key):
# .tox/c1/bin/pytest --cov=weko_items_autofill tests/test_utils.py::test_get_autofill_key_path -vv -s --cov-branch --cov-report=term --basetemp=/code/modules/weko-items-autofill/.tox/c1/tmp
Expand Down
14 changes: 11 additions & 3 deletions modules/weko-items-autofill/weko_items_autofill/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,7 @@ def get_crossref_relation_data(isbn, doi):
new_data = dict()
new_data['@value'] = doi
new_data['@type'] = "DOI"
new_data['@relation_type'] = 'isVersionOf'
result.append(new_data)
if isbn and len(result) == 0:
for element in isbn:
Expand Down Expand Up @@ -993,7 +994,7 @@ def get_autofill_key_tree(schema_form, item, result=None):
related_identifier = val.get("relatedIdentifier")
if related_identifier:
key_data = get_key_value(schema_form,
related_identifier, parent_key)
related_identifier, parent_key, val)
else:
key_data = get_key_value(schema_form, val, parent_key)
if key_data:
Expand Down Expand Up @@ -1054,7 +1055,7 @@ def get_parent_key(_item):
return autofill_key_tree


def get_key_value(schema_form, val, parent_key):
def get_key_value(schema_form, val, parent_key,val2={}):
"""Get key value.

:param schema_form: Schema form
Expand Down Expand Up @@ -1109,7 +1110,14 @@ def get_key_value(schema_form, val, parent_key):
parent_key,
value_key.get("dateType")
).get('key')

if val2.get("@attributes") is not None:
value_key = val2.get('@attributes')
if value_key.get("relationType") is not None:
key_data['@relation_type'] = get_autofill_key_path(
schema_form,
parent_key,
value_key.get("relationType")
).get('key')
return key_data


Expand Down
40 changes: 26 additions & 14 deletions modules/weko-items-ui/tests/test_utils.py

Large diffs are not rendered by default.

Loading
Loading