- From: Eric Prud'hommeaux <eric@w3.org>
- Date: Thu, 30 Jun 2016 11:12:52 -0400
- To: public-data-shapes-wg <public-data-shapes-wg@w3.org>
finishing the remaining Parameters... * Eric Prud'hommeaux <eric@w3.org> [2016-06-29 11:30-0400] > In order to tie the surface syntax of ShEx to SHACL, I wrote up an > abstract syntax for SHACL. I tried to use the same types as described > in the SHACL document but I'd like folks to check it for consistency. > > Notation > TypeName := label1:Type1, label2:Set[Type2] > means TypeName has two component addressed by label1 and label2. > label1 is a Type1 (defined elsewhere in the abstract syntax or in > RDF standards) and label2 is a set of things matching Type2. Schema := shapes:Set[Shape] A Schema is a set of Shapes. (Do we care about schema boundaries?) Shape := label:IRI|BNode, scopes:Set[Scope], filters:Set[Shape], constraints:Set[Constraint] A Shape has a label of some IRI or BNode, and sets of scopes, filter shapes and constraints. The "in-scope" nodes are the nodes in the data graph which 1 match any of the scopes. 2 pass all of the filter Shapes. (Scopes in filter Shapes have no effect.) Validation returns the set of errors returned from testing each constraint against each "focus node" in the in-scope node. # Scopes Scope := ScopeNode|ScopeClass|PropertyScope|InversePropertyScope A Scope is either a ScopeNode or a ScopeClass or a PropertyScope. ScopeNode := node:IRI|Bnode # later demands told bnodes. A ScopeNode matches node in the data graph. ScopeClass := type:IRI A ScopeClass matches any node in the data graph with the triple (node, rdf:type, type). PropertyScope := predicate:IRI A PropertyScope matches any node in the data graph with a triple (node, predicate, _) where "_" is any node. InversePropertyScope := predicate:IRI A PropertyScope matches any node in the data graph with a triple (_, predicate, node) where "_" is any node. # Constraints Constraint := NodeConstraint|PropertyConstraint| InversePropertyConstraint|Constraint A Constraint is either PropertyConstraint or InversePropertyConstraint or a NodeConstraint. Each type of Constraint selects a value node and tests it against a set of Paramenters. Parameters take arguments, including "numeric" which is the set of SPARQL numeric types enumerated in SPARQL Operand Data Types <http://www.w3.org/TR/sparql11-query/#operandDataTypes>. Exceptions: three Parameters, MinCount, MaxCount, and UniqueLang are evaluated against the set of all value nodes identified for testing by PropertyConstraint or InversePropertyConstraint. Three other Parameters, QualifiedMinCount, QualifiedMaxCount, and QualifiedValueShape, are evaluated against the set of all value nodes identified for testing by PropertyConstraint or InversePropertyConstraint and for which the evaluation of all other Parameters returned no errors. NodeConstraint := parms:Set[NCParameter] Testing a NodeConstraint against a focus node returns all of the errors from testing each NCParameter against the the value node where the value node is the focus node. PropertyConstraint := predicate:IRI, parms:Set[PCParameter] Testing a NodeConstraint against a focus node returns all of the errors from testing each NCParameter against each value node in the triple (focus node, predicate, value node). InversePropertyConstraint := predicate:IRI, parms:Set[IPCParameter] Testing a NodeConstraint against a focus node returns all of the errors from testing each NCParameter against each value node in the triple (value node, predicate, focus node). Constraint := @@still fuzzy on what's permitted in a general constraint. Extrapolate from Closed? NP, PC and IPC Parameters are listed in the first table in <http://w3c.github.io/data-shapes/shacl/#h-constraints>. # Nary Parameters - evaluate a set of value nodes. ## Cardinality: PC, ICP MinCount := ref:numeric Testing a MinCount parameter against a set of value nodes returns an error if the number of value nodes is less than ref. QualifiedMinCount := ref:numeric As noted above, QualifiedMinCount takes a set of value nodes that have passed all non-cardinality tests. It's evaluation is the same as the evaluation of MinCount. MaxCount := ref:numeric Testing a MaxCount parameter against a set of value nodes returns an error if the number of value nodes is greater than ref. QualifiedMaxCount := ref:numeric As noted above, QualifiedMaxCount takes a set of value nodes that have passed all non-cardinality tests. It's evaluation is the same as the evaluation of MaxCount. UniqueLang := b:boolean Testing a UniqueLang parameter against a set of value nodes returns an error if two or more of the value nodes are RDFLiterals with the same language tag. # Unary Parameters - evaluate a single value node. ## Logical operators: NC, PC, IPC And := shapes:Set[Shape] Testing an And parameter against a value node returns the errors from testing each of shapes against the value node. Or := shapes:Set[Shape] Testing an Or parameter against a value node returns an unspecified error if testing each of shapes against the value node returned an error. Not := shape:Shape Testing an Or parameter against a value node returns an unspecified error if testing shape against the value node returned no error. ## RDF term type of value node: NC, PC, IPC NodeKind := kind:"IRI"|"blank node"|"literal" Testing a NodeKind parameter against a value node returns an error if • kind = "IRI" and value node is not an IRI • kind = "blank node" and value node is not an blank node • kind = "literal" and value node is not an RDFLiteral ## RDF term equivalence: NC, PC, IPC HasValue := val:RDF term @@ listed as PC, IPC as of 2016-06-30 Testing a HasValue parameter against a value node returns an error if the value node is a different RDF term than val. In := vals:Set[RDF term] Testing a HasValue parameter against a value node returns an error if the value node is not in vals. ## Datatype: NC, PC Datatype := dt:IRI Testing a Datatype parameter against a value node returns an error if the value node is not an RDFLiteral or of the datatype of the value node is not the same RDF term as dt. DatatypeIn := dts:Set[IRI] Testing a Datatype parameter against a value node returns an error if the value node is not an RDFLiteral or of the datatype of the value node is not the set dts. ## lexical form parameters: ### XML Schema string facets: NC, PC, ICP MinLength := ref:numeric Testing a MinLength paramenter against a value node returns an error if the lexical form of the value node is longer than ref. MaxLength := ref:numeric Testing a MinLength paramenter against a value node returns an error if the lexical form of the value node is shorter than ref. Pattern := pat:RDFLiteral Testing a Pattern paramenter against a value node returns an error if evaluating the SPARQL regex function with the lexical form of value node and pat is false or results in a type error. Stem := str:RDFLiteral Testing a Stem parameter against a value node returns an error if the value node is not an IRI or the lexical form of the value node does not start with str. ## RDFLiteral value parameters ### XML Schema numeric facets: NC, PC MaxExclusive := ref:RDFLitera Testing a MaxExclusive parameter against a value node returns an error if the evaluation of (value node > ref) in SPARQL1.1 Operator Mapping returns false or results in a type error. MaxInclusive := ref:RDFLiteral Testing a MaxExclusive parameter against a value node returns an error if the evaluation of (value node >= ref) in SPARQL1.1 Operator Mapping returns false or results in a type error. MinExclusive := ref:RDFLiteral Testing a MaxExclusive parameter against a value node returns an error if the evaluation of (value node > ref) in SPARQL1.1 Operator Mapping returns false or results in a type error. MinInclusive := ref:RDFLiteral Testing a MaxExclusive parameter against a value node returns an error if the evaluation of (value node >= ref) in SPARQL1.1 Operator Mapping returns false or results in a type error. ## Comparison with sibling property: PC Equals := sibling:RDFLiteral Testing an Equals parameter against a value node returns an error if there is no node v in (focus node, sibling, v) in the data graph or the evaluation of (value node = v) in SPARQL1.1 Operator Mapping returns false or results in a type error. LessThan := sibling:RDFLiteral Testing an LessThan parameter against a value node returns an error if there is no node v in (focus node, sibling, v) in the data graph or the evaluation of (value node < v) in SPARQL1.1 Operator Mapping returns false or results in a type error. LessThanEquals := sibling:RDFLiteral Testing an LessThanEquals parameter against a value node returns an error if there is no node v in (focus node, sibling, v) in the data graph or the evaluation of (value node <= v) in SPARQL1.1 Operator Mapping returns false or results in a type error. Disjoint := sibling:RDFLiteral Testing an Disjoint parameter against a value node returns an error if any node v in (focus node, sibling, v) in the data graph or the evaluation of (value node < v) in SPARQL1.1 Operator Mapping returns false or results in a type error. ## Nested shape constraints: PC, IPC Shape := nested:Shape @@ listed as NC, PC, IPC as of 2016-06-30 Testing a Shape parameter against a value node returns any errors returned when validating the value node as nested (c.f. definition of Shape above). QualifiedValueShape := nested:Shape As noted above, QualifiedValueShape takes a set of value nodes that have passed all non-cardinality tests. It's evaluation is the same as the evaluation of Shape. Class := t:IRI @@ + subClassOf* Testing a Class parameter against a value node returns any errors returned when validating the value node as a Shape with a single PropertyConstraint with a predicate(rdf:type) and HasValue(t). ClassIn := t:IRI @@ + subClassOf* Testing a ClassIn parameter against a value node returns any errors returned when validating the value node as a Shape with a single PropertyConstraint with a predicate(rdf:type) and In(t). -- -ericP office: +1.617.599.3509 mobile: +33.6.80.80.35.59 (eric@w3.org) Feel free to forward this message to any list for any purpose other than email address distribution. There are subtle nuances encoded in font variation and clever layout which can only be seen by printing this message on high-clay paper.
Received on Thursday, 30 June 2016 15:12:58 UTC