|
I have created a small ontology and generated some instances. When I run a query retrieving all the properties related to the instances of a particular class, it also outputs '[6]'. I was curious what exactly is that and where does it come from.
The complete code and the output are below:
first_ont = get_ontology('FirstOntology')
first_ns = first_ont.get_namespace('FirstOntology')
with first_ns:
class Entity1A(Thing): pass
class Entity1B(Thing): pass
class Property1AB(Entity1A >> Entity1B, ObjectProperty): pass
class Property1(Entity1A >> str, DataProperty): pass
N = 100
for i in range(N):
instanceA = first_ns.Entity1A('Instance1A_' + str(i))
instanceB = first_ns.Entity1B('Instance1B_' + str(i))
instanceA.Property1AB = [instanceB]
instanceA.Property1 = [str(i)]
sync_reasoner()
first_ont.save('FirstOntology', format='ntriples')
default_world.save()
query = """
SELECT ?p {
?s a <FirstOntology.owl#Entity1A>;
?p ?o.
}
"""
print(list(default_world.sparql_query(query)))
Output:
[[6], [6], [FirstOntology.Property1AB], [FirstOntology.Property1], [6], [6], [FirstOntology.Property1AB], [FirstOntology.Property1], [6], [6], [FirstOntology.Property1AB], [FirstOntology.Property1], [6], [6], ...
|