Page MenuHomeSoftware Heritage
Paste P1399

@vocab to deduplicate namespace
ActivePublic

Authored by vlorentz on Jul 5 2022, 10:30 AM.
diff --git a/swh/indexer/metadata_dictionary/cff.py b/swh/indexer/metadata_dictionary/cff.py
index 48be831..b278e5c 100644
--- a/swh/indexer/metadata_dictionary/cff.py
+++ b/swh/indexer/metadata_dictionary/cff.py
@@ -38,19 +38,20 @@ def normalize_authors(self, d: List[dict]) -> Dict[str, list]:
result = []
for author in d:
author_data: Dict[str, Optional[Union[str, Dict]]] = {
- "@type": SCHEMA_URI + "Person"
+ "@context": {"@vocab": SCHEMA_URI},
+ "@type": "Person"
}
if "orcid" in author and isinstance(author["orcid"], str):
author_data["@id"] = author["orcid"]
if "affiliation" in author and isinstance(author["affiliation"], str):
- author_data[SCHEMA_URI + "affiliation"] = {
- "@type": SCHEMA_URI + "Organization",
- SCHEMA_URI + "name": author["affiliation"],
+ author_data["affiliation"] = {
+ "@type": "Organization",
+ "name": author["affiliation"],
}
if "family-names" in author and isinstance(author["family-names"], str):
- author_data[SCHEMA_URI + "familyName"] = author["family-names"]
+ author_data["familyName"] = author["family-names"]
if "given-names" in author and isinstance(author["given-names"], str):
- author_data[SCHEMA_URI + "givenName"] = author["given-names"]
+ author_data["givenName"] = author["given-names"]
result.append(author_data)