Exemplo n.º 1
0
 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))
Exemplo n.º 2
0
 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))
Exemplo n.º 3
0
 def label(self, concept, models=[]):
     labels = simplequery(self.conn, (concept, "rdfs:label", "?label"),
                          models)
     if labels:
         return labels.pop()
     else:
         return concept
Exemplo n.º 4
0
 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))
Exemplo n.º 5
0
 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))
Exemplo n.º 6
0
 def label(self, concept, models = []):
     labels = simplequery(self.conn, (concept, "rdfs:label", "?label"), models)
     if labels:
         return labels.pop()
     else:
         return concept