def populate(self, graph): def warn(triple): for element in triple: if (not (isinstance(element, rdflib.URIRef) or isinstance(element, rdflib.BNode) or isinstance(element, rdflib.Literal)) or (hasattr(element, '_value') and (isinstance(element._value, dict) or isinstance(element._value, list) or isinstance(element._value, tuple))) or (isinstance(element, rdflib.URIRef) and (element.startswith('<') or not rdflib.term._is_valid_uri(element)))): #if (isinstance(element, rdflib.URIRef) and element.startswith('<')): #breakpoint() loge.critical(element) return triple OntCuries.populate(graph) # ah smalltalk thinking if hasattr(self, 'uri_api'): base = self.uri_api + '/' graph.namespace_manager.populate_from(curies_runtime(base)) [graph.add(t) for t in self.triples_header if warn(t)] for t in self.triples: if warn(t): graph.add(t)
def populate(self, graph): def warn(triple): for element in triple: if (not (isinstance(element, rdflib.URIRef) or isinstance(element, rdflib.BNode) or isinstance(element, rdflib.Literal)) or (hasattr(element, '_value') and isinstance(element._value, dict))): log.critical(element) return triple OntCuries.populate(graph) # ah smalltalk thinking [graph.add(t) for t in self.triples_header if warn(t)] [graph.add(t) for t in self.triples if warn(t)]
def populate(self, graph): def warn(triple): for element in triple: if (not (isinstance(element, rdflib.URIRef) or isinstance(element, rdflib.BNode) or isinstance(element, rdflib.Literal)) or (hasattr(element, '_value') and (isinstance(element._value, dict) or isinstance(element._value, list) or isinstance(element._value, tuple))) or (isinstance(element, rdflib.URIRef) and element.startswith('<'))): #if (isinstance(element, rdflib.URIRef) and element.startswith('<')): #breakpoint() loge.critical(element) return triple OntCuries.populate(graph) # ah smalltalk thinking [graph.add(t) for t in self.triples_header if warn(t)] for t in self.triples: if warn(t): graph.add(t)