- From: Dimitris Kontokostas <kontokostas@informatik.uni-leipzig.de>
- Date: Thu, 25 Feb 2016 23:18:35 +0200
- To: public-data-shapes-wg <public-data-shapes-wg@w3.org>
- Message-ID: <CA+u4+a3_yCLN4duGu0BnXFk7jpmdiO5d94y3Lhh6pcQez59u+g@mail.gmail.com>
To continue my question on the call
assuming we have the definition of sh:hasValue which according to the spec
is
SELECT $this ($this AS ?subject) $predicate
WHERE {
FILTER NOT EXISTS { $this $predicate $hasValue . }
}
Using a variation of example 9 from the spec we have the following shape
definition
ex:FilteredExampleShape
a sh:Shape ;
sh:filterShape [
sh:property [
sh:predicate ex:requiredProperty ;
sh:hasValue ex:requiredValue ;
] ] ;
sh:property [
sh:predicate ex:someProperty ;
sh:hasValue ex:someValue ;
] .
My comment was the the sparql query for sh:hasValue in the filterShape will
have to be inverted and the final sparql query should look like
SELECT $this ($this AS ?subject) $predicate
WHERE {
FILTER EXISTS { $this ex:requiredProperty ex:requiredValue . } # filter
(note the missing NOT)
FILTER NOT EXISTS { $this ex:someProperty ex:someValue . } # constraint
}
I didn't invest a lot of thought in filters yet but when I tried to
implement them, this is where I stumbled upon and postponed. Are there
other ways to achieve this? e.g. with SPARQL MINUS?
Best,
Dimitris
--
Dimitris Kontokostas
Department of Computer Science, University of Leipzig & DBpedia Association
Projects: http://dbpedia.org, http://rdfunit.aksw.org, http://
http://aligned-project.eu
Homepage:http://aksw.org/DimitrisKontokostas
Research Group: AKSW/KILT http://aksw.org/Groups/KILT
Received on Thursday, 25 February 2016 21:19:30 UTC