@@ -239,6 +239,39 @@ def save_section(self, sec, curr_node):
239239 curr_lit = Literal (curr_val )
240240 self .graph .add ((curr_node , curr_pred , curr_lit ))
241241
242+ def save_property (self , prop , curr_node ):
243+ """
244+ Add the current odML Property to the RDF graph and handle all child
245+ elements.
246+
247+ :param prop: An odml Section that should be added to the RDF graph.
248+ :param curr_node: An RDF node that is used to append the current odml element
249+ to the current RDF graph.
250+ """
251+ fmt = prop .format ()
252+
253+ self .graph .add ((curr_node , RDF .type , URIRef (fmt .rdf_type )))
254+
255+ for k in fmt .rdf_map_keys :
256+ curr_pred = fmt .rdf_map (k )
257+ # Make sure the content of "value" is only accessed via its
258+ # non deprecated property "values".
259+ if k == "value" :
260+ curr_val = getattr (prop , fmt .map (k ))
261+ else :
262+ curr_val = getattr (prop , k )
263+
264+ # Ignore "id" and empty values, but make sure the content of "value"
265+ # is only accessed via its non deprecated property "values".
266+ if k == "id" or not curr_val :
267+ continue
268+ elif k == "value" :
269+ # generating nodes for Property values
270+ self .save_odml_values (curr_node , curr_pred , curr_val )
271+ else :
272+ curr_lit = Literal (curr_val )
273+ self .graph .add ((curr_node , curr_pred , curr_lit ))
274+
242275 def save_element (self , odml_elem , node = None ):
243276 """
244277 Save the current odml element to the RDF graph and handle all child
0 commit comments