[shex] Allow property paths in ShapeMaps (#92)

labra has just created a new issue for https://github.com/shexSpec/shex:

== Allow property paths in ShapeMaps ==
The current shape map specification allows node selectors like:

```
{ FOCUS rdf:type :Person}@<PersonShape>
```

to select all nodes that have type `:Person` to be checked as `<PersonShape>`. 

It would be helpful to extend the grammar of node selectors to allow SPARQL property paths apart of single iris. 

For example:

```
{ FOCUS rdfs:subClassOf*/rdf:type :Person}@<PersonShape>
```

The [Shaclex implementation](https://github.com/labra/shaclex) already supports this feature. 

The grammar employed can be seen [here](https://github.com/labra/shaclex/blob/master/modules/shapeMaps/src/main/antlr4/ShapeMap.g4)

The relevant parts are in lines: 

```
triplePattern    : '{' KW_FOCUS path (objectTerm | '_' ) '}' # focusSubject
                 | '{' (subjectTerm | '_') path KW_FOCUS '}' # focusObject
                 ;
status           : negation | questionMark ;
reason           : '/' string ;
jsonAttributes   : '$' ; // TODO

// SPARQL Grammar rule 82
path             : pathAlternative ;

pathAlternative  : pathSequence ( '|' pathSequence ) *
                 ;

pathSequence     : pathEltOrInverse ( '/' pathEltOrInverse ) *
                 ;

pathEltOrInverse : pathElt | inverse pathElt
                 ;

inverse          : '^'
                 ;

pathElt          : pathPrimary pathMod?
                 ;

// Todo: Add pathNegatedPrimarySet
pathPrimary      : nodeIri | rdfType | '(' path ')'
                 ;

pathMod          : '*'    # star
                 | '?'    # optional
                 | '+'    # plus
                 ;

```


Please view or discuss this issue at https://github.com/shexSpec/shex/issues/92 using your GitHub account

Received on Sunday, 23 June 2019 07:14:26 UTC