The same constraints, in two different languages:
"either a :name or (1 or more :firstname and an optional/repeatable
:lastname)" (basically a typical FOAF use)
ShEX:
<PersonShape> {
foaf:name xsd:string
| ( foaf:firstName xsd:string +
, foaf:lastName xsd:String
)
}
SHACL:
ex:PersonShape
a sh:Shape ;
sh:constraint [
a sh:NodeConstraint ;
sh:valueShape [
sh:constraint [
a sh:OrConstraint ;
sh:shapes (
[
sh:property [
sh:predicate ex:name ;
sh:datatype xsd:string ;
]
]
[
sh:property [
sh:predicate ex:firstname ;
sh:minCount 1 ;
sh:datatype xsd:string ;
] ;
sh:property [
sh:predicate ex:lastname ;
sh:datatype xsd:string ;
]
]
)
]
] ;
sh:maxCount 1 ;
] ;
.
They actually aren't exactly the same because there are different
assumed defaults for whether the graph is open (check these predicates
but ignore others - SHACL) or closed (only these predicates are valid -
ShEx).
There is an as yet-unfulfilled option to use ShEx as a user-facing
language on a SHACL engine. This seems desirable but I am concerned that
differences in defaults -- nay, the use of defaults overall -- may be
confusing.
kc
--
Karen Coyle
[log in to unmask] http://kcoyle.net
m: 1-510-435-8234
skype: kcoylenet/+1-510-984-3600
|