예제 #1
0
 def sparql_query_owlready(self, query):
     """
     ""SELECT ?p WHERE {
       <http://www.semanticweb.org/jiba/ontologies/2017/0/test#ma_pizza> <http://www.semanticweb.org/jiba/ontologies/2017/0/test#price> ?p .
     }""
     """
     my_world = World()
     onto = my_world.get_ontology(
         join(self._onto.path, self._onto.owl_file + ".owl")).load()
     graph = my_world.as_rdflib_graph()
     return list(graph.query_owlready(query))
예제 #2
0
 def __init__(self, data_dir_path):
     my_world = World()
     # path to the owl file is given here
     my_world.get_ontology("file://%s" % data_dir_path).load()
     sync_reasoner(my_world)  # reasoner is started and synchronized here
     self.graph = my_world.as_rdflib_graph()