name
password
remember
EN
|
DE
|
ES
6:21 PM
Frederic
message (192)
Code
Filterprofile (8)
Answer (53)
Journal
Stamm
(metapher)
6/25/1996
41.40
Frederic
Das bin Ich - eine Privatperson wie Ihr/Wir Alle
https://www.oli-it.com
message
Frederic
6/23/2011
0.01
16332
[*]
HOWTO get only the direct rdf:type with SPARQL
My RDF graph describes a class hierarchy (rdfs:subClassOf) and some instances (rdf:type) of these classes. For a GUI treeview I need all the instances (leaves) and their direct type.
With reasoning I can query for all the instances (leaves) but get all the inferred super classes also. I need just the direct rdf:type. How can I SPARQL it?
A rdf:type rdfs:Class .
B rdfs:subClassOf A .
C rdfs:subClassOf B .
I1 rdf:type B .
I2 rdf:type C .
I3 rdf:type C .
SELECT * WHERE {
?s a A .
?s a ?t .
}
?s ?t
---- -----
I1 B
I2 C
I3 C
but I get also all the inferred statements. That's right but
I want to exclude it from the result:
I1 rdfs:Resource
I1 rdfs:Class
I2 rdfs:Resource
I2 rdfs:Class
I2 B
I3 rdfs:Resource
I3 rdfs:Class
I3 B
author (1)
description (1)
recipient (1)
answer (2)