Re: an alternative proposal for partition

This looks like quite a mega feature, if sh:and and sh:or become 
overloaded with very different meaning, requiring a new execution 
algorithm etc. What about spawning this off into an extension, just like 
the SPARQL stuff is in an extension?

Another option is to handle this on the Compact Syntax level, and 
produce QCRs under the hood. Are there any scenarios where QCRs could 
not (in principle) express your use cases?

Holger


On 11/08/2016 11:32, Eric Prud'hommeaux wrote:
> 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.
>

Received on Thursday, 11 August 2016 07:15:27 UTC