1414
1515
1616class Node (metaclass = Registry ):
17+ """
18+ Base class for a metadata node
19+ """
20+
1721 @property
1822 def uuid (self ):
1923 if self .id is not None :
@@ -29,7 +33,7 @@ def has_property(self, name):
2933
3034 def to_jsonld (self , include_empty_properties = True , embed_linked_nodes = True , with_context = True ):
3135 """
32- docstring goes here
36+ Return a represention of this metadata node as a dictionary that can be directly serialized to JSON-LD.
3337 """
3438
3539 def value_to_jsonld (value ):
@@ -77,7 +81,7 @@ def value_to_jsonld(value):
7781 @classmethod
7882 def from_jsonld (cls , data ):
7983 """
80- docstring goes here
84+ Create a Python object representing a metadata node from a JSON-LD-compatible dictionary
8185 """
8286 data_copy = data .copy ()
8387 context = data_copy .pop ("@context" , None )
@@ -141,7 +145,7 @@ def links(self):
141145
142146class LinkedMetadata (Node ):
143147 """
144- docstring goes here
148+ A Python representation of a metadata node that should have a unique identifier.
145149 """
146150
147151 def __init__ (self , id = None , ** properties ):
@@ -151,15 +155,15 @@ def __init__(self, id=None, **properties):
151155
152156 def save (self , file_path , indent = 2 ):
153157 """
154- docstring goes here
158+ Save this object to a file in JSON-LD format
155159 """
156160 with open (file_path , "w" ) as output_file :
157161 json .dump (self .to_jsonld (), output_file , indent = indent )
158162
159163 @classmethod
160164 def load (cls , file_path ):
161165 """
162- docstring goes here
166+ Create a Python object representing a metadata node from a JSON-LD file
163167 """
164168 with open (file_path , "r" ) as input_file :
165169 data = json .load (input_file )
@@ -168,7 +172,8 @@ def load(cls, file_path):
168172
169173class EmbeddedMetadata (Node ):
170174 """
171- docstring goes here
175+ A Python representation of a metadata node that should only be embedded within another node,
176+ and should not have a unique identifier.
172177 """
173178
174179 def __init__ (self , ** properties ):
@@ -177,6 +182,10 @@ def __init__(self, **properties):
177182
178183
179184class IRI :
185+ """
186+ Representation of an Internationalized Resource Identifier
187+ """
188+
180189 def __init__ (self , value : Union [str , IRI ]):
181190 if isinstance (value , IRI ):
182191 iri = value .value
0 commit comments