1 year ago
#19609
ZorgoZ
How to query the most specific type of a property
I have an objectProperty
hierarchy. At a certain level of it, there is a sub-property X
, which has its own sub-properties, let's say X1
and X2
one level below it. The actual property assertions are made using X1
and X2
. However, I am querying with select * {?s :X ?o}
to get them all. What I would want to get also is the IRI of the concrete X
descendant that was used in the assertion.
Is this achievable, and how?
[Update 01.07] Just a demo:
@prefix : <http://test/demo#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
:x {
:X a owl:ObjectProperty.
:X1 a owl:ObjectProperty ; rdfs:subPropertyOf :X .
:X11 a owl:ObjectProperty; rdfs:subPropertyOf :X1 .
:X12 a owl:ObjectProperty; rdfs:subPropertyOf :X1 .
:o1 a owl:Thing.
:o2 a owl:Thing.
:o1 :X11 owl:Thing.
:o2 :X12 owl:Thing.
}
Queries:
1)
prefix : <http://test/demo#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * FROM :x {?s :X ?o}
With reasoning on returns the facts, but no clue about the assertions. With reasoning off, returns nothing, as expected. @ValerioCocchi this is not good for me.
2)
prefix : <http://test/demo#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select * FROM :x {?p rdfs:subPropertyOf* :X . ?s ?p ?o}
With reasoning off, return the information needed. @UninformedUser, thank you!
sparql
owl
description-logic
0 Answers
Your Answer