Reputation: 1
I'm just getting started with SPARQL. I am not sure where the error is. I came across the error as I was testing out the reasoner.
i use Stardog as database and the reasoner is definitely on.
i have a simple model with two classes: Building and Room and with 1 individual each: building001 and room001.
I have two ObjectProperties hasLocation and isLocationOf . Both ObjectProperties are inverse to each other.
The triple: Building001 hasLocation Room001 I have predefined, the reasoner should actually recognize the triple Room001 isLocationOf Building001 itself.
I now want to output all triples that belong to individuals. So I should get the two triples just described as a result.
With the query:
select * where {
?subject ?property ?object.
?subject a owl:NamedIndividual.
?property a owl:ObjectProperty.
?object a owl:NamedIndividual.
}
I only get the triple Building001 hasLocation Room001 as result.
with the query:
select * where {
?subject ?property ?object
}
I get the following triples as result :
Building001 hasLocation Room001
Room001 isLocationOf Building001
Building001 rdf:type Building
Building001 rdf:type owl:Thing
Room001 rdf:type Room
Room001 rdf:type owl:Thing
How do I get all the triples that belong to individuals? without getting rdf:type in the result?
Many thanks in advance!!
Upvotes: 0
Views: 154
Reputation: 2147
You can just filter out rdf:type
:
SELECT * {
?s ?p ?o
FILTER (?p != rdf:type)
}
You'll notice when you turn reasoning on the triples associated with your schema are not returned but the rdf:type
triples are. That's because these triples are considered part of your individual assertions, not your schema.
Upvotes: 0