Re: Filter handling on the metamodel

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.

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://rdfunit.aksw.org, 
> http://http://aligned-project.eu <http://aligned-project.eu/>
> Homepage:http://aksw.org/DimitrisKontokostas
> Research Group: AKSW/KILT http://aksw.org/Groups/KILT
>

Received on Thursday, 25 February 2016 23:13:20 UTC