W3C home > Mailing lists > Public > public-sparql-dev@w3.org > January to March 2008

Re: Is there a SPARQL way to...

From: Richard Newman <rnewman@franz.com>
Date: Fri, 1 Feb 2008 10:33:01 -0800
Message-Id: <87C813A9-203D-4637-89F2-722F66F52715@franz.com>
Cc: public-sparql-dev@w3.org
To: Max Voelkel <voelkel@fzi.de>

>   is it possible to write  a SPARQL query that given this data

<snip>

>   returns only all subjects which belong only to class A?
>   So in my example, only "ex:1" should  be returned.
>   Ah,  and  resources can have more than two classes.

I haven't run this, but this might do the trick...

SELECT ?x {
   ?x a ex:A .
   OPTIONAL {
     ?x a ?bar .
   }
   FILTER (!bound(?x) || sameTerm(?bar, ex:A))
}

> 2)  Is  there  any  kind  of collection on the web of common SPARQL  
> problems and
> queries that solve it? Maybe some wiki page?

Lee runs the SPARQL FAQ:

http://thefigtrees.net/lee/sw/sparql-faq
Received on Friday, 1 February 2008 18:33:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 1 February 2008 18:33:19 GMT