def classesof(self, concept, direct, models=[]): if direct: logger.warn( "Direct classes are assumed to be the asserted is-a relations") return list( simplequery(self.conn, (concept, "rdf:type", "?class"), models, assertedonly=True)) return list( simplequery(self.conn, (concept, "rdf:type", "?class"), models))
def subclassesof(self, concept, direct, models=[]): if direct: logger.warn( "Direct sub-classes are assumed to be the asserted subClassOf relations" ) return list( simplequery(self.conn, ("?subclass", "rdfs:subClassOf", concept), models, assertedonly=True)) return list( simplequery(self.conn, ("?subclass", "rdfs:subClassOf", concept), models))
def label(self, concept, models=[]): labels = simplequery(self.conn, (concept, "rdfs:label", "?label"), models) if labels: return labels.pop() else: return concept
def subclassesof(self, concept, direct, models = []): if direct: logger.warn("Direct sub-classes are assumed to be the asserted subClassOf relations") return list(simplequery(self.conn, ("?subclass", "rdfs:subClassOf", concept), models, assertedonly = True)) return list(simplequery(self.conn, ("?subclass", "rdfs:subClassOf", concept), models))
def instancesof(self, concept, direct, models = []): if direct: logger.warn("Direct instances are assumed to be the asserted is-a relations") return list(simplequery(self.conn, ("?instances", "rdf:type", concept), models, assertedonly = True)) return list(simplequery(self.conn, ("?instances", "rdf:type", concept), models))
def label(self, concept, models = []): labels = simplequery(self.conn, (concept, "rdfs:label", "?label"), models) if labels: return labels.pop() else: return concept