- From: Jeremy Wong 黃泓量 <jeremy@miko.hk>
- Date: Thu, 12 Jan 2006 17:35:13 +0800
- To: "Semantic Web" <semantic-web@w3.org>
Below is a SPARQL query to retrieve pairs of resource and resource's
property (when the resource acts as subject). It is to find out whether the
set of rdfs:domain of a rdf:Property is a subset of the set of rdfs:Class of
a resource. It looks so lengthy... Any way to improve the query?
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?r0 ?property{
?r0 a ?c0.
?property rdfs:domain ?c0.
OPTIONAL{
?property rdfs:domain ?c1.
FILTER(?c1=?c0)
OPTIONAL{
?property rdfs:domain ?c2a.
FILTER(?c2a!=?c1)
}
FILTER(BOUND(?c2a))
OPTIONAL{
?property rdfs:domain ?c2.
FILTER(?c2!=?c1)
OPTIONAL{
?r2 a ?c2
}
FILTER(?r2=?r0)
}
FILTER(!BOUND(?r2))
}
FILTER(!BOUND(?c1))
}
Regards,
Jeremy Wong 黃泓量
--
Miko-Kings Instruments Ltd.
Web: http://www.miko.com.hk/
Received on Thursday, 12 January 2006 09:36:56 UTC