@@ -47,7 +47,7 @@ def value_to_jsonld(value):
4747 else :
4848 if hasattr (value , "id" ) and value .id is None :
4949 raise ValueError ("Exporting as a stand-alone JSON-LD document requires @id to be defined." )
50- item = {"@id" : value .id , "@type" : value . type_ }
50+ item = {"@id" : value .id }
5151 elif isinstance (value , EmbeddedMetadata ):
5252 item = value .to_jsonld (
5353 with_context = False ,
@@ -142,6 +142,14 @@ def links(self):
142142 _links .extend (value .links )
143143 return _links
144144
145+ def _resolve_links (self , node_lookup ):
146+ """Replace `Link` attributes with typed Nodes where possible"""
147+ for property in self .__class__ .properties :
148+ value = getattr (self , property .name )
149+ if isinstance (value , Link ):
150+ resolved_value = node_lookup [value .identifier ]
151+ setattr (self , property .name , resolved_value )
152+
145153
146154class LinkedMetadata (Node ):
147155 """
@@ -181,9 +189,16 @@ def __init__(self, **properties):
181189 setattr (self , name , value )
182190
183191
192+ class Link :
193+ """Representation of a metadata node for which only the identifier is currently known."""
194+
195+ def __init__ (self , identifier ):
196+ self .identifier = identifier
197+
198+
184199class IRI :
185200 """
186- Representation of an Internationalized Resource Identifier
201+ Representation of an International Resource Identifier
187202 """
188203
189204 def __init__ (self , value : Union [str , IRI ]):
0 commit comments