- From: Christian Morbidoni <christian.morbidoni@gmail.com>
- Date: Thu, 10 Nov 2011 15:44:13 +0100
- To: Aidan Hogan <aidan.hogan@deri.org>
- Cc: Irene Celino <irene.celino@gmail.com>, semantic-web@w3.org
- Message-ID: <CAE_W9BjLuGC6m_zM9cqn2gtvR9gNTDqKr5eDGX_vGmV_osLLGQ@mail.gmail.com>
Thanks for the reply... I found this query working quite nice: SELECT DISTINCT ?uri WHERE { { ?uri a <http://www.w3.org/2000/01/rdf-schema#Resource> . OPTIONAL {?uri a ?type2. FILTER(?type2 != < http://www.w3.org/2000/01/rdf-schema#Resource>) .} . FILTER(!BOUND(?type2)) . } UNION { ?uri a <http://www.w3.org/2002/07/owl#Thing> . OPTIONAL {?uri a ?type2. FILTER(?type2 != < http://www.w3.org/2002/07/owl#Thing>) .} . FILTER(!BOUND(?type2)) . } } best, Christian On Wed, Nov 9, 2011 at 4:09 PM, Aidan Hogan <aidan.hogan@deri.org> wrote: > To add to Irene's answer, you can also do negation-as-failure in SPARQL > (1.0): > > PREFIX ... > SELECT ?s > WHERE ?s { > ?s ?p ?o . > OPTIONAL { ?s a ?type . FILTER (?type != rdfs:Resource) } > FILTER (!bound(?type)) > } > > (BTW, not sure what you mean by "auto-typing" here unless maybe you mean > through something like the rdfs4* rules.) > > > On 08/11/2011 18:05, Irene Celino wrote: > > If you're using SPARQL 1.1, you can use FILTER NOT EXISTS or MINUS, > > see: http://www.w3.org/TR/sparql11-**query/#negation<http://www.w3.org/TR/sparql11-query/#negation> > > > > HTH, > > Irene > > > > Il 08 novembre 2011 17:23, Christian Morbidoni > > <christian.morbidoni@gmail.com**> ha scritto: > >> Hi all, > >> I'm trying to build a SPARQL query that selects all the resources that > are > >> ONLY rdfs:Resources (untyped let's say). > >> What I need is to identify those resources that do not have an explicit > >> rdf:type, thus are of rdf:type rdfs:Resource. > >> In the past I did it in Serql using the MINUS construct...but when it > comes > >> to sparql I don't know how to solve it... > >> Could anyone help me out please? > >> best, > >> Christian > > > > > > > >
Received on Thursday, 10 November 2011 14:44:42 UTC