def addRefToGraph(self, g): gu = GraphUtils(curie_map.get()) n = self.short_citation if n is None: n = self.title if self.ref_url is not None: ref_uri = URIRef(self.ref_url) g.add((ref_uri, DC['title'], Literal(self.title))) g.add((ref_uri, RDF['type'], gu.getNode(self.ref_type))) g.add((ref_uri, RDFS['label'], Literal(n))) elif self.ref_id is not None: gu.addIndividualToGraph(g, self.ref_id, n, self.ref_type) if self.title is not None: gu.addTitle(g, self.ref_id, self.title) else: # should never be true logger.error("You are missing an identifier for a reference.") # TODO what is the property here to add the date? # if self.year is not None: # gu.addTriple() # if self.author_list is not None: # for a in self.author_list: # gu.addTriple( # g, self.ref_id, self.props['has_author'], a, True) return
def addRefToGraph(self, g): gu = GraphUtils(curie_map.get()) n = self.short_citation if n is None: n = self.title gu.addIndividualToGraph(g, self.ref_id, n, self.ref_type) if self.title is not None: gu.addTitle(g, self.ref_id, self.title) # todo what is the property here to add the date? #if self.year is not None: # gu.addTriple() #if self.author_list is not None: # for a in self.author_list: # gu.addTriple(g, self.ref_id, self.props['has_author'], a, True) return