Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches-ignore:
- '[0-9]*'
pull_request:
branches: [ main, develop ]
branches: [ main, develop, 'develop-*' ]

jobs:
build-image:
Expand Down
36 changes: 36 additions & 0 deletions addons/weko/mappings/e-rad-metadata-mappings-ro-crate.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,22 @@
".@type": "Person",
"value": "{{object_name_en_middle}}{% if object_name_en_middle %} {% endif %}{{object_name_en_first}}",
"language": "en"
},
"jpcoar:affiliation[AFFILIATION]": {
"@createIf": "{{object_affiliation_name_ja}}{{object_affiliation_name_en}}",
".@type": "Organization",
"jpcoar:affiliationName[AFFILIATION_NAME_JA]": {
"@createIf": "{{object_affiliation_name_ja}}",
".@type": "PropertyValue",
"value": "{{object_affiliation_name_ja}}",
"language": "ja"
},
"jpcoar:affiliationName[AFFILIATION_NAME_EN]": {
"@createIf": "{{object_affiliation_name_en}}",
".@type": "PropertyValue",
"value": "{{object_affiliation_name_en}}",
"language": "en"
}
}
}
},
Expand Down Expand Up @@ -499,6 +515,16 @@
".@type": "Person",
"value": "{{value}}",
"language": "ja"
},
"jpcoar:affiliation[DATA_MANAGER_AFFILIATION]": {
"@createIf": "{{grdm_file_data_man_org_ja_value}}",
".@type": "Organization",
"jpcoar:affiliationName[DATA_MANAGER_AFFILIATION_NAME_JA]": {
"@createIf": "{{grdm_file_data_man_org_ja_value}}",
".@type": "PropertyValue",
"value": "{{grdm_file_data_man_org_ja_value}}",
"language": "ja"
}
}
}
},
Expand All @@ -516,6 +542,16 @@
".@type": "Person",
"value": "{{value}}",
"language": "en"
},
"jpcoar:affiliation[DATA_MANAGER_AFFILIATION]": {
"@createIf": "{{grdm_file_data_man_org_en_value}}",
".@type": "Organization",
"jpcoar:affiliationName[DATA_MANAGER_AFFILIATION_NAME_EN]": {
"@createIf": "{{grdm_file_data_man_org_en_value}}",
".@type": "PropertyValue",
"value": "{{grdm_file_data_man_org_en_value}}",
"language": "en"
}
}
}
},
Expand Down
7 changes: 5 additions & 2 deletions addons/weko/schema/ro_crate.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ def _flatten_json_ld_root(object, counts=None):
clone = values.copy()
for item in values:

if '@id' in item:
# NOTE: The following transformation assumes Person objects.
# Ideally, the mapping should generate the correct structure directly
# rather than requiring post-processing here.
if '@id' in item and item.get('@type') == 'Person':
root_raw_id = item.get('@id')
root_base_id = normalize_base_id(root_raw_id)
if 'affiliation' in item:
Expand Down Expand Up @@ -666,7 +669,7 @@ def write_ro_crate_json(user, f, target_index, download_file_names, schema_id, f
file_ids = [
entity.get('@id')
for entity in entry_entities
if entity.get('@type') == 'File'
if entity.get('@type') == 'File' and not entity.get('wk:extendedMetadata')
]
dataset_entity = next(
(entity for entity in entry_entities if entity.get('@id') == root_id),
Expand Down
3 changes: 2 additions & 1 deletion addons/weko/scripts/export_sword_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def _ensure_schema_id(file_metadatas, schema_id):
for item in metadata_items:
items.append(item['schema'])
if not items:
raise ValueError('file_metadatas must contain items')
logging.info('No file_metadatas provided (allow_empty_files mode)')
return
if any(item != schema_id for item in items):
raise ValueError('Schema mismatch between metadata and schema_id')

Expand Down
Loading