ShEx/CurrentDiscussion
Obsolete - please see the ShEx github wiki
Current Discussion and work
Discussion 1, redefining and including other SHEX definitions
The RELAX NG compact syntax allows for including other definitions and it allows for redefining element in existing definitions. I think it would be nice if SHEX would support something similar.
Redefining rules
In the following example a property is been redefined twice
ex:Person { ex:age xsd:int, foaf:friend @xsd:Person* } ex:PetLover & ex:Person { foaf:friend @xsd:Pet* }
With the current implementation a redefinition means that both rules must be satisfied, which is good.
However, in some cases you would like to either
- indicate is that is either should apply to the first or the new rule (what we want in this example)
- redefine the rule completely
- remove the rule
This would look like
ex:Person { ex:age xsd:int, foaf:friend @xsd:Person* } ex:PetLover & ex:Person { |= foaf:friend @xsd:Pet* #define or relation ship with the other rule properties = foaf:friend @xsd:Pet* #completely redefine the rule property - foaf:friend #remove the rule property }
Inclusion
One SHEX file should be able to include another one if defined within a namespace. This could look something like
SHEX ex:persons #define namespace which can then be extended { ex:Person { ex:age xsd:string, foaf:friend @xsd:Person* } }
included by the a second namespace
@include persons1.sh #include file and load all namespaces specified in these file SHEX ex:personsv2 { use ex:persons #use namespace ex:persons ex:Person {(ex:age xsd:string | ex:age xsd:int)?, = ex:age xsd:int } }
named groups
To be able to update/redefine subgroup they should be named. Being able to name them and define separately without them to be directly a Resource Shape would solve the problem of having an higher expressive power in the RDF serialization format than in the SHEX language definition. See RDF_serialization Overview and discussion.
This would look something like
#defining an or rule which is not a ResourceShape and can not be referenced by a ShapeProperty, but can be used within an ruleGroup or ResourceShape SHEX ex:persons { @someOrRule { prop1 xsd:string, prop2 xsd:string } ex:Person & someOrRule { @ageOrGroup(ex:age xsd:string | ex:age xsd:int)?, } }
Which can be the redefined with something like
SHEX ex:persons2 { use ex:persons @ageOrGroup { =ex:age xsd:int #redefine the age property to int and remove the optional } }
Discussion 2, occurs, multiplicity and reverse multiplicity
Currently(28-2-2017) SHEX support the definition of forward as well as reverse multiplicity as it is also possible in UML.
ex:Person { ex:friends @ex:Person* #A person can have multiple friends ^ex:friends @ex:Person* #A person can be friend of multiple persons (reverse multiplicity) ex:spous @ex:Person #Person can only have one lover ^ex:spous @ex:Person #Person can only once Persons spous ex:owns ex:Car* #A Person may own multiple cars }
ex:Car { ex:brand xsd:String ^ex:owns ex:Car* #A car can only have one owner }
However, defining the reverse multiplicity is quiet cumbersome and would look nicer if it would be defined like as
ex:Person { ex:friends @ex:Person*-* #Set forward and reverse multiplicity at once 0:N <-> 0:N ex:spous @ex:Person1-1 #Set forward and reverse multiplicity at once 1:1 <-> 1:1 ex:owns ex:Car*-1 #Set forward and reverse multiplicity at once 1:N <-> 1:N }
ex:Car { ex:brand xsd:String }
Discussion 3, enumeration values, full class support
In my opinion it would be nice not to only support simple enumeration ranges like:
<IssueShape> { ex:state [ex:unassigned ex:assigned] }
However if would be nice if you could specify a complete ontology like the Gene Ontology or Snomed Ontology. Like
<Gene> { ex:function type::GO:Molecular_Function. }
The function property can point to any of the subclasses of the Molecular_Function class in the GO ontology.
Classes/terms/enumeration values within this 'extended' enumeration can define concepts that are subconcepts of other classes/terms/enumeration values.
Discussion 4, Support for named graphs
Proposed for 1.1 See the ShEx/Graph_Named_Graphs page
Use Cases
Enable validation outside of a single named graph:
Dataset:
Default graph: { <s> :lookInGraph <G1> } <G1>: { <s> :p2 :o2 }
Schema:
<S> { :lookInGraph GRAPH{ @<GShape> } } <GShape> { :p2 . }