an alternative proposal for partition

The current partition meets some additive use cases like:
  <S> {
    dc:creator PATTERN "^mailto:a.gov" ; # one a.gov creator
    dc:creator PATTERN "^mailto:b.mil"   # and one b.mil creator
  }

but not ones with any algebraic operators like:
  <S> {
    (   dc:creator PATTERN "^mailto:.*@a.gov"  # either creator a.gov
      | dc:creator {                           # or a creator some node
          foaf:mbox PATTERN "^mailto:.*@a.gov" # with a foaf:mbox of a.gov
        }
    ) ;
    dc:creator PATTERN "^mailto:.*@b.mil"     # and one b.mil creator
  }

An alternative which would be to create a syntax to capture ShEx's
partition semantics which say:
  Map the triples to the triple patterns with the same predicate.
  The node is valid with respect to a triple expression if there
  is a mapping of triple to triple pattern which satisfies the
  expression.
For instance, the data
  <s> dc:creator <mailto:a@b.mil> .
  <s> dc:creator _:b1 .
  _:b1 foaf:mbox <mailto:b@a.gov> .
satisfies the above pattern.

I propose leveraging the current partition but allowing expressions:
  <S> sh:partition [
    sh:and (
      [ sh:property [
          sh:predicate ex:creator ; sh:minCount 1 ; sh:maxCount 1 ;
	  sh:pattern "^mailto:.*@a.gov" ] ]
      [ sh:property [
          sh:predicate ex:creator ; sh:minCount 1 ; sh:maxCount 1 ;
	  sh:pattern "^mailto:.*@b.mil" ] ]
    ) .

This also handily provides a semantics with a disjunctive OR so e.g.
  <EmployeeShape> {
      foaf:name .          # either a foaf:name
    | ( foaf:givenName . ; # or a pair of givenName
        foaf:familyName .  # and familyName
      )
  }
would not be satisfied with a partial pair:
  <emp1> foaf:name "Alice Cooper" .
  <emp1> foaf:familyName "Cooper" .
because the 1st disjoint doesn't use the 2nd triple and the 2nd
disjoint is missing a familyName.

Users wanting either additive properties or disjunctive OR could
use the sh:partition operator.

-- 
-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 Thursday, 11 August 2016 01:32:43 UTC