Re: KeyError: 'datatypeIRI' in owlready library

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

Hi,

I've managed to make your example running, using the code below.

If the problem persists, it is probably related to the content of your ontology. In this case, could you send it to me please?

Jiba


from owlready2 import *
import sys, time

onto = get_ontology("http://test.org/deneme.owl")

with get_ontology("http://muratkilinc.com/~ontologies/izmir.owl#"):
  class yas(DataProperty): pass
  class adi(DataProperty): pass
  class soyadi(ObjectProperty): pass

with onto:
  class C(Thing): pass
  c0 = C()
  c1 = C(yas = [42], adi = [40], soyadi = [c0])
 
graph = default_world.as_rdflib_graph()
r = list(graph.query_owlready("""
    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).
               
        }
"""))
print(r)