def graph_member(self, ldp_root, c_id, obj=None):
if not obj:
obj = self.member()
node = URIRef(ldp_root+encoder.encode(c_id)+"/member/"+encoder.encode(obj.id))
mappings = URIRef(node+"#mappings")
g = Graph(identifier=node)
g.add((node, RDF.type, RDA.Member))
g.add((node, DCTERMS.identifier, Literal(obj.id)))
g.add((node, RDA.location, Literal(obj.location)))
if hasattr(obj, 'datatype'):
g.add((node, RDA.datatype, Literal(obj.datatype)))
if hasattr(obj, 'ontology'):
g.add((node, RDA.ontology, Literal(obj.ontology)))
if hasattr(obj, 'mappings'):
g.add((node, RDA.mappings, mappings))
mp = obj.mappings
if hasattr(mp, 'role'):
g.add((mappings, RDA.role, URIRef(obj.mappings.role)))
if hasattr(mp, 'index'):
g.add((mappings, RDA.itemIndex, Literal(obj.mappings.index)))
if hasattr(mp, 'dateAdded'):
g.add((mappings, RDA.dateAdded, Literal(obj.mappings.dateAdded)))
return g
评论列表
文章目录