- From: Torben Knerr <derukio@gmail.com>
- Date: Thu, 25 Jan 2007 23:45:55 +0100
- To: public-sparql-dev@w3.org
- Message-ID: <dffa737e0701251445m79d6adeamda28c96dd7a14a1e@mail.gmail.com>
Dear List Members, I am stuck with formulating a SPARQL query which checks wheter one graph structure is contained in another. Consider the following example of an imaginery "theory-of-sets" ontology: setA a Set setB a Set setC a Set setD a Set el_1 a Element el_2 a Element el_3 a Element el_4 a Element setA contains el_1, el_2, el_3 setB contains el_1, el_3 setC contains el_2, el_4 setD contains el_3 Now here is the question: Is it possible (with a SPARQL query) to retrieve all sets, which are sub-sets of setA? To be more precise: Is there a SPARQL query, which returns all Sets containing only Elements, which are also contained in setA? Premise: you know the Elements of setA explicitly, but you know nothing about the other Sets and their Elements. Here's my try (Problem: it doesn't filter out setC): SELECT ?set WHERE { ?set a :Set . ?set :contains ?x . FILTER (?x = :Element_1 || ?x = :Element_2 || ?x = :Element_3 ) } The obvious solution would be setB and setD (and maybe setA itself, too), but not setC. I have tried to solve this puzzle for days now, without success. I wonder if such a query is possible with SPARQL. Any suggestions are welcome! Best regards, Torben
Received on Friday, 26 January 2007 04:51:55 UTC