File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,18 @@ def from_jsonld(cls, data):
125125 if issubclass (cls , LinkedMetadata ):
126126 deserialized_data ["id" ] = data_copy .pop ("@id" , None )
127127 for property in cls .properties :
128- if property .path in data_copy : # todo: use context to resolve uris
128+ found = False
129+ if property .path in data_copy :
129130 value = data_copy .pop (property .path )
131+ found = True
132+ else :
133+ # todo: implement or import a function that does a full JSON-LD expansion
134+ # not just this special case
135+ expanded_path = f"{ cls .context ['@vocab' ]} { property .path } "
136+ if expanded_path in data_copy :
137+ value = data_copy .pop (expanded_path )
138+ found = True
139+ if found :
130140 if value :
131141 deserialized_data [property .name ] = property .deserialize (value )
132142 else :
You can’t perform that action at this time.
0 commit comments