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




Reply via email to