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: Eric Prud'hommeaux <eric@w3.org>
Date: Fri, 20 Mar 2015 10:53:22 -0400
To: "Peter F. Patel-Schneider" <pfpschneider@gmail.com>
Cc: RDF Data Shapes Working Group <public-data-shapes-wg@w3.org>
Message-ID: <20150320145319.GA649@w3.org>
* Peter F. Patel-Schneider <pfpschneider@gmail.com> [2015-03-20 06:54-0700]
> I have been looking over recursive shapes in Shape Expressions.   It appears
> to me that two of the three definitions for Shape Expressions are
> ill-founded on recursive shapes.
> 
> I have also been trying to test out implementations of recursive shapes in
> Shape Expressions.  There are five implementations of Shape Expressions
> listed on http://www.w3.org/2001/sw/wiki/ShEx
> 
> Of these five
> the section on Fancy ShEx Demo has links to three online tools of which the
> ShEx Demo appears to be the one to use to check out how Shape Expressions work,
> the link for JSShexTest puts up a bare-bones online tool,
> the link for RDFShape does not produce any result,
> the link to ShExcala produces a page that points to RDFShape as its online
> tool, and
> the link to Haws produces a 404 error.
> 
> 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? 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.


> JSShexTest (http://www.jessevandam.nl/) very quickly produces
> Shex validation: Succes
> Result: FAIL
> which I read to mean that the validation failed, as expected.  However, I
> was not sure so I dug further.  The description of JSShexTest is supposed to
> be in http://www.w3.org/2001/sw/wiki/ValidationCode.   That page gives or as
> an inclusive or and not the exclusive or of Shape Expressions.  Under this
> reading of or, it appears to me that the result should be a success, but the
> documentation is too spotty for me to be sure of this.
> 
> 
> Is there an implementation of Shape Expressions that correctly handles
> recursive shapes?
> 
> 
> 
> peter
> 

-- 
-ericP

office: +1.617.599.3509
mobile: +33.6.80.80.35.59

(eric@w3.org)
Feel free to forward this message to any list for any purpose other than
email address distribution.

There are subtle nuances encoded in font variation and clever layout
which can only be seen by printing this message on high-clay paper.

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

Received on Friday, 20 March 2015 14:53:29 UTC

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