Re: Inclusion of shapes

* Olivier Rossel <olivier.rossel@gmail.com> [2014-05-27 12:09+0200]
> Something is still unclear when reading ShEx documents.
> What is the proper inclusion mechanism between these shapes :
> 
> Start=<XXX>
> <XXX> & <ToBeIncluded>{
> }
> 
> <ToBeIncluded>{
>    :p2 xsd:string
> }
> 
> and those shapes:
> 
> Start=<XXX>
> <XXX> {
>     & <ToBeIncluded>,
>    :p rdf:Resource
> }
> 
> <ToBeIncluded>{
>    :p2 xsd:string
> }
> 
> 
> Any help is welcome.

<CHILD> &<BASE> {} and <CHILD> { &<BASE> } match the same data. The
difference manifests if there's a reference to <BASE>. I'm assuming
you intended the rule about ":p rdf:Resource" to appear in the upper
<XXX> rule รก la:

  <XXX> & <ToBeIncluded>{
    :p rdf:Resource
  }

Both will match the data:

  <xxx> :p <foo> ; :p2 "bar" .

If your start was instead <ToBeIncluded>, the above data would match
only the upper example. When a rule is referenced, either by start= or
by some ValueReference like :p @<ToBeIncluded>, any shape which
extends the referenced class (like <XXX> & <ToBeIncluded> in the first
example) may match the data. As an example, suppose a <Person> must be
either a <User> or an <Employee>:

  PREFIX foaf: <http://foaf.example/#>
  start = <Person>
  <Person> { foaf:name LITERAL }
  <User> &<Person> { foaf:mbox IRI }
  <Employee> &<Person> { foaf:phone IRI }

See <http://w3.org/brief/MzY5> for some example data.

-- 
-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.

Received on Tuesday, 27 May 2014 11:01:42 UTC