def populate_entity(self, bf_class, existing_uri=None):
"""Takes a BIBFRAME graph and MODS XML, extracts info for each
entity's property and adds to graph.
Args:
bf_class(rdflib.URIRef): Namespace URI
Returns:
rdflib.URIRef: URI of new entity
"""
if existing_uri:
entity_uri = existing_uri
else:
# Check for custom IRIPattern
entity_uri = self.__pattern_uri__(bf_class)
# Finally generate an IRI from the default patterns
if not entity_uri:
entity_uri = self.__generate_uri__()
self.graph.add((entity_uri, rdflib.RDF.type, bf_class))
self.update_linked_classes(bf_class, entity_uri)
self.update_direct_properties(bf_class, entity_uri)
self.update_ordered_linked_classes(bf_class, entity_uri)
self.add_admin_metadata(entity_uri)
self.clean_rdf_types()
return entity_uri
评论列表
文章目录