- From: Dimitris Kontokostas <kontokostas@informatik.uni-leipzig.de>
- Date: Fri, 26 Feb 2016 09:52:23 +0200
- To: Holger Knublauch <holger@topquadrant.com>
- Cc: public-data-shapes-wg <public-data-shapes-wg@w3.org>
- Message-ID: <CA+u4+a3_Z7rjOx2_4M2Z0sq8WqYYDi2H7vjJCWZXXtAspjb6UA@mail.gmail.com>
On Fri, Feb 26, 2016 at 1:12 AM, Holger Knublauch <holger@topquadrant.com>
wrote:
> Hi Dimitris,
>
> I think this is taking us back to the (old) topic of whether we are able
> to generate a single large standards-compliant SPARQL query for consumption
> by SPARQL endpoints. We decided earlier that support for SPARQL endpoints
> would limit us too much, and we can cover more use cases, and come up with
> a simpler design, if we make support for SPARQL endpoints optional.
>
> To answer your specific question, my naive implementation is using the
> sh:hasShape function for filter evaluation. This also covers the
> possibility of recursion, bnodes etc.
>
That's all I needed, I don't want to re-start this thread either.
> In the very worst case, the work-around is always to do the looping
> outside of a single SPARQL query, i.e. collect the focus nodes from the
> server, then check their filter conditions one-by-one.
>
> Other than that, the obvious work-around for the SHACL Core language, is
> to hard-code the SPARQL generation (sh:hasValue etc), and this is what I
> would recommend most people anyway, because this way the query engine can
> be optimized for all kinds of corner cases. This should cover a large
> amount of SHACL models. We don't need to overburden the metamodel with such
> considerations.
>
> Holger
>
>
>
> On 26/02/2016 7:18, Dimitris Kontokostas wrote:
>
> 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://dbpedia.org, http://rdfunit.aksw.org,
> http:// <http://aligned-project.eu/>http://aligned-project.eu
> Homepage: <http://aksw.org/DimitrisKontokostas>
> http://aksw.org/DimitrisKontokostas
> Research Group: AKSW/KILT http://aksw.org/Groups/KILT
>
>
>
--
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 Friday, 26 February 2016 07:53:33 UTC