ruby-rdf / shacl

Implementation of Shapes Constraint Language (SHACL) for RDF.rb
The Unlicense
8 stars 3 forks source link

Implement SHACL Compact Syntax #1

Open gkellogg opened 2 years ago

gkellogg commented 2 years ago

From the draft at https://w3c.github.io/shacl/shacl-compact-syntax/.

Example of compact syntax:

BASE <http://example.com/ns>

IMPORTS <http://example.com/person-ontology>

PREFIX ex: <http://example.com/ns#>

shape ex:PersonShape -> ex:Person {
    closed=true ignoredProperties=[rdf:type] . 

    ex:ssn       xsd:string [0..1] pattern="^\\d{3}-\\d{2}-\\d{4}$" .
    ex:worksFor  IRI ex:Company [0..*] .
    ex:address   BlankNode [0..1] {
        ex:city xsd:string [1..1] .
        ex:postalCode xsd:integer|xsd:string [1..1] maxLength=5 .
    } .
}