Abstract

This document describes the Shape Expression Vocabulary and Term definitions used for describing Shape Expressions [shex-semantics]. This document provides the RDFS [RDF-SCHEMA] vocabulary definition and a description of the JSON-LD context definition for use with defining shape expressions.

Alternate versions of the vocabulary definition exist in Turtle and JSON-LD, which also includes the @context required for metadata descriptions.

Published:
Version Info:
https://github.com/shexSpec/shexspec.github.io/commit/62daf29953bf341fc4f57a4b2b960f593db5ec2c
See Also:
http://shex.io/shex-semantics

Status of This Document

This document is merely a W3C-internal document. It has no official standing of any kind and does not represent consensus of the W3C Membership.

FIXME

1. Introduction

This document describes the RDFS vocabulary description used in the Shape Expression Language (ShEx) [shex-semantics] along with the default JSON-LD Context and shape expression to validate RDF versions of shapes.

This specification makes use of the following namespaces:

shex:
http://www.w3.org/ns/shex#
rdf:
http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs:
http://www.w3.org/2000/01/rdf-schema#
xsd:
http://www.w3.org/2001/XMLSchema#

2. Class Definitions

The following are class definitions in the shex namespace:

Annotation Annotation

Annotations provide a format-independent way to provide additional information about elements in a schema.

EachOf Each Of

A TripleExpression composed of one or more sub-expressions, all of which must match.

rdfs:subClassOf
shex:TripleExpression
IriStem IRI Stem

An IRI prefix used for matching IRIs.

rdfs:subClassOf
shex:Stem
IriStemRange IRI StemRange

An IRI prefix (or wildcard) along with a set of excluded values, used for node matching.

rdfs:subClassOf
shex:StemRange
LanguageStem Language Stem

An Language prefix used for matching Literal Languages.

rdfs:subClassOf
shex:Stem
LanguageStemRange Language StemRange

An Language prefix (or wildcard) along with a set of excluded values, used for node matching.

rdfs:subClassOf
shex:StemRange
LiteralStem Literal Stem

An Literal prefix used for matching Literals.

rdfs:subClassOf
shex:Stem
LiteralStemRange Literal StemRange

An Literal prefix (or wildcard) along with a set of excluded values, used for node matching.

rdfs:subClassOf
shex:StemRange
NodeConstraint Node Constraint

A constraint on the type or value of an RDF Node.

rdfs:subClassOf
shex:ShapeExpression
NodeKind Node Kind

The set of kinds of RDF Nodes.

OneOf One Of

A TripleExpression composed of one or more sub-expressions, one of which must match.

rdfs:subClassOf
shex:TripleExpression
Schema Schema

A Schema contains the set of shapes, used for matching a focus node.

SemAct Semantic Actions

A list of Semantic Actions that serve as an extension point for Shape Expressions. They appear in lists in Schema's startActs and Shape, OneOf, EachOf and TripleConstraint's semActs.

Shape Shape Or

A shapes schema is captured in a Schema object where shapes is a mapping from shape label to shape expression.

rdfs:subClassOf
shex:ShapeExpression
ShapeAnd Shape And

A ShapeExpression composed of one or more sub-expressions, all of which must match.

rdfs:subClassOf
shex:ShapeExpression
ShapeExpression Shape Expression

The abstract class of Shape Expressions.

ShapeExternal Shape External

A reference to a shape defined in some external Schema.

rdfs:subClassOf
shex:ShapeExpression
ShapeNot Shape Not

A ShapeNot is satisfied when it’s included ShapeExpression is not satisfied.

rdfs:subClassOf
shex:ShapeExpression
ShapeOr Shape Or

A ShapeExpression composed of one or more sub-expressions, one of which must match.

rdfs:subClassOf
shex:ShapeExpression
Stem Stem

Abstract class for Stems

StemRange StemRange

Abstract Class for Stem Ranges

TripleConstraint Triple Constraint

A constraint on a triple having a specific predicate and optionally a shape expression used for matching values.

rdfs:subClassOf
shex:TripleExpression
TripleExpression Triple Expression

The abstract class of Triple Expressions.

Wildcard Wildcard

Indicates that a stem is a Wildcard, rather than a URI prefix.

3. Property Definitions

The following are property definitions in the shex namespace:

annotation annotation

Annotations on a TripleExpression.

rdfs:range
shex:Annotation
rdfs:domain
Union of shex:EachOf shex:OneOf shex:TripleConstraint
closed closed

Indicates that a Shape is closed, meaning that it may contain no property values other than those used within TripleConstraints.

rdfs:range
xsd:boolean
rdfs:domain
shex:Shape
code code

Code executed by Semantic Action.

rdfs:range
xsd:string
rdfs:domain
shex:SemAct
datatype datatype

A datatype constraint.

rdfs:range
rdfs:Datatype
rdfs:domain
shex:NodeConstraint
exclusion exclusion

Values that are excluded from value matching.

rdfs:range
Union of rdfs:Resource shex:Stem
rdfs:domain
shex:StemRange
expression expression

Expression associated with the TripleExpression.

rdfs:range
shex:TripleExpression
rdfs:domain
shex:Shape
expressions expressions

List of 2 or more expressions associated with the TripleExpression.

rdfs:range
shex:TripleExpression
rdfs:domain
Union of shex:EachOf shex:OneOf
extra extra

Properties which may have extra values beyond those matched through a constraint.

rdfs:range
rdfs:Resource
rdfs:domain
shex:Shape
flags flags

Regular expression flags

rdfs:range
xsd:string
rdfs:domain
shex:NodeConstraint
fractiondigits fraction digits

for "fractiondigits" constraints, v is less than or equals the number of digits to the right of the decimal place in the XML Schema canonical form[xmlschema-2] of the value of n, ignoring trailing zeros.

rdfs:subPropertyOf
shex:numericFacet
rdfs:range
xsd:integer
rdfs:domain
shex:NodeConstraint
inverse inverse

Constrains the subject of a triple, rather than the object.

rdfs:range
xsd:boolean
rdfs:domain
shex:TripleConstraint
length length

The exact length of the value of the cell.

rdfs:subPropertyOf
shex:stringFacet
rdfs:range
xsd:integer
rdfs:domain
shex:NodeConstraint
max maximum cardinality

Maximum number of times this TripleExpression may match; -1 for “*”

rdfs:range
xsd:integer
rdfs:domain
Union of shex:EachOf shex:OneOf shex:TripleConstraint
maxexclusive max exclusive

An atomic property that contains a single number that is the maximum valid value (exclusive).

rdfs:subPropertyOf
shex:numericFacet
rdfs:range
Union of xsd:integer xsd:decimal xsd:double
rdfs:domain
shex:NodeConstraint
maxinclusive max inclusive

An atomic property that contains a single number that is the maximum valid value (inclusive).

rdfs:subPropertyOf
shex:numericFacet
rdfs:range
Union of xsd:integer xsd:decimal xsd:double
rdfs:domain
shex:NodeConstraint
maxlength max length

A numeric atomic property that contains a single integer that is the maximum length of the value.

rdfs:subPropertyOf
shex:stringFacet
rdfs:range
xsd:integer
rdfs:domain
shex:NodeConstraint
min minimum cardinatliy

Minimum number of times this TripleExpression may match.

rdfs:range
xsd:integer
rdfs:domain
Union of shex:EachOf shex:OneOf shex:TripleConstraint
minexclusive min exclusive

An atomic property that contains a single number that is the minimum valid value (exclusive).

rdfs:subPropertyOf
shex:numericFacet
rdfs:range
Union of xsd:integer xsd:decimal xsd:double
rdfs:domain
shex:NodeConstraint
mininclusive min inclusive

An atomic property that contains a single number that is the minimum valid value (inclusive).

rdfs:subPropertyOf
shex:numericFacet
rdfs:range
Union of xsd:integer xsd:decimal xsd:double
rdfs:domain
shex:NodeConstraint
minlength min length

An atomic property that contains a single integer that is the minimum length of the value.

rdfs:subPropertyOf
shex:stringFacet
rdfs:range
xsd:integer
rdfs:domain
shex:NodeConstraint
name name

Identifier of SemAct extension.

rdfs:range
rdfs:Resource
rdfs:domain
shex:SemAct
nodeKind node kind

Restiction on the kind of node matched; restricted to the defined instances of NodeKind. One of shex:iri, shex:bnode, shex:literal, or shex:nonliteral.

rdfs:range
shex:NodeKind
rdfs:domain
shex:NodeConstraint
numericFacet

Abstract property of numeric facets on a NodeConstraint.

rdfs:subPropertyOf
shex:xsFacet
object object

The object of an Annotation.

rdfs:range
rdfs:Resource
rdfs:domain
shex:Annotation
pattern pattern

A regular expression used for matching a value.

rdfs:subPropertyOf
shex:stringFacet
rdfs:range
xsd:string
rdfs:domain
shex:NodeConstraint
predicate predicate

The predicate of a TripleConstraint or Annotation.

rdfs:range
rdfs:Resource
rdfs:domain
Union of shex:Annotation shex:TripleConstraint
semActs semantic action

Semantic Actions on this TripleExpression.

rdfs:range
shex:SemAct
rdfs:domain
Union of shex:EachOf shex:OneOf shex:TripleConstraint
shapeExpr shape expression

Shape Expression referenced by this shape.

rdfs:range
shex:ShapeExpression
rdfs:domain
shex:ShapeNot
shapeExprs shape expressions

A list of 2 or more Shape Expressions referenced by this shape.

rdfs:subPropertyOf
shex:shapeExpr
rdfs:range
shex:ShapeExpression
rdfs:domain
Union of shex:ShapeAnd shex:ShapeOr
shapes shapes

Shapes in this Schema.

rdfs:range
shex:ShapeExpression
rdfs:domain
shex:Schema
start start

A ShapeExpression matched against the focus node prior to any other mapped expressions.

rdfs:range
shex:ShapeExpression
rdfs:domain
shex:Schema
startActs start actions

Semantic Actions run on the Schema.

rdfs:range
shex:SemAct
rdfs:domain
shex:Schema
stem stem

A stem value used for matching or excluding values.

rdfs:range
Union of xsd:string shex:Wildcard
rdfs:domain
Union of shex:Stem shex:StemRange
stringFacet

An abstract property of string facets on a NodeConstraint.

rdfs:subPropertyOf
shex:xsFacet
totaldigits total digits

for "totaldigits" constraints, v equals the number of digits in the XML Schema canonical form[xmlschema-2] of the value of n

rdfs:subPropertyOf
shex:numericFacet
rdfs:range
xsd:integer
rdfs:domain
shex:NodeConstraint
valueExpr value expression

A ShapeExpression used for matching the object (or subject if inverted) of a TripleConstraint.

rdfs:range
shex:ShapeExpression
rdfs:domain
shex:TripleConstraint
values values

A value restriction on a NodeConstraint.

rdfs:range
Union of rdfs:Resource shex:Stem shex:StemRange
rdfs:domain
shex:NodeConstraint
xsFacet

An abstract property of string and numeric facets on a NodeConstraint.

rdfs:domain
shex:NodeConstraint

4. Datatype Definitions

The following are datatype definitions in the shex namespace:

5. Instance Definitions

The following are instance definitions in the shex namespace:

bnode bnode

Requires node to be a Blank Node

iri iri

Requires node to be an IRI

literal literal

Requires node to be an rdf:Literal

nonliteral nonliteral

Requires node to be a Blank Node or IRI

6. Term Definitions

Annotation
shex:Annotation
EachOf
shex:EachOf
IriStem
shex:IriStem
IriStemRange
shex:IriStemRange
LanguageStem
shex:LanguageStem
LanguageStemRange
shex:LanguageStemRange
LiteralStem
shex:LiteralStem
LiteralStemRange
shex:LiteralStemRange
NodeConstraint
shex:NodeConstraint
OneOf
shex:OneOf
Schema
shex:Schema
SemAct
shex:SemAct
Shape
shex:Shape
ShapeAnd
shex:ShapeAnd
ShapeExternal
shex:ShapeExternal
ShapeNot
shex:ShapeNot
ShapeOr
shex:ShapeOr
Stem
shex:Stem
StemRange
shex:StemRange
TripleConstraint
shex:TripleConstraint
Wildcard
shex:Wildcard
annotations
shex:annotation with string values interpreted as @id with array values interpreted as @list
bnode
shex:bnode
closed
shex:closed with string values interpreted as xsd:boolean
code
shex:code
datatype
shex:datatype with string values interpreted as @id
exclusions
shex:exclusion with string values interpreted as @id with array values interpreted as @list
expression
shex:expression with string values interpreted as @id
expressions
shex:expressions with string values interpreted as @id with array values interpreted as @list
extra
shex:extra with string values interpreted as @id
flags
shex:flags
fractiondigits
shex:fractiondigits with string values interpreted as xsd:integer
id
@id
inverse
shex:inverse with string values interpreted as xsd:boolean
iri
shex:iri
language
@language
length
shex:length with string values interpreted as xsd:integer
literal
shex:literal
max
shex:max with string values interpreted as xsd:integer
maxexclusive
shex:maxexclusive with string values interpreted as xsd:integer
maxinclusive
shex:maxinclusive with string values interpreted as xsd:integer
maxlength
shex:maxlength with string values interpreted as xsd:integer
min
shex:min with string values interpreted as xsd:integer
minexclusive
shex:minexclusive with string values interpreted as xsd:integer
mininclusive
shex:mininclusive with string values interpreted as xsd:integer
minlength
shex:minlength with string values interpreted as xsd:integer
name
shex:name with string values interpreted as @id
nodeKind
shex:nodeKind with string values interpreted as @vocab
nonliteral
shex:nonliteral
object
shex:object with string values interpreted as @id
pattern
shex:pattern
predicate
shex:predicate with string values interpreted as @id
rdf
http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs
http://www.w3.org/2000/01/rdf-schema#
semActs
shex:semActs with string values interpreted as @id with array values interpreted as @list
shapeExpr
shex:shapeExpr with string values interpreted as @id
shapeExprs
shex:shapeExprs with string values interpreted as @id with array values interpreted as @list
shapes
shex:shapes with string values interpreted as @id
shex
http://www.w3.org/ns/shex#
start
shex:start with string values interpreted as @id
startActs
shex:startActs with string values interpreted as @id with array values interpreted as @list
stem
shex:stem with string values interpreted as xsd:string
totaldigits
shex:totaldigits with string values interpreted as xsd:integer
type
@type
value
@value
valueExpr
shex:valueExpr with string values interpreted as @id
values
shex:values with string values interpreted as @id with array values interpreted as @list
xsd
http://www.w3.org/2001/XMLSchema#

A. References

A.1 Informative references

[RDF-SCHEMA]
RDF Schema 1.1. Dan Brickley; Ramanathan Guha. W3C. 25 February 2014. W3C Recommendation. URL: https://www.w3.org/TR/rdf-schema/
[shex-semantics]
Shape Expressions Language. Eric Prud'hommeaux; Iovka Boneva; Jose Labra Gayo; Gregg Kellogg. W3C. CG-NOTE. URL: http://shex.io/shex-semantics