w3c / rdf-star

RDF-star specification
https://w3c.github.io/rdf-star/
Other
119 stars 23 forks source link

Modifications to SHACL to incorporate RDF-star #122

Open afs opened 3 years ago

afs commented 3 years ago

RDF-star adds a new RDF term for embedded triples.

This issue is to gather together the possible changes for "SHACL-star".

afs commented 3 years ago

See also #77

sh:nodeKind

Add class sh:EmbTriple and add to the possible objects of sh:nodeKind.

Possibly add all the "Or" forms of pairs, and now 3-way combinations. sh:IRIOrEmbTriple etc.

Compact Syntax

Extend Compact Syntax to include syntax <<>> in rule iriOrLiteral

Modify the nodeKind production to add EmbTriple and possibly the "or" forms.

HolgerKnublauch commented 3 years ago

At TopQuadrant we find a constraint component such as dash:reifiableBy very useful.

http://datashapes.org/reification.html#reifiableBy

Basically it starts at the subject that has a property that can have reified values, and then makes sure that IF reified triples exist then those conform to the given shape. But equally important, it is a declarative way to tell user interfaces which properties should be suggested if someone opens the reification panel on a form, see screenshot in the link above.

A future SHACL 1.1 could incorporate this constraint component in the sh: namespace. Meanwhile, dash:reifiableBy may get implemented by other platforms too.

afs commented 3 years ago

It would be convenient to navigate embedded triples in a similar sh:property.

sh:subject, sh:predicate, sh:object (the "isTriple" function is sh:nodeKind sh:EmbTriple).

:MyNodeShape a sh:NodeShape ;
    sh:subject [
        # A node shape about the subject
        sh:nodeKind sh:IRI ;
    ] ;
    sh:object [
        sh:pattern "^ABC" ;
    ] ;
HolgerKnublauch commented 3 years ago

Do you have an example use case for that?

afs commented 3 years ago

When the target asserted triple isn't in the graph being validated:

:x sh:targetSubjectOf :source ;
   sh:subject [ sh:hasValue <http://example/s> ] ;
   .

to validate

 << :s :p :o>> :source :z .

The principle is to have navigation down to atomic terms. Triples are a compound of 3 elements. SHACL has navigation for triples and to the components of literals.

afs commented 3 years ago

From : @pchampin https://lists.w3.org/Archives/Public/public-rdf-star/2021Jul/0006.html

Not a requirement, but a nice to have: a common pattern in RDF-star is to use a triple both as asserted and embedded/quoted. Turtle-star provides syntactic sugar (called "annotation") for this:

     :alice :workingFor :acme {| :since "2013"^^xsd:gYear |}.

It would be nice to be able to constrain that pattern in an equally concise way in SHACL, something like:

    ex:PersonShape
        a sh:NodeShape ;
        sh:targetClass ex:Person ;
        sh:property [
            sh:path ex:workingFor ;
            sh:class ex:Company ;
            shx:annotation [
                sh:path ex:since ;
                sh:datatype xsd:gYear ;
            ]
        ] .
VladimirAlexiev commented 3 years ago

Have you looked at https://www.w3.org/wiki/PropertyReificationVocabulary, http://smiy.sourceforge.net/prv/spec/propertyreification.html for ways to capture representation patterns?

afs commented 3 years ago

@VladimirAlexiev - how do you see that applying to SHACL?

VladimirAlexiev commented 3 years ago

Some sort of translation of PRV to SHACL?

TallTed commented 3 years ago

@VladimirAlexiev -- Perhaps you could provide a bit more detail of what you're hinting at?

afs commented 2 years ago

See also: https://github.com/w3c/shacl/issues/15