KeyError: 'datatypeIRI' in owlready library

Posted by murattkilinc on
URL: http://owlready.306.s1.nabble.com/KeyError-datatypeIRI-in-owlready-library-tp1567.html


what could be the reason I am getting key error in the following python code?

CODE:

from owlready import *

onto = get_ontology("file://C:/Users/BAUM-PC/Desktop/izmir/deneme.owl")
onto.load()

graph = default_world.as_rdflib_graph()
r = list(graph.query("""
    PREFIX uni:<http://muratkilinc.com/~ontologies/izmir.owl#>
        PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
        PREFIX un: <http://www.w3.org/2007/ont/unit#>
        PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
        SELECT ?adi ?soyadi ?yas
        WHERE
        {
                ?turistler uni:yas ?yas.
                ?turistler uni:adi ?adi.
                ?turistler uni:soyadi ?soyadi.
                FILTER(?yas > 35 && ?yas < 45).
               
        }"""))

results = default_world.as_rdflib_graph().query_owlready(r)
results = list(results)
print(results)

ERROR:

KeyError: 'datatypeIRI