Пример #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))
Пример #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))
Пример #3
0
 def label(self, concept, models=[]):
     labels = simplequery(self.conn, (concept, "rdfs:label", "?label"),
                          models)
     if labels:
         return labels.pop()
     else:
         return concept
Пример #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))
Пример #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))
Пример #6
0
 def label(self, concept, models = []):
     labels = simplequery(self.conn, (concept, "rdfs:label", "?label"), models)
     if labels:
         return labels.pop()
     else:
         return concept