Johann,
if you are using Jena you could try the extensions described at http://jena.sourceforge.net/ARQ/property_paths.html
regards,
AndyL
On Aug 31, 2009, at 12:05 PM, Lee Feigenbaum wrote:
Hi Johann,
In current SPARQL, triple patterns can only query for fixed length
paths through the graph. There's no way to ask for arbitrary length
paths of owl:equivalentClass statements. If all owl:equivalentClass
statements are pairwise explicitly asserted in your store, then you
should be able to do:
SELECT DISTINCT ?cl WHERE
{
{ ?cl a owl:Class }
OPTIONAL {
{ ?cl rdfs:subClassOf ?sc . }
UNION
{ ?cl rdfs:subClassOf [ owl:equivalentClass ?sc ] }
FILTER (?cl != ?sc && ?sc != owl:Thing && ?sc != rdfs:Resource)
}
FILTER (!bound(?sc))
}
Lee
Since SERQL supports nested selects and the minus, any etc.
operators, this can be done in one SERQL query.
http://www.langegger.at
----------------------------------------------------------------------
Dipl.-Ing.(FH) Andreas Langegger
FAW - Institute for Application-oriented Knowledge Processing
Johannes Kepler University Linz
A-4040 Linz, Altenberger Straße 69