Re: shapes-ISSUE-63 (sh:hasShape): Nested shapes: sh:hasShape function versus recursive SPARQL code generation [SHACL Spec]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 06/10/2015 05:58 PM, Holger Knublauch wrote:> On 6/11/2015 10:35, Peter
F. Patel-Schneider wrote:

>> On 06/10/2015 04:40 PM, Holger Knublauch wrote:
>>> On 6/11/15 3:07 AM, Peter Patel-Schneider wrote:

[...]

>>> ignoring the complications of variable scoping in SPARQL (e.g. with 
>>> sub-selects),
>> I am not aware of any problems arising from variable scoping.
> 
> For example, your
> 
> FILTER { SELECT ?this WHERE { ?this <path> ?V } GROUP BY ?this HAVING ( 
> COUNT (DISTINCT ?V) = <cardinality> ) }
> 
> doesn't work because the inner SELECT will use new bindings for ?this - 
> it's evaluated from the inside out. Beside, the FILTER syntax isn't
> valid at all.

Yeah, I forgot to add EXISTS after FILTER.  My bad.

The inner SELECT is generating bindings for ?this that are then used in a
MINUS construct so it should work out.  At least it does in my test
implementation, using Virtuoso as the SPARQL engine.

>>> ignoring how to specify things like Xor (which together with 
>>> qualified cardinality restrictions may be very problematic),
>> I am not aware of any issue with respect to XOR and qualified 
>> cardinality restrictions.
> 
> Your approach outlines how to map AND and OR (UNION), so how would you
> do Xor and QCRs?

One way to do XOR would be to expand s1 XOR s2 as
( s1 MINUS s2 ) OR ( s2 MINUS s1 )
QCRs can be done as something like
FILTER EXISTS {
  SELECT ?this
  WHERE { ?this <path> ?V .  FILTER EXISTS { SELECT ?this as ?V { <shape> } } }
  GROUP BY ?this HAVING ( COUNT (DISTINCT ?V) >= <minCardinality> ) }

[...]

peter
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJVflC5AAoJECjN6+QThfjzrjkIALXzR5GBHnBWArQlsmol8cc5
B+cmboxYenavjURqqnbdum2vbc0PbghU0s5YLwpArHvWjSFhT/KZ2F6SZZtIelTs
sECvhzieGXQEo5FYq6b6Uptdnusk6Zw6uvWg0pcC10kUpktCyCGDB0Vl2cUn2r+1
woFG0mbpiTbAVIQI3iAtnihNICpAhuHA7M0sahEsU4zueNJXzKd5r7ctt2Orb4HL
DQ93nwn3l5+MCs/zv0HQG0/RtUF7KDw3Yw9tPNzGzHBDkFXqxwm5QYTI5xBSGgjW
jJCpv/ZTfq2EUoz9hDGgDA5cdrUeQaTvHnUWvbLv50O0fruT6MQQNKSu8gbHS1Y=
=wM7O
-----END PGP SIGNATURE-----

Received on Monday, 15 June 2015 04:13:17 UTC