ShEx/Obselete/ShEx: Difference between revisions

From Semantic Web Standards
Eric (talk | contribs)
Created page with "'''ShEX, or Shape Expressions'''([http://www.w3.org/2013/ShEx/Primer.html intro]), is a language for expressing constraints on RDF graphs. It includes the cardinality constrai..."
 
Eric (talk | contribs)
Blanked the page
 
Line 1: Line 1:
'''ShEX, or Shape Expressions'''([http://www.w3.org/2013/ShEx/Primer.html intro]), is a language for expressing constraints on RDF graphs.
It includes the cardinality constraints from [http://open-services.net/resources/tutorials/oslc-primer/resourceshapes/ OSLC Resource Shapes] and [http://dublincore.org/documents/dc-dsp/ Dublin Core Description Set Profiles] as well as logical connectives for disjuntion and polymorphism.
It is intended to:


* validate RDF documents.
* communicate expected graph patterns for interfaces.
* generate user interface forms and interface code.
* compile to SPARQL queries (except for cyclic grammars).
A [http://www.w3.org/2013/ShEx/ W3C ShEx Demo] validates data against a schema, compiles SPARQL queries for the schema and generates an RDF representation.
== Syntax ==
The ShEx syntax is modeled after RelaxNG Compact Syntax (RNC):
<IssueShape> {                            # A Issue shape
    :state ( :unassigned :assigned ),    #  has a state with 2 possible values
    :reportedBy @<UserShape>,            #  is reported by a user
    :reportedOn xsd:date,                #  is reported on a date
    ( :reproducedBy @<UserShape>          #  can optionally have 2 properties
    , :reproducedOn xsd:date              #    reproducedBy/On
    )?,
    :related @<IssueShape>*              #  is related to several other issues
}
<UserShape> {                            # A user shape can have either
    ( foaf:name xsd:string                #  name or
    | foaf:givenName xsd:string+ ,        #  several given names and
      foaf:familyName xsd:string          #  family name
    ),
    foaf:mbox shex:IRI ?                  # mbox Optional, any IRI
}
The previous example can be tested [http://rdfshape.herokuapp.com/validator?rdf=%40prefix+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E+.%0D%0A%40prefix+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E+.%0D%0A%40prefix+%3A+%3Chttp%3A%2F%2Fexample.org%2F%3E+.%0D%0A%40prefix+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E+.%0D%0A%0D%0A%3Aissue1%0D%0A+%3Astate++++++++%3Aunassigned+%3B%0D%0A+%3AreportedBy+++%3ABob+%3B%0D%0A+%3AreportedOn+++%222013-01-23%22^^xsd%3Adate+%3B%0D%0A+%3AreproducedBy+%3AThompson.J+%3B%0D%0A+%3AreproducedOn+%222013-01-23%22^^xsd%3Adate+%3B%0D%0A+%3Arelated+%3Aissue2+.%0D%0A%0D%0A%3Aissue2+%3Astate+%3Aassigned+%3B%0D%0A+%3AreportedBy+%3AMary+%3B%0D%0A+%3AreportedOn+%222013-06-12%22^^xsd%3Adate+.%0D%0A%0D%0A%3ABob%0D%0A+foaf%3AgivenName+%22Bob%22+%3B%0D%0A+foaf%3AfamilyName+%22Smith%22+%3B%0D%0A+foaf%3Ambox+%3Cmail%3Abob%40example.org%3E+.%0D%0A%0D%0A%3AThompson.J%0D%0A+foaf%3AgivenName+%22Joe%22%2C+%22Joseph%22+%3B%0D%0A+foaf%3AfamilyName+%22Thompson%22+%3B%0D%0A+foaf%3Ambox+%3Cmail%3Ajoe%40example.org%3E+.%0D%0A%0D%0A%3AMary+foaf%3Aname+%22Mary%22+.%0D%0A%0D%0A%0D%0A&schema=prefix+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0Aprefix+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0Aprefix+%3A+%3Chttp%3A%2F%2Fexample.org%2F%3E%0D%0Aprefix+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0Aprefix+shex%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2013%2FShEx%2Fns%23%3E%0D%0A%0D%0A+%3CIssueShape%3E+{++++++++++++++++++++++++++++%23+A+Issue+shape%0D%0A+++++%3Astate+%28+%3Aunassigned+%3Aassigned+%29%2C+++++%23+++has+a+state+with+2+possible+values%0D%0A+++++%3AreportedBy+%40%3CUserShape%3E%2C+++++++++++++%23+++is+reported+by+a+user%0D%0A+++++%3AreportedOn+xsd%3Adate%2C+++++++++++++++++%23+++is+reported+on+a+date%0D%0A+++++%28+%3AreproducedBy+%40%3CUserShape%3E++++++++++%23+++can+optionally+have+2+properties%0D%0A+++++%2C+%3AreproducedOn+xsd%3Adate++++++++++++++%23+++++reproducedBy%2FOn%0D%0A+++++%29%3F%2C%0D%0A+++++%3Arelated+%40%3CIssueShape%3E*+++++++++++++++%23+++is+related+to+several+other+issues%0D%0A+}%0D%0A+%0D%0A+%3CUserShape%3E+{+++++++++++++++++++++++++++++%23+A+user+shape+can+have+either%0D%0A+++++%28+foaf%3Aname+xsd%3Astring++++++++++++++++%23++name+or%0D%0A+++++|+foaf%3AgivenName+xsd%3Astring%2B+%2C++++++++%23++several+given+names+and%0D%0A+++++++foaf%3AfamilyName+xsd%3Astring++++++++++%23+++family+name%0D%0A+++++%29%2C+%0D%0A+++++foaf%3Ambox+shex%3AIRI+%3F++++++++++++++++++%23+mbox+Optional%2C+any+IRI%0D%0A+} here (using RDFShape)] and [http://www.w3.org/2013/ShEx/FancyShExDemo.html?schema=prefix%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0Aprefix%20xsd%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0Aprefix%20%3A%20%3Chttp%3A%2F%2Fexample.org%2F%3E%0Aprefix%20foaf%3A%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0Aprefix%20shex%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2013%2FShEx%2Fns%23%3E%0A%0A%20%3CIssueShape%3E%20{%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20A%20Issue%20shape%0A%20%20%20%20%20%3Astate%20%28%20%3Aunassigned%20%3Aassigned%20%29%2C%20%20%20%20%20%23%20%20%20has%20a%20state%20with%202%20possible%20values%0A%20%20%20%20%20%3AreportedBy%20%40%3CUserShape%3E%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20%20%20is%20reported%20by%20a%20user%0A%20%20%20%20%20%3AreportedOn%20xsd%3Adate%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20%20%20is%20reported%20on%20a%20date%0A%20%20%20%20%20%28%20%3AreproducedBy%20%40%3CUserShape%3E%20%20%20%20%20%20%20%20%20%20%23%20%20%20can%20optionally%20have%202%20properties%0A%20%20%20%20%20%2C%20%3AreproducedOn%20xsd%3Adate%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20%20%20%20%20reproducedBy%2FOn%0A%20%20%20%20%20%29%3F%2C%0A%20%20%20%20%20%3Arelated%20%40%3CIssueShape%3E*%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20%20%20is%20related%20to%20several%20other%20issues%0A%20}%0A%20%0A%20%3CUserShape%3E%20{%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20A%20user%20shape%20can%20have%20either%0A%20%20%20%20%20%28%20foaf%3Aname%20xsd%3Astring%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20%20name%20or%0A%20%20%20%20%20|%20foaf%3AgivenName%20xsd%3Astring%2B%20%2C%20%20%20%20%20%20%20%20%23%20%20several%20given%20names%20and%0A%20%20%20%20%20%20%20foaf%3AfamilyName%20xsd%3Astring%20%20%20%20%20%20%20%20%20%20%23%20%20%20family%20name%0A%20%20%20%20%20%29%2C%20%0A%20%20%20%20%20foaf%3Ambox%20shex%3AIRI%20%3F%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20mbox%20Optional%2C%20any%20IRI%0A%20}&data=%40prefix%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%20.%0A%40prefix%20foaf%3A%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%20.%0A%40prefix%20%3A%20%3Chttp%3A%2F%2Fexample.org%2F%3E%20.%0A%40prefix%20xsd%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%20.%0A%0A%3Aissue1%0A%20%3Astate%20%20%20%20%20%20%20%20%3Aunassigned%20%3B%0A%20%3AreportedBy%20%20%20%3ABob%20%3B%0A%20%3AreportedOn%20%20%20%222013-01-23%22^^xsd%3Adate%20%3B%0A%20%3AreproducedBy%20%3AThompson.J%20%3B%0A%20%3AreproducedOn%20%222013-01-23%22^^xsd%3Adate%20%3B%0A%20%3Arelated%20%3Aissue2%20.%0A%0A%3Aissue2%20%3Astate%20%3Aassigned%20%3B%0A%20%3AreportedBy%20%3AMary%20%3B%0A%20%3AreportedOn%20%222013-06-12%22^^xsd%3Adate%20.%0A%0A%3ABob%0A%20foaf%3AgivenName%20%22Bob%22%20%3B%0A%20foaf%3AfamilyName%20%22Smith%22%20%3B%0A%20foaf%3Ambox%20%3Cmail%3Abob%40example.org%3E%20.%0A%0A%3AThompson.J%0A%20foaf%3AgivenName%20%22Joe%22%2C%20%22Joseph%22%20%3B%0A%20foaf%3AfamilyName%20%22Thompson%22%20%3B%0A%20foaf%3Ambox%20%3Cmail%3Ajoe%40example.org%3E%20.%0A%0A%3AMary%20foaf%3Aname%20%22Mary%22%20.&starting-node=%3Chttp%3A%2F%2Fexample.org%2Fissue1%3E here (with Eric's fancy demo)]
Shex definition can be defined in 2 syntaxes: SHEXc (SHEX compact format) and SHEX/RDF.
== Semantics ==
ShEx (and RNC) are designed to be familiar to users of BNF and regular expressions.
The conspicuous differences are that regular expressions correlate an ordered pattern of atomic characters and logical operators against an ordered sequence of characters.
Shape Expressions correlate an ordered pattern of pairs of predicate and object classes (called <i>NameClass</i> and <i>ValueClass</i>) and logical operators against an unordered set of arcs in a graph.
The logical operators in Shape Expressions, grouping, conjunction, disjunction and cardinality constraints, are defined to make as closely as possible to their counterparts in regular expressions and grammar languages like BNF.
Recursive shapes (like <IssueShape>) are problematic for Shape Expressions.  The meanings of such shapes are open to question.  The semantics for Shape Expressions does not handle them well, going into infinite loops, or being non-deterministic, or even being paradoxical.
See for more details and test cases [http://www.w3.org/2013/ShEx/EvaluationLogic.html]
==SHEXc Language Summary==
{| class="wikitable"
|-
| '''feature'''
| '''example'''
| '''description'''
|-
|
|
| '''Matching a Predicate to a NameClass'''
|-
| NameTerm
| <tt>ex:state</tt>
| The predicate of any matching triple is the same as the NameTerm IRI.
|-
| NameStem
| <tt>ex:~</tt>
| The predicate of any matching triple starts with the IRI.
|-
| NameAny
| <tt> . - rdf:type - ex:~</tt>
| A matching triple has any predicate except those terms NameTerms or NameStems excluded by the '-' operator.
|-
|
|
|'''Matching an Object to a ValueClass'''
|-
| ValueType
| <tt>xsd:dateTime</tt>
| The object of any matching triple is the same as the ValueType IRI.
|-
| ValueSet
|<tt>(ex:unassigned ex:assigned)</tt>
| The object of any matching triple is one of the list of triples in the ValueSet.
|-
| ValueStem
| <tt>ex:~</tt>
| The object of any matching triple starts with the IRI.
|-
| ValueAny
|<tt>. - rdf:type - ex:~</tt>|
| A matching triple has any object except those terms or stems excluded by the '-' operator.
|-
| ValueReference
|<tt>@<UserShape></tt>
| The object of a matching triple is an IRI or blank node and the that node is the subject of triples matching the referenced shape expression.
|-
|
|
|'''Rule Types'''
|-
| ArcRule
| <tt>foaf:givenName xsd:string+</tt>
| A matching triple matches the NameTerm and the ValueTerm. Cardinality constraints apply.
|-
| AndRule
|<tt> foaf:givenName xsd:string,
foaf:familyName xsd:string</tt>
|Each conjoint matches the input graph.
|-
| OrRule
|<tt>foaf:givenName xsd:string
foaf:name xsd:string</tt>
| Exactly one disjoint matches the input graph.
|-
| GroupRule
|<tt>x:reproducedBy @<EmployeeShape>,
ex:reproducedOn xsd:dateTime)</tt>
|A matching triple matches the enclosed rule (here an AndRule). Cardinality constraints apply.
|-
|
|
|'''Cardinality'''
|-
|?
|<tt>foaf:givenName xsd:string?</tt>
|rule must match 0 or 1 times.
|-
| +
|<tt>foaf:givenName xsd:string+</tt>
|rule must match 1 or more times.
|-
|*
|<tt>foaf:givenName xsd:string*</tt>
|rule must match 0 or more times.
|-
|{m}
|<tt>foaf:givenName xsd:string{3}</tt>
|rule must match m times.
|-
|{m,n}
|<tt>foaf:givenName xsd:string{3,5}</tt>
|rule must match at least m times and no more than n times.
|-
|
|colspan="2"| Cardinality constraints may appear after an ArcRule. A '?' may also appear after a GroupRule to indicate that it is optional. Any AndRule nested immediately inside the GroupRule must have every rule match or no rule match.
|-
|
|
|'''Rule Inclusions'''
|-
|&RuleName
|<tt>& <PersonShape></tt>
|[http://www.w3.org/2013/ShEx/Primer.html#inherit Include the referenced rule] in place of the include directive.
|-
|
|colspan="2"| Rule Inclusions may appear before a shape definition inside of a definition. Befor a shape definition, they signify the inclusion of the referenced rule ("included rule") at the beginning of the one being defined, as well as asserting that ValueReferences to the included rule accept the defined shape as well.
|-
|
|
|'''Semantic Actions'''
|-
|%lang{ code %}
|<tt>%js{ return _.o.lex > report.lex; %}
%sparql{ ?s ex:reportedOn ?rpt . FILTER (?o > ?rpt) %}</tt>
| Invoke [http://www.w3.org/2013/ShEx/Primer.html#semact semantic actions] when a rule is satisfied.
|-
|
|colspan="2"| Semantic Actions may appear after an ArcRule, a Group Rule or a named Shape Expression. When used with validation, they are invoked only a valid pairs of a triple and a rule. Their use for interface validation is currently undefined.
|}
== SHEX/RDF format ==
The page [[ShEx/RDF serialization]] defines SHEX/RDF schema which does self validate (Work in progress).
== Formal definitions ==
ShEx semantics has been explained and documented with several documents describing its formalisms:
* [http://www.w3.org/2013/ShEx/Primer ShEx Primer] - introduction to ShEx with links to editable examples.
* [http://www.w3.org/2013/ShEx/Definition Denotational Semantics] (compare to [https://www.oasis-open.org/committees/relax-ng/spec-20011203.html#semantics Relax NG Semantics])
* [http://arxiv.org/abs/1404.1270 Regular Bag Expressions]
* [https://github.com/w3c/ShEx/blob/master/ShExZ/ShExZ.pdf?raw=true Z Notation]
* [[ShEx/OperationalSemantics Operational semantics]] inspired by [https://www.oasis-open.org/committees/relax-ng/spec-20011203.html#semantics Relax NG Semantics].
== Implementations ==
There are currently the following implementations of Shape Expressions
=== Fancy ShEx Demo ===
* Formats: SHEXc
* Language: javascript based
* Algorithm: State based
* Developer: Eric Prud'Hommeaux
Live Demo Examples:
* [http://www.w3.org/2013/ShEx/FancyShExDemo?schemaURL=Examples/Issue-simple-annotated.shex&dataURL=test/Issue-pass-date.ttl ShEx Demo] - test data against a schema, generate SPARQL and Resource Shape for the schema.
* [http://www.w3.org/2013/ShEx/FancyShExDemo?schemaURL=test/GenX/schema.shex&dataURL=test/Issue-pass-date.ttl GenX Demo] - use ShEx semantic actions to translate RDF to XML.
* [http://www.w3.org/2013/ShEx/FancyShExDemo?schemaURL=test/Issue-inheritance/schema.shex&dataURL=test/Issue-inheritance/pass-user-employee.ttl multiple inheritance example] - demo ShEx's polymorphism
=== [http://www.jessevandam.nl JSShexTest] ===
* Formats: SHEX/RDF and SHEXc(partly)
* Language: Javascript based
* Algorithm: State based
* Developer: Jesse van Dam
* Working version: [http://www.jessevandam.nl].
* Source code [https://github.com/jessevdam/shextest] (uses a local web server that can be started with ruby and accessed via localhost:4567).
For the validation code see [https://github.com/jessevdam/shextest/blob/master/js/validate.js] for the validation process (easy to read). Further description can be found here at [[ValidationCode]].
=== [http://rdfshape.weso.es RDFShape] ===
* Syntax: ShExc (Shex compact syntax) with some extensions like regex
* Semantics: Open/Closed view of shapes
* Developer: [http://www.di.uniovi.es/~labra Jose Emilio Labra Gayo]
* Algorithm: Regular expression derivatives
* Programming language: Scala
* Extra features: Online RDF validator based on [http://labra.github.io/ShExcala/ Shexcala]
=== [http://labra.github.io/ShExcala/ Shexcala] ===
* Syntax: ShEx compact syntax
* Semantics: Closed and Open view of shapes based on Iovka's proposal
* Developer: [http://www.di.uniovi.es/~labra Jose Emilio Labra Gayo]
* Algorithm: Regular expression derivatives and backtracking (by selection)
* Programming language: Scala
* Extra features: Negation, Reverse arcs, language tags, regexps
=== [http://labra.github.io/haws/ Haws] ===
* Syntax: Abstract syntax
* Semantics: Closed shapes based on operational semantics
* Developer: [http://www.di.uniovi.es/~labra Jose Emilio Labra Gayo]
* Algorithm: Backtracking
* Programming language: Haskell
== Test cases ==
Test script that uses simplified semantics to test the matching logic created by Eric Prud'hommeaux can be found at [http://www.w3.org/2013/ShEx/EvaluationLogic#tests]
The SHEX test suite is defined in a standardized format that can be found here [http://shexspec.github.io/test-suite/index.html] and the official set of test cases can be found here [https://github.com/shexSpec/test-suite/tree/gh-pages/tests]
SHEX/RDF based test cases still(todo) only included in Jesse van Dam scripts can be found here [https://github.com/jessevdam/shextest/tree/master/data]
== Examples ==
A separate [[ShEx_Examples|page]] contains some simple examples using ShEx.
The following list contains a list of examples that employ ShEx:
* [[Uniprot_SHEX_schema]] (out datet)
* [http://weso.github.io/landportalDoc/data/ LandPortal documentation using ShEx]
* [http://weso.github.io/wiDoc/#indicator Web Index Data Portal documentation using ShEx]
* [http://www.w3.org/2013/12/FDA-TA/subject.shex FDA Renal Transplantation Ontology]
== Publications about ShEx ==
* ''Complexity and Expressiveness of ShEx for RDF'', In International Conference on Database Theory (ICDT) 2015. With S. Staworko, J. E. Labra Gayo, S. Hym, E. G. Prud’hommeaux, and H. Solbrig. [http://www.grappa.univ-lille3.fr/~staworko/papers/staworko-icdt15a.pdf PDF]
* ''Towards an RDF validation language based on Regular Expression derivatives'', Jose Emilio Labra Gayo, Eric Prud'Hommeaux, Slawek Staworko and Harold Solbrig. [http://labra.github.io/ShExcala/papers/LWDM2015.pdf PDF][http://www.slideshare.net/jelabra/towards-an-rdf-validation-language-based-on-regular-expression-derivatives Slides]
* ''Shape Expressions: An RDF validation and transformation language'', Eric Prud'hommeaux, Jose Emilio Labra Gayo, Harold Solbrig, [http://www.semantics.cc/ 10th International Conference on Semantic Systems], Sept. 2015, Leipzig, Germany, [http://labra.github.io/ShExcala/papers/semantics2014.pdf PDF][http://www.slideshare.net/jelabra/semantics-2014 Slides]
* ''Validating and Describing Linked Data Portals using RDF Shape Expressions'', Jose Emilio Labra Gayo, Eric Prud'hommeaux, Harold Solbrig, [http://ldq.semanticmultimedia.org/ 1st Workshop on Linked Data Quality], Sept. 2015, Leipzig, Germany, [http://labra.github.io/ShExcala/papers/ldq2014.pdf PDF][http://www.slideshare.net/jelabra/linked-dataquality-2014 Slides]
==Proposed Features==
===UNIQUE===
Proposed for 1.1
A UNIQUE constraint takes an optional scope (FOCUS|GRAPH, default: FOCUS) and 1+ predicates, e.g.:
  <T> {
    :fname LITERAL,
    :lname LITERAL,
    :title LITERAL+,
    :homepage IRI
    UNIQUE(GRAPH, :fname, :lname)
    UNIQUE(LANGTAG(:title))
    UNIQUE(GRAPH, :homepage)
  }
UNIQUEs can appear arbitrarily nested in expressions:
  <PersonShape> {
      foaf:givenName .,
      foaf:familyName
      UNIQUE(foaf:given, foaf:family)
    | foaf:name .
      UNIQUE(foaf:name)
  }
UNIQUEs scoped to the FOCUSNODE can be dispatched immediately.
Those scoped to the GRAPH or DATASET must have their values noted and associated with the UNIQUE constraint, noting any possible conflicts during insertion.
====Shortcomings====
It's possible we'd want uniques that span shapes, e.g. if the following data were permissible:
  { <s1> :code "1234"; :dept [ :code "5678" ] .
    <s2> :code "1234"; :dept [ :code "8765" ] }
but this were not:
  { <s1> :code "1234"; :dept [ :code "5678" ] .
    <s2> :code "1234"; :dept [ :code "5678" ] }
There's no way to stipulate uniqueness across repeated properties, e.g. if we wanted to make sure that creators from a.example were unique in the graph but creators from b.example were not:
  schema:
  <nowiki><S></nowiki> { :creator PATTERN "^http://a\\.example/",
        :creator PATTERN "^http://b\\.example/"
  }
  failing data:
  { <s1> :creator <http://a.example/1> ; :creator <http://b.example/2> .
    <s2> :creator <http://a.example/3> ; :creator <http://b.example/2> .
  }
====Alternative Syntax - on shape====
The UNIQUE constraints could go on the shape.
  <T>
    UNIQUE(GRAPH, :fname, :lname)
    UNIQUE(LANGTAG(:title))
    UNIQUE(GRAPH, :homepage)
    {
      :fname LITERAL,
      :lname LITERAL,
      :title LITERAL+,
      :homepage IRI
    }
This makes evaluation of predicates in disjuncts weird, e.g.
  <PersonShape> UNIQUE(foaf:given, foaf:family) UNIQUE(foaf:name)
    { foaf:givenName ., foaf:familyName | foaf:name .}
where the semantics for enforcing UNIQUE(foaf:given, foaf:family) over the data
  { <nowiki><s></nowiki> :foaf:name "Bob Smith". }
are a bit weird and "NULL-y".
===GRAPH constraints===
Proposed for 1.1
====Use Cases====
Enable validation outside of a single named graph:
Dataset:
  Default graph: { <nowiki><s></nowiki> :lookInGraph <nowiki><G1></nowiki> }
  <nowiki><G1></nowiki>: { <nowiki><s></nowiki> :p2 :o2 }
Schema:
  <nowiki><S></nowiki> { :lookInGraph GRAPH{ @<nowiki><GShape></nowiki> } }
  <nowiki><GShape></nowiki> { :p2 . }
==Discussion==
See [[ShEx/CurrentDiscussion|here]] for the currently ongoing discussions
See [[Discussion SHEX format]] for a list of other discussion topics
See [[ShEx/ShEx_vs_OWL|here]] for a comparison between ShEx and OWL

Latest revision as of 12:21, 22 January 2017