Skip to content
Open
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
12 changes: 11 additions & 1 deletion pipeline/src/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,18 @@ def from_jsonld(cls, data):
if issubclass(cls, LinkedMetadata):
deserialized_data["id"] = data_copy.pop("@id", None)
for property in cls.properties:
if property.path in data_copy: # todo: use context to resolve uris
found = False
if property.path in data_copy:
value = data_copy.pop(property.path)
found = True
else:
# todo: implement or import a function that does a full JSON-LD expansion
# not just this special case
expanded_path = f"{cls.context['@vocab']}{property.path}"
if expanded_path in data_copy:
value = data_copy.pop(expanded_path)
found = True
if found:
if value:
deserialized_data[property.name] = property.deserialize(value)
else:
Expand Down