Re: No results when running the same SPARQL query in Owlready compared to Protege

Posted by Richard on
URL: http://owlready.306.s1.nabble.com/No-results-when-running-the-same-SPARQL-query-in-Owlready-compared-to-Protege-tp528p533.html

It would be cool to see this working in owlready2. Here's what I've been doing with just rdflib:

from rdflib.plugins.sparql import prepareQuery
from rdflib import URIRef

onto = get_ontology("file://../Ontology/newOnto.owl").load()
graph = default_world.as_rdflib_graph()

UC = URIRef('http://www.semanticweb.org/myonto#')
q = prepareQuery('''SELECT ?UseCase
                       WHERE {
                                 ?UseCase UC:hasBoundary 'D' .}""", initNs={'UC':UC} )
for row in graph.query(q):
    print(row)