W3C home > Mailing lists > Public > public-data-shapes-wg@w3.org > March 2015

Re: is there an implementation of Shape Expressions that correctly handles recursive shapes?

From: Peter F. Patel-Schneider <pfpschneider@gmail.com>
Date: Fri, 20 Mar 2015 09:29:29 -0700
Message-ID: <550C4AE9.2060600@gmail.com>
To: Eric Prud'hommeaux <eric@w3.org>
CC: RDF Data Shapes Working Group <public-data-shapes-wg@w3.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/20/2015 07:53 AM, Eric Prud'hommeaux wrote:
> * Peter F. Patel-Schneider <pfpschneider@gmail.com> [2015-03-20
> 06:54-0700]
.
>> 
>> I tried the following example of a recursive shape in all the ways that
>> I could think of in the online tools:
>> 
>> 
>> SCHEMA:
>> 
>> PREFIX ex: <http://ex.example/#> start = <S> <S> { ex:p @<T>* } <T> { (
>> ex:q @<Z> | ex:r @<T> ) } <Z> { }
>> 
>> DATA:
>> 
>> PREFIX ex: <http://ex.example/#> ex:a ex:p ex:b . ex:a ex:p ex:c . ex:b
>> ex:q ex:z . ex:c ex:q ex:z . ex:b ex:r ex:c . ex:c ex:r ex:b .
>> 
>> ShEx Demo (http://www.w3.org/2013/ShEx/FancyShExDemo) appears to go
>> into an infinite loop on this input.
> 
> Interesting, what browser were you using?

Firefox.  I have attached a screenshot.

> I wonder if I need to monkey around with patching Promises. I can check
> that by sticking a synchronous (doesn't use the Promises lib) in w3.org
> date space.
> 
> The attached recursiveShEx.png shows what I see with a local checkout of
> the synchronous ShEx. The '|' operator is exclusive (or exactlyOne) so
> the pattern failed trivially. I changed the data so that only one 
> disjunct matched:
> 
> PREFIX ex: <http://ex.example/#> ex:a ex:p ex:b . ex:a ex:p ex:c . #ex:b
> ex:q ex:z . #ex:c ex:q ex:z . ex:b ex:r ex:c . ex:c ex:r ex:b .
> 
> and saw that ex:a matched with ex:b and ex:c matching <T>:
> 
> PASS { ex:p @<T>* matched by ex:a ex:p ex:b . PASS { ex:r @<T> matched by
> ex:b ex:r ex:c . PASS { ex:r @<T> matched by ex:c ex:r ex:b . PASS {
> 
> } } } ex:p @<T>* matched by ex:a ex:p ex:c . PASS { ex:r @<T> matched by
> ex:c ex:r ex:b . PASS {
> 
> } } } No remaining triples.

The point of the example is to force the recursion through the negative
branch of the exclusive or, so removing the ex:q triples is a very different
example.


>> 
>> peter
>> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJVDErpAAoJECjN6+QThfjzxdkIAIA1zKxuMLFiFWhHOxDYfmQ7
5IgPGud5g+b0IzLT7kAZ1MwWstwEYG53Er9xo0n+bYDB01wUGgRDRt/btVKtTahn
8TPOSm/Hl+fodkHA9OtPDGZ8ifrbsPqGABieP11Jk8Sqhq1sSDLjyAExPPyNgg9n
wq1w6XdMKTMl1e/ALbheJ1DDbE8sjP/2+8z7UBCm7T9JY6Gnk3ozmcS1Ubz2EA6V
KO4uOMOaH2jMw4ExvWf4nifQUxJG613jgSy17izYzUYoA6dTxwUHpiQBPLriD/3n
dhWUNEcFWk1D2StTHiyXbGNCLAYIH6JisqY4R2QP3WF7l+di5CfDk8TQaGoBV+Y=
=8TTC
-----END PGP SIGNATURE-----

ShEx.png
(image/png attachment: ShEx.png)

Received on Friday, 20 March 2015 16:30:01 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:30:18 UTC