def __add_work_title__(self, work_graph, work_uri, instance_uri):
"""Method takes a new work graph and instance uri, queries for
bf:InstanceTitle of instance uri and adds values to work graph
Args:
work_graph(rdflib.Graph): RDF Graph of new BF Work
instance_uri(rdflib.URIRef): URI of BF Instance
"""
instance_key = str(instance_uri)
if instance_key in self.processed and\
"title" in self.processed[instance_key]:
work_title_bnode = rdflib.BNode()
work_graph.add((work_uri, NS_MGR.bf.title, work_title_bnode))
work_graph.add((work_title_bnode,
NS_MGR.rdf.type,
NS_MGR.bf.WorkTitle))
for row in self.processed[instance_key]["title"]:
main_title, subtitle = row["mainTitle"], row["subtitle"]
work_graph.add((work_title_bnode,
NS_MGR.bf.mainTitle,
rdflib.Literal(main_title)))
if subtitle:
work_graph.add((work_title_bnode,
NS_MGR.bf.subtitle,
rdflib.Literal(subtitle)))
评论列表
文章目录