Mathematical functions true true the default value for the argument age defaultValue true the default value of the attribute false Misc functions true the instance being tested ne Returns true if ?arg1 != ?arg2. != the second operand the first operand anyValue Argument Argument {?predicate} : {?valueType} 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:constraing, the body of this template will verify that a non-optional value exists and that it has the specified value type. isURI Checks whether a node is a URI. isURI the variable or expression that is checked Returns true if ?arg1 < ?arg2. lt < true the minimum number of values permitted for the property the second operand of the intersection Returns true if both arguments are equal. eq = 0 -2 the first operand the literal to get the language of the node to convert to string CONSTRUCT { ?this ?predicate ?defaultValue .} WHERE { ?this rdf:type ?directType . ?directType rdfs:subClassOf* ?type . ?type spin:constraint ?attribute . ?attribute spl:defaultValue ?defaultValue . ?attribute spl:predicate ?predicate } class Returns true if a string (?arg1) matches the regular expression supplied as a pattern (?arg2) as influenced by the value of flags (?arg3), otherwise returns false. regex regex the property that is expected to hold the value Can be used to infer default values for a given subject/predicate combination. This is typically assigned as spin:rule to a class. If ?this does not already have a value for a given property {?predicate}, then this will infer the value {?defaultValue}. Infer default value Default value for {?predicate}: {?defaultValue} && and Return the logical AND between two (boolean) operands. The default value to infer. the first operand the first operand the second operand type the first operand the operand Ontology functions true b the first argument the second operand valueType the second operand vars the second operand the type that the instance must have predicate isBlank Checks whether a given node is a blank node. isBlank datatype the subject that is expected to have the value minCount2 A collection of generally useful SPARQL functions (expressed as SPIN functions), and SPIN templates. Also provides a top-level classification of functions. 1.1.1 indicates whether the argument is optional true 0 -2 instance body minCount the second argument the literal that is expected to have ?arg2 as language tag 0 -2 / Returns the arithmetic quotient of its operands. divide The predicate to infer the default value of. the second operand the match pattern directType unary plus + Returns the operand ?arg1 with the sign unchanged. Semantically, this operation performs no operation. the property to get the number of values of true a comment describing the argument the property holding the values of each function call value body - sub Returns the arithmetic difference of its operands. or Returns the logical OR between two (boolean) operands. || body class predicate p String functions true true the maximum number of values permitted for the property the input string the first operand of the intersection the first operand Checks whether a given subject (?arg1) has at least one value of a given type (?arg3) for a given property (?arg2) or one of its sub-properties. hasValueOfType the first operand true the flags the subject to get the number of objects of Logical functions true true the value type of the argument 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. Attribute Attribute {?predicate} : {?valueType} [{?minCount},{?maxCount}] true a comment describing the meaning of this attribute the first number body isIRI Checks whether a given node is a IRI node. isIRI the second value to compare valueType datatype the first value to compare default value Returns the arithmetic sum of its operands. + add the second operand Returns true if ?arg1 is bound to a value. Returns false otherwise. Variables with the value NaN or INF are considered bound. bound bound the operand to negate Returns TRUE if ?arg1 and ?arg2 are the same RDF term as defined in Resource Description Framework (RDF): Concepts and Abstract Syntax [CONCEPTS]; returns FALSE otherwise. sameTerm same term Returns the language tag of ?arg1, if it has one. It returns "" if the literal has no language tag. Node that the RDF data model does not include literals with an empty language tag. lang lang unary minus - Returns the operand ?arg1 with the sign reversed. If ?arg1 is positive, its negative is returned; if it is negative, its positive is returned. optional count langMatches langMatches Returns true if language-tag (first argument) matches language-range (second argument) per the basic filtering scheme defined in [RFC4647] section 3.3.1. class count optional objectCount Gets the number of values of a given property (?arg2) at a given subject (?arg1). The result is the number of matches of (?arg1, ?arg2, ?object). attribute body t Returns the lexical form of ?arg1 (a literal); returns the codepoint representation of ?arg1 (an IRI). This is useful for examining parts of an IRI, for instance, the host-name. str str vars true the type that all values of the property must have maxCount defaultValue the first operand the second operand Checks whether a given resource (?arg1) has a given value (?arg3) for a given property (?arg2) or one of the sub-properties of it. hasValue value type ! Returns the boolean negation of the argument. not the literal to get the datatype of value predicate the subject that is expected to have the value the node being tested predicate the node being tested the second number predicate the language tag that ?arg1 must have the second operand the expected property -2 0 the node to check Returns true if ?arg1 >= ?arg2. >= ge {?arg1} instance of {?arg2} Checks whether a given resource (?arg1) has a given type (?arg2). In order to fulfill this condition, there must either be a triple ?arg1 rdf:type ?arg2, or ?instance rdf:type ?subClass where ?subClass is a subclass of ?arg2. If the first argument is a literal, then the second argument must be the matching XSD datatype. instanceOf the first operand the node being checked the RDF property holding the attribute value Function body must be either an Ask query or a Select with exactly one result variable the operand the type to match against le <= Returns true if ?arg1 <= ?arg2. datatype Returns the datatype IRI of argument ?arg1; returns xsd:string if the parameter is a simple literal. datatype str optional body Returns true if ?arg1 > arg2. gt > * Returns the arithmetic product of its operands. mul isLiteral Checks whether a given node is a literal. isLiteral error The literal to test. object Checks whether a given literal is untyped. This function was introduced because the built-in datatype operand in SPARQL casts untyped literals to xsd:string, making it impossible to check it this way. This function here uses a work-around using sameTerm instead. isUntypedLiteral Construct default values Construct default values This template can be attached as spin:constructor to a root class such as rdfs:Resource to ensure that SPIN processors assign default values to certain properties. Looks for any templates attached as spin:constraints to the types of ?this and then assigns their declared spl:defaultValues. the expected value