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.
Metaclass for CONSTRUCT templates that create spin:ConstraintViolations and can be used as values of spin:constraint.
A test to verify that a SPIN function or magic property works as expected, and to generate documentation of example uses of the function. Each TestCase consists of a SPARQL function call or an expression that can be executed with spin:eval, and an expected result. The test framework only needs to execute spin:eval on the expression and compare it with the expected result.
The test expression or SELECT query (anything that can be evaluated with spin:eval).
The expected result of the test case, or nothing to indicate that an error is expected.
This type can be used for templates that serve as the union (or "collector") of other templates. Union templates differ from other templates in that all spl:Arguments are optional. This means that union templates can be declared as subclasses of multiple other templates, yet when instantiated, only some of the arguments defined by the superclasses need to be filled in.
Finds all constraints and rules attached to classes in the current graph, using spin:constraint, spin:constructor, spin:rule or their sub-properties. The result set will contain the associated class, the predicate, and the SPIN rule.
the property holding the values of each function call
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.
indicates whether the argument is optional
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.
a comment describing the meaning of this attribute
the maximum number of values permitted for the property
Attribute {?predicate} : {?valueType} [{?minCount},{?maxCount}]
the RDF property holding the attribute value
the type that all values of the property must have
the minimum number of values permitted for the property
A magic property that establishes a relationship between properties (left) and classes (right) to determine which properties are "relevant" for the class. Relevant means that they have the class in their domain and/or restrictions, including superclasses and sub-properties (unless they define their own domain). Domains consisting of an owl:unionOf are also handled. Note that the performance of the body of this magic property has been optimized for the case in which the class is given, so ideally use this for queries such as ?property spl:relevantPropertyAtClass skos:Concept .
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}.
Default value for {?predicate}: {?defaultValue}
The predicate to infer the default value of.
A collection of functions that are difficult to categorize.
Takes any number of arguments, and returns the first bound argument, starting at the left.
A collection of functions operating on numbers.
Returns a number between 0 (inclusive) and 1.0e0 (exclusive). Different numbers can be produced every time this function is invoked. Numbers should be produced with approximately equal probability.
A collection of functions that operate on date/time literals.
Extracts the year from a date/time literal.
A collection of functions performing ontology-related operations.
Gets the object of a given subject (?arg1) / predicate (?arg2) combination in a given graph ?arg3. Note that if multiple values are present then the result might be unpredictably random.
Returns the number with no fractional part that is closest to the argument. If there are two such numbers, then the one that is closest to positive infinity is returned. An error is raised if ?arg1 is not a numeric value.
A collection of functions that return strings.
Computes the length of a given input string.
Returns true if the lexical form of ?arg1 ends with the lexical form of ?arg2, otherwise it returns false.
The sub-string that the input string is supposed to end with.
A collection of functions that return a boolean value (true or false).
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.
the subject that is expected to have the value
Gets a list of all spl:Arguments declared at a given class and its superclasses.
Returns the SHA1 checksum, as a hex digit string, calculated on the UTF-8 representation of the simple literal or lexical form of the xsd:string. Hex digits SHOULD be in lower case.
Abstract superclass of templates that can be used as spin:constraints. The subclasses are expected to construct spin:ConstraintViolations and use ?this to talk about the instances of the associated class.
Abstract superclass of constraint templates that constrain exactly one property.
Values of {?property} must match the regular expression {?pattern}
Returns the timezone part of ?arg1 as a simple literal. Returns the empty string if there is no timezone.
Gets the current date and time as an xsd:dateTime literal.
test
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.
Returns the smallest (closest to negative infinity) number with no fractional part that is not less than the value of arg. An error is raised if ?arg1 is not a numeric value.
Checks whether a given resource (?arg1) has a given value (?arg3) for a given property (?arg2) or one of the sub-properties of it.
the property that is expected to hold the value
Returns the largest (closest to positive infinity) number with no fractional part that is not greater than the value of ?arg1. An error is raised if ?arg1 is not a numeric value.
Returns the timezone part of ?arg1 as an xsd:dayTimeDuration. Raises an error if there is no timezone.
Checks whether the value on the left (?arg1) is one of the values on the right (?arg2, ?arg3 ...).
Returns true if the lexical form of ?arg1 begins with the lexical form of ?arg2, otherwise it returns false.
The sub-string that the input string is supposed to begin with.
Checks if a given module class (?module) has at least one declared spl:Argument.
Gets the "first" subject of a given predicate (?arg1)/object (?arg2) combination. Note that if multiple values are present then the result might be unpredictably random.
Extracts the hours from a date/time literal.
Returns the operand ?arg1 with the sign unchanged. Semantically, this operation performs no operation.
Extracts the minutes from a date/time literal.
Replaces each non-overlapping occurrence of a regular expression pattern with a replacement string. Regular expession matching may involve modifier flags.
Checks whether the value on the left (?arg1) is none of the values on the right (?arg2, ?arg3 ...).
Returns a literal of the same kind (simple literal, plain literal same language tag, xsd:string) as the first argument arg1. The lexical form of the result is the substring of the value of arg1 that proceeds in arg1 the first occurrence of the lexical form of arg2; otherwise the lexical form of the result is the empty string. If the lexical form of arg2 is the empty string, the lexical form of the result is the emprty string.
The pattern to find within the input string.
Returns the SHA384 checksum, as a hex digit string, calculated on the UTF-8 representation of the simple literal or lexical form of the xsd:string. Hex digits SHOULD be in lower case.
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.
Returns the MD5 checksum, as a hex digit string, calculated on the UTF-8 representation of the simple literal or lexical form of the xsd:string. Hex digits SHOULD be in lower case.
Returns the SHA256 checksum, as a hex digit string, calculated on the UTF-8 representation of the simple literal or lexical form of the xsd:string. Hex digits SHOULD be in lower case.
Returns a literal of the same kind (simple literal, plain literal same language tag, xsd:string) as the first argument arg1. The lexical form of the result is the substring of the value of arg1 that precedes in arg1 the first occurrence of the lexical form of arg2; otherwise the lexical form of the result is the empty string. If the lexical form of arg2 is the empty string, the lexical form of the result is the emprty string.
Abstract base class for templates that take two properties as arguments and establish a relationship between them.
The property {?property} must have a value whenever {?otherProperty} has a value
Takes a string (?arg1) and a language (?arg2) and constructs a literal with a corresponding language tag.
Converts a string to lower case characters.
The IRI string to convert to a resource.
Constructs a blank node that is distinct from all blank nodes in the dataset being queried and distinct from all blank nodes created by calls to this constructor for other query solutions. If the no argument form is used, every call results in a distinct blank node. If the form with a simple literal is used, every call results in distinct blank nodes for different simple literals, and the same blank node for calls with the same simple literal within expressions for one solution mapping. This functionality is compatible with the treatment of blank nodes in SPARQL CONSTRUCT templates.
Takes two arguments and returns the smaller one of them.
Returns a string that is the scheme specific part of UUID. That is, as a simple literal, the result of generating a UUID, converting to a simple literal and removing the initial urn:uuid:.
Takes two arguments and returns the larger one of them.
Extracts the seconds from a date/time literal.
Checks whether a given property (?arg1) is a (transitive) sub-property of another property (?arg2).
Represents a constraint that narrows down a property by a minimum and maximum value compared by <= and >=.
Values of {?property} must be within the interval [ {?min} , {?max} ]
Checks whether a given class (?arg1) is a (transitive) sub-class of another class (?arg2).
Returns the arithmetic quotient of its operands.
Returns true if arg1 is a numeric value. Returns false otherwise. term is numeric if it has an appropriate datatype (see the section Operand Data Types) and has a valid lexical form, making it a valid argument to functions and operators taking numeric arguments.
Extracts the day from a date/time literal.
Abstract superclass of property constraints that compare the number of values with either min or max count.
The minimum number of values that the property must have.
The maximum number of values that the property must have.
Represents a constraint that can be attached to a class to specify that a given property must have between min and max values.
The property {?property} must have between {?minCount} and {?maxCount} values
Returns the operand ?arg1 with the sign reversed. If ?arg1 is positive, its negative is returned; if it is negative, its positive is returned.
Creates a IRI resource (node) from a given IRI string (?arg1).
A generic SPIN template that can be used to declare a constraint that all values of a given property must have an rdf:type.
Extracts the month from a date/time literal.
Converts a string to upper case characters.
Returns the arithmetic product of its operands.
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.
Runs all spl:TestCases on the current model.
Gets the sub-string of a given string. The index of the first character is 1.
Gets the object of a given subject (?arg1) / predicate (?arg2) combination, also taking the sub-properties of ?arg2 into account. Note that if multiple values are present then the result might be unpredictably random.
The predicate to get the object of (including sub-properties of it).
Returns the arithmetic difference of its operands.
Gets the number of values of a given property (?arg1) at a given object (?arg2). The result is the number of matches of (?subject, ?arg1, ?arg2).
the object to get the number of subjects of
the predicate to get the number of subjects of
The property {?property} must have no values as long as {?otherProperty} has none
Returns the absolute value of arg. An error is raised if arg is not a numeric value.
Returns the arithmetic sum of its operands.
Returns the SHA512 checksum, as a hex digit string, calculated on the UTF-8 representation of the simple literal or lexical form of the xsd:string. Hex digits SHOULD be in lower case.
A collection of functions that create URI resources.
Returns a fresh IRI from the UUID URN scheme. Each call of UUID() returns a different UUID. It must not be the "nil" UUID (all zeroes). The variant and version of the UUID is implementation dependent.
Returns true if language-tag (first argument) matches language-range (second argument) per the basic filtering scheme defined in [RFC4647] section 3.3.1.
the literal that is expected to have ?arg2 as language tag
Constructs a literal with lexical form and type as specified by the arguments.
Returns an xsd:boolean indicating whether or not the value of ?arg1 contains (at the beginning, at the end, or anywhere within) at least one sequence of collation units that provides a minimal match to the collation units in the value of ?arg2, according to the collation that is used.
The sub-string to search for in the input string.
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.
The expression to evaluate. Should be a sp:Select, sp:Ask, a sp:Variable or an instance of a SPARQL function class, but may also be a simple RDF value.
A condition to evaluate - if true then the ?arg2 will be returned, otherwise ?arg3.
Returns the boolean negation of the argument.
Note that in TopBraid this function has been implemented in native Java code, for performance reasons.
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.
the subject to get the number of objects of
Returns true if both arguments are equal.
The filter function NOT EXISTS. The graph pattern is stored in sp:elements.
The CONCAT built-in function. Creates a single string by concatenating all arguments from left to right. Note that if any one of the arguments is unbound (null) then the whole result string will be unbound.
Checks whether a given node is a IRI node.
the property to get the number of values of
Returns the datatype IRI of argument ?arg1; returns xsd:string if the parameter is a simple literal.
Gets the object of a given subject (?arg1) / predicate (?arg2) combination. Note that if multiple values are present then the result might be unpredictably random.
Returns true if ?arg1 is bound to a value. Returns false otherwise. Variables with the value NaN or INF are considered bound.
the variable or expression that is checked
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).
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.
Return the logical AND between two (boolean) operands.
Checks whether a given node is a blank node.
Returns the logical OR between two (boolean) operands.
Returns TRUE if ?arg1 and ?arg2 are the same RDF term as defined in Resource Description Framework (RDF): Concepts and Abstract Syntax; returns FALSE otherwise.
The filter function EXISTS. The graph pattern is stored in sp:elements.
Checks whether a given node is a literal.