Argument
Provides metadata about an argument of a SPIN Function or Template. Arguments wrap a given rdf:Property (predicate) and specify its value type and whether the argument is optional. When used as spin:constraint, the body of this template will verify that a non-optional value exists and that it has the specified value type. Arguments that have been declared spl:optional true become optional if the type of ?this is spl:UnionTemplate.
- Body
-
- Text
-
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX afn: <http://jena.apache.org/ARQ/function#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX spin: <http://spinrdf.org/spin#> CONSTRUCT { _:c0 a spin:ConstraintViolation . _:c0 spin:violationRoot ?this . _:c0 spin:violationPath ?predicate . _:c0 spin:violationValue ?value . _:c0 rdfs:label ?label . } WHERE { { FILTER ( ( ! bound(?optional) ) || ( ?optional = false ) ) FILTER NOT EXISTS { ?this ?predicate ?value } # FILTER isIRI(?this) BIND(concat("Missing value for argument ", afn:localname(?predicate)) AS ?label) } UNION { FILTER bound(?valueType) { ?this ?predicate ?value # FILTER isIRI(?this) FILTER ( isURI(?value) || isBlank(?value) ) FILTER bound(?valueType) FILTER ( ( ?valueType != rdfs:Resource ) || isLiteral(?value) ) FILTER NOT EXISTS { ?value a ?class . ?class (rdfs:subClassOf)* ?valueType } } UNION { ?this ?predicate ?value # FILTER isIRI(?this) FILTER isLiteral(?value) FILTER bound(?valueType) FILTER ( ( ?valueType != rdfs:Resource ) || isLiteral(?value) ) BIND(datatype(?value) AS ?datatype) FILTER ( ! ( ( ?datatype IN (?valueType, rdfs:Literal) ) || ( ( ( ! bound(?datatype) ) || ( ?datatype = rdf:langString ) ) && ( ?valueType = xsd:string ) ) ) ) } BIND(concat("Incorrect type of argument ", afn:localname(?predicate), " (expected: ", afn:localname(?valueType), ")") AS ?label) } }
- Comment
- Provides metadata about an argument of a SPIN Function or Template. Arguments wrap a given rdf:Property (predicate) and specify its value type and whether the argument is optional. When used as spin:constraint, the body of this template will verify that a non-optional value exists and that it has the specified value type. Arguments that have been declared spl:optional true become optional if the type of ?this is spl:UnionTemplate.
- Constraint
-
- Comment
- the value type of the argument
- Optional
- true
- Predicate
- value type
- Value type
- Class
-
- Comment
- the default value for the argument
- Optional
- true
- Predicate
- default value
- Label
- Argument
- Label template
- Argument {?predicate} : {?valueType}
- SubClassOf
- Construct templates
Attribute
Defines an "attribute" of a class. Attribute definitions bundle common modeling patterns known from object-oriented languages like UML. Each attribute can have min and max cardinality, a value type and a default value. The attribute links a class with one RDF property. This template should be used as spin:constraints on a class to make sure that classes meet the expected cardinalities and valueType constraints. If a model wants to use spl:defaultValue, then it should instantiate the spl:ConstructDefaultValues as a spin:constructor at some root class, such as rdfs:Resource.
- Body
-
- Text
-
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX spin: <http://spinrdf.org/spin#> CONSTRUCT { _:b0 a spin:ConstraintViolation . _:b0 spin:violationRoot ?this . _:b0 spin:violationPath ?predicate . _:b0 spin:violationValue ?value . } WHERE { { SELECT (count(*) AS ?cardinality) WHERE { ?this ?predicate ?value FILTER bound(?minCount) } HAVING ( ?cardinality < ?minCount ) } UNION { { SELECT (count(*) AS ?cardinality) WHERE { ?this ?predicate ?value FILTER bound(?maxCount) } HAVING ( ?cardinality > ?maxCount ) } } UNION { ?this ?predicate ?value FILTER ( isURI(?value) || isBlank(?value) ) FILTER bound(?valueType) FILTER NOT EXISTS { ?value a ?class . ?class (rdfs:subClassOf)* ?valueType } } UNION { ?this ?predicate ?value FILTER isLiteral(?value) FILTER bound(?valueType) BIND(datatype(?value) AS ?datatype) FILTER ( ! ( ( ?datatype IN (?valueType, rdfs:Literal) ) || ( ( ( ! bound(?datatype) ) || ( ?datatype = rdf:langString ) ) && ( ?valueType = xsd:string ) ) ) ) } }
- Comment
- Defines an "attribute" of a class. Attribute definitions bundle common modeling patterns known from object-oriented languages like UML. Each attribute can have min and max cardinality, a value type and a default value. The attribute links a class with one RDF property. This template should be used as spin:constraints on a class to make sure that classes meet the expected cardinalities and valueType constraints. If a model wants to use spl:defaultValue, then it should instantiate the spl:ConstructDefaultValues as a spin:constructor at some root class, such as rdfs:Resource.
- Constraint
-
- Comment
- the type that all values of the property must have
- Optional
- true
- Predicate
- value type
- Value type
- Class
-
- Comment
- the default value of the attribute
- Optional
- true
- Predicate
- default value
- Label
- Attribute
- Label template
- Attribute {?predicate} : {?valueType} [{?minCount},{?maxCount}]
- SubClassOf
- Construct templates
- Label
- default value
- SubPropertyOf
- arg
SPIN Standard Library
A collection of generally useful SPARQL functions (expressed as SPIN functions), and SPIN templates. Also provides a top-level classification of functions, and definitions of the standard SPARQL functions.
- Comment
- A collection of generally useful SPARQL functions (expressed as SPIN functions), and SPIN templates. Also provides a top-level classification of functions, and definitions of the standard SPARQL functions.
- Imports
- SPIN Modeling Vocabulary
- Label
- SPIN Standard Library
- VersionInfo
- 1.4.2
- Label
- value type
- SubPropertyOf
- arg