Please refer to the errata forA color-coded version of this document, which may include some normative corrections.document showing changes made since the previous version is also available.
This document is also available in these non-normative formats: PDF version.
See also translations .Copyright © 20102012 W3C^{®} (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This document is being published as one of a set of 1112 documents:
The W3C Director seeks review and feedback from W3C Advisory Committee representatives, via their review form by 25 November 2012. This will allow the Director to public-rif-comments@w3.org ( public archive ). Although work onassess consensus and determine whether to issue this document as a W3C Edited Recommendation.
Others are encouraged by the Rule Interchange Format (RIF) Working Group is complete, comments may be addressed in the erratato continue to send reports of implementation experience, and other feedback, to public-rif-comments@w3.org (public archive). Reports of any success or in future revisions.difficulty with the test cases are encouraged. Open discussion among developers is welcome at public-rif-dev@w3.org (public archive).
Publication as a Editor's Draft does not imply endorsement by the W3C Recommendation. ItMembership. This is a stabledraft document and may be used as reference materialupdated, replaced or cited from another document. W3C's role in making the Recommendationobsoleted by other documents at any time. It is inappropriate to draw attention to the specification and to promote its widespread deployment.cite this enhances the functionality and interoperability of the Web.document as other than work in progress.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This specification develops RIF-DTB (Datatypes and Built-Ins of the Rule Interchange Format). It lists the datatypes, built-in functions and built-in predicates expected to be supported by RIF dialects such as the RIF Core Dialect, the RIF Basic Logic Dialect, and the RIF Production Rules Dialect.
Some of the datatypes are adapted from [XML Schema Datatypes]. A large part of the definitions of the listed functions and operators are adapted from [XPath-Functions]. The rdf:PlainLiteral datatype as well as functions and operators associated with that datatype are adopted from [RDF-PLAINLITERAL]. Unlike the earlier SWRL built-ins [SWRL], which write n-ary functions as (1+n)-ary relations, functional RIF-DTB built-ins remain functions.
Currently in 1.0, RIF-DTB can also help in the interoperation of RIF with other (Semantic) Web formalisms by providing a general infrastructure of datatypes and built-ins.
Each constant (that is, each non-keyword symbol) in RIF belongs to a particular symbol space. A constant in a particular RIF symbol space has the following presentation syntax:
"literal"^^<symbolSpaceIri>
where literal is called the lexical part of the symbol, and symbolSpaceIri is the (absolute or relative) IRI identifying the symbol space. Here literal is a Unicode string that must be an element in the lexical space of the symbol space identified by the IRI symbolSpaceIri.
Since IRIs typically require long strings of characters, many Web languages have special provisions for abbreviating these strings. One well-known technique is called compact URI [CURIE], and RIF uses a similar technique by allowing RIF documents to have the directives Base and Prefix.
The Base directive defines a syntactic shortcut for expanding relative IRIs into full IRIs.
The basic idea is that in certain contexts prefixes can be used instead of their much longer expansions, and this provides for a much more concise and simple notation.
The precise way in which these directives work is explained in Section Shortcuts for Constants in RIF's Presentation Syntax.
To avoid writing down long IRIs, this document will assume that the following Prefix directives have been specified in all the RIF documents under consideration:
Using these prefixes and the shorthand mechanism defined in Section Shortcuts for Constants in RIF's Presentation Syntax, we can, for example, abbreviate a constant such as "http://www.example.org"^^<http://www.w3.org/2007/rif#iri> into "http://www.example.org"^^rif:iri.
Formally, we define symbol spaces as follows.
Definition (Symbol space). A symbol space is a named subset of the set of all constants, Const in RIF. Each symbol in Const belongs to exactly one symbol space.
Each symbol space has an associated lexical space, a unique IRI identifying it and a short name. More precisely,
The identifiers of symbol spaces are not themselves constant symbols in RIF.
For convenience we will often use symbol space identifiers to refer to the actual symbol spaces (for instance, we may use "symbol space xs:string" instead of "symbol space identified by xs:string").
RIF dialects are expected to include the symbol spaces listed in the following. However, rule sets that are exchanged through RIF can use additional symbol spaces.
In the following list we introduce short names for some of the symbol spaces. Short names are NCNames, typically the character sequence after the last '/' or '#' in the symbol space IRI (similar to the XML local name part of a QName). Short names are used for the predicates in Sections Guard Predicates for Datatypes and Negative Guard Predicates for Datatypes below.
These two symbol spaces represent two subtypes of the XML Schema datatype xs:duration .The lexical spaces of the above symbol spaces are defined in the document [ XDMXML Schema Datatypes].
The rdf:PlainLiteral symbol space represents text strings with a language tag attached. The lexical space of rdf:PlainLiteral is defined in the document [RDF-PLAINLITERAL].
The rdf:XMLLiteral symbol space represents XML content. The lexical space of rdf:XMLLiteral is defined in the document [RDF-CONCEPTS].
Constants in the rif:iri symbol space are intended to be used in a way similar to RDF resources [RDF-SCHEMA]. The lexical space consists of all absolute IRIs as specified in [RFC-3987]; it is unrelated to the XML primitive type xs:anyURI.
Constants in the rif:local symbol space are local to the RIF documents in which they occur. This means that occurrences of the same rif:local constant in different documents are viewed as unrelated distinct constants, but occurrences of the same rif:local constant in the same document must refer to the same object. The lexical space of rif:local is the same as the lexical space of xs:string.
Note that, by the associated lexical space, not all Unicode strings are syntactically valid lexical parts for all symbol spaces. That is, for instance, "1.2"^^xs:decimal and "1"^^xs:integer are syntactically valid constant because 1.2 and 1 are members of the lexical space of symbol spaces xs:decimal and xs:integer, respectively. On the other hand, "a+2"^^xs:decimal is not a syntactically valid constant, since a+2 is not part of the lexical space of xs:decimal.
We will often refer to constant symbols that come from a particular symbol space, X, as X constants, where X is the (short) name of the respective symbol space. For instance, the constants in the symbol space rif:iri will be referred to as IRI constants or rif:iri constants and the constants found in the symbol space rif:local as local constants or rif:local constants.
Besides the basic notion
"literal"^^<identifier>
RIF's presentation syntax introduces several shortcuts for particular symbol spaces, in order to make the presentation syntax more readable. RIF's presentation syntax for constants is defined by the following EBNF.
ANGLEBRACKIRI ::= IRI_REF SYMSPACE ::= ANGLEBRACKIRI | CURIE CURIE ::= PNAME_LN | PNAME_NS Const ::= '"' UNICODESTRING '"^^' SYMSPACE | CONSTSHORT CONSTSHORT ::= ANGLEBRACKIRI // shortcut for "..."^^rif:iri | CURIE // shortcut for "..."^^rif:iri | '"' UNICODESTRING '"' // shortcut for "..."^^xs:string | NumericLiteral // shortcut for "..."^^xs:integer,xs:decimal,xs:double | '_' NCName // shortcut for "..."^^rif:local | '"' UNICODESTRING '"' '@' langtag // shortcut for "...@..."^^rdf:PlainLiteral
The EBNF grammar relies on reuse of nonterminals defined in the following grammar productions from other documents:
In this grammar, CURIE stands for compact IRIs [CURIE], which are used to abbreviate symbol space IRIs. For instance, one can write "http://www.example.org"^^rif:iri instead of "http://www.example.org"^^<http://www.w3.org/2007/rif#iri>, where rif is a prefix defined in Section Base and Prefix Directives.
Apart from compact IRIs, there exist convenient shortcut notations for constants in specific symbol spaces, namely for constants in the symbol spaces rif:iri, xs:string, xs:integer, xs:decimal, xs:double, and rif:local:
Constants in the the symbol space rif:iri can be abbreviated in two ways, either by simply using an absolute or relative IRI enclosed in angle brackets, or by writing a compact IRI. The symbol space identifier is dropped in both of these alternatives. For instance, <http://www.example.org/xyz> is a valid abbreviation for "http://www.example.org/xyz"^^rif:iri, and ex:xyz is a valid abbreviation for this constant, if the directive
Prefix(ex <http://www.example.org/> )
is present in the RIF document in question.
Relative IRIs in RIF documents are resolved with respect to the base IRI. Relative IRIs are combined with base IRIs as per Uniform Resource Identifier (URI): Generic Syntax [RFC-3986] using only the basic algorithm in Section 5.2. Neither Syntax-Based Normalization nor Scheme-Based Normalization (described in Sections 6.2.2 and 6.2.3 of RFC-3986) are performed. Characters additionally allowed in IRI references are treated in the same way that unreserved characters are treated in URI references, per Section 6.5 of Internationalized Resource Identifiers (IRIs) [RFC-3987].
Base IRIs are specified using the Base directive described in Section Base and Prefix Directives. At most one base directive per document is allowed. In the XML syntax, base IRIs are specified using the attribute xml:base.
For instance, the constant <./xyz> or "./xyz"^^rif:iri are both valid abbreviations in RIF for the constant http://www.example.org/xyz"^^rif:iri, if the following directive is present in the document:
Base(<http://www.example.org>)
Datatypes in RIF are symbol spaces which have special semantics. That is, each datatype is characterized by a fixed lexical space, value space and lexical-to-value-mapping.
Definition (Datatype). A datatype is a symbol space that has
Semantic structures are always defined with respect to a particular set of datatypes, denoted by DTS. In a concrete dialect, DTS always includes the datatypes supported by that dialect. RIF dialects are expected to support the following datatypes. However, RIF dialects may include additional datatypes. Subitems in the following lists indicate derived datatypes.
Their value spaces and the lexical-to-value-space mappings are defined as follows:
A RIF built-in function or predicate is a special case of externally defined terms, which are defined in RIF Framework for Logic Dialects and also reproduced in the direct definition of RIF Basic Logic Dialect (RIF-BLD).
In RIF's presentation syntax built-in predicates and functions are syntactically represented as external terms of the form:
'External' '(' Expr ')'
where Expr is a positional term as defined in RIF Framework for Logic Dialects (see also in RIF Basic Logic Dialect). For RIF's normative syntax, see the XML Serialization Framework in RIF-FLD, or, specifically for RIF-BLD, see XML Serialization Syntax for RIF-BLD.
RIF-FLD introduces the notion of an external schema to describe both the syntax and semantics of exernally defined terms. In the special case of a RIF built-in, external schemas have an especially simple form. A built-in named f that takes n arguments has the schema
( ?X_{1} ... ?X_{n}; f(?X_{1} ... ?X_{n}) )
Here f(?X_{1} ... ?X_{n}) is the actual positional term that is used to refer to the built-in (in expressions of the form External(f(?X_{1} ... ?X_{n}))) and ?X_{1} ... ?X_{n} is the list of all variables in that term.
Note that RIF-BLD allows additional forms of built-ins, which includes named-argument terms.
RIF-FLD defines a very general notion of external terms and schemas, but RIF-BLD and the present document use more restricted notions. For convenience, we present a complete definition of these restricted notions in Appendix: Schemas for Externally Defined Terms.
The semantics of external terms is defined using two mappings: I_{external} and I_{truth} ο I_{external}.
If σ represents a built-in function, I_{external}(σ) must be that function.
For each built-in function with external schema σ, the present document specifies the mapping I_{external}(σ).
In RIF logical semantics, this mapping is used to assign truth values to formulas. In the special case of RIF built-ins, it is used to assign truth values to RIF built-in predicates. The built-in predicates can have the truth values t or f only.
For a built-in predicate with schema σ, RIF-FLD and RIF-BLD require that the truth-valued mapping I_{truth} ο I_{external}(σ) must agree with the specification of the corresponding built-in predicate.
For each RIF built-in predicate with schema σ, the present document specifies I_{truth} ο I_{external}(σ).
This section provides a catalogue defining the syntax and semantics of a list of built-in predicates and functions in RIF. For each built-in, the following is defined:
As explained in Section Semantics of Built-ins, this corresponds to the mapping I_{external}(σ) in the formal semantics of RIF-FLD and RIF-BLD, where σ is the external schema of the built-in.
As explained in Section Semantics of Built-ins, this corresponds to the mapping I_{truth} ο I_{external}(σ) in the formal semantics of RIF-FLD and RIF-BLD, where σ is the external schema of the built-in.
Typically, built-in functions and predicates are defined over the value spaces of appropriate datatypes, i.e. the domains of the arguments. When an argument falls outside of its domain, it is understood as an error. Since this document defines a model-theoretic semantics for RIF built-ins, which does not support the notion of an error, the definitions leave the values of the built-in predicates and functions unspecified in such cases. This means that if one or more of the arguments is not in its domain, the value of I_{external}(σ)(a_{1} ... a_{n}) is unspecified. In particular, this means it can vary from one implementation to another. Similarly, I_{truth} ο I_{external}(σ)(a_{1} ... a_{n}) is unspecified when an argument is not in its domain.
This indeterminacy in case of an error implies that applications should not make any assumptions about the values of built-ins in such situations. Implementations are even allowed to abort in such cases and the only safe way to communicate rule sets that contain built-ins among RIF-compliant systems is to use datatype guards.
Many built-in functions and predicates described below are adapted from [XPath-Functions] and, when appropriate, we will refer to the definitions in that specification in order to avoid copying them. The differences from the original [XPath-Functions] include the handling of errors, the differentiation between predicates and functions, and a few specific differences noted in the definitions below.
RIF supports identity for typed literals through the "=" predicate in all dialects that extend RIF-Core. Identity for typed literals is defined as being the same point in the value space for that type. Certain datatypes use more specific notions of equality that allow for multiple points in the value space to be considered equal. For each datatype specific notion of equality we refer to the supported predicate for that datatype.
Since the basic RIF dialects do not support negation, dialects that extend RIF-Core define a built-in for checking the non-identity of two typed literals.
( ?arg_{1} ?arg_{2}; pred:literal-not-identical( ?arg_{1} ?arg_{2} ) )
This predicate does not depend on a specific domain.
I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:literal-not-identical( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t if and only if s_{1} and s_{2} are both in the value spaces of some datatypes in DTS and s_{1} ≠ s_{2}. This includes the case where s_{1} and s_{2} are of disjoint types.
I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:literal-not-identical( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = f otherwise. This includes the case where s_{1} or s_{2} are not in the value spaces of datatypes in DTS.
RIF defines guard predicates for all datatypes in Section Datatypes.
( ?arg_{1}; pred:is-literal-DATATYPE ( ?arg_{1} ) )
Here, DATATYPE is the short name for a datatype. For instance, we use pred:is-literal-string for the guard predicate for xs:string, pred:is-literal-PlainLiteral for the guard predicate for rdf:PlainLiteral, or pred:is-literal-XMLLiteral for the guard predicate forrdf:XMLLiteral. Parties defining their own datatypes to be used in RIF exchanged rules may define their own guard predicates for these datatypes. Labels used for such additional guard predicates for datatypes not mentioned in the present document MAY follow a similar naming convention where applicable without creating ambiguities with predicate names defined in the present document. Particularly, upcoming W3C specifications MAY - but 3rd party dialects MUST NOT - reuse the pred: namespace for such guard predicates.
Guard predicates do not depend on a specific domain.
I_{truth} ο I_{external}( ?arg_{1}; pred:is-literal-DATATYPE ( ?arg_{1} ) )(s_{1}) = t if and only if s_{1} is in the value space of DATATYPE and f otherwise.
Accordingly, the following schemas are defined.
Future dialects may extend this list of guards to other datatypes, but RIF does not require guards for all datatypes.
Likewise, RIF defines negative guard predicates for all datatypes in Section Datatypes.
( ?arg_{1}; pred:is-literal-not-DATATYPE ( ?arg_{1} ) )
Here, DATATYPE is the short name for one of the datatypes mentioned in this document. For instance, we use pred:is-literal-not-String for the negative guard predicate for xs:string, pred:is-literal-not-PlainLiteral for the negative guard predicate for rdf:PlainLiteral, or pred:is-literal-not-XMLLiteral for the negative guard predicate for rdf:XMLLiteral. Parties defining their own datatypes to be used in RIF exchanged rules may define their own negative guard predicates for these datatypes. Labels used for such additional negative guard predicates for datatypes not mentioned in the present document MAY follow a similar naming convention where applicable without creating ambiguities with predicate names defined in the present document. Particularly, upcoming W3C specifications MAY, but 3rd party dialects MUST NOT reuse, the pred: namespace for such negative guard predicates.
Negative guard predicates do not depend on a specific domain.
I_{truth} ο I_{external}( ?arg_{1}; pred:is-literal-not-DATATYPE ( ?arg_{1} ) )(s_{1}) = t if and only if s_{1} is in the value space of one of the datatypes in DTS but not in the value space of the datatype with shortname DATATYPE, and f otherwise.
Accordingly, the following schemas are defined.
Future dialects may extend this list of negative guards to other datatypes, but RIF does not require negative guards for all datatypes.
Note: The semantics of negative guards may be surprising. The is-literal-not-String guard essentially asks, "Is this a literal, and (if it is) is it something other than a String?" It could also be read as "Is this a decimal or a float or a double or a date or a dateTime, etc, [for every datatype except string] ?". The negative guards are formulated like this to allow for rules which detect, for instance, some kinds of bad inputs, while still using the open world assumption of some RIF dialects.
In the following, we adapt several cast functions according to the conversions defined in Section 17.1 of [XPath-Functions]. Note that some of these conversions are only partially defined, which affects the domains of these cast functions.
Likewise we define a conversion predicate useful for converting between rif:iri constants and strings, as well as a predicate to check the datatype of a constant.
The casting functions in Section 17.1 of [XPath-Functions] define mappings from source values SV, which are data values, annotated with source types ST, to target values TV, annotated with target types TT. The data values V we consider are not necessarily explicitly annotated with types. However, one can view the datatypes D_{1},...,D_{n} whose value spaces include a data value V as the types of V. We assume in the following that any of the data types D_{1},...,D_{n} is used as the annotation of the source value SV; the conversions in [XPath-Functions] are defined equivalently for all such datatypes.
( ?arg; DATATYPE-IRI ( ?arg ) )
Here, DATATYPE-IRI is the IRI identifying a datatype. For instance, we use xs:string(?V) for casting to xs:string. Parties defining their own datatypes to be used in RIF exchanged rules may define their own casting function for these datatypes. Labels used for such additional guard predicates for datatypes not mentioned in the present document MAY follow the same naming convention using the IRI identifying a datatype as function name for the casting function.
The domain for casting functions to XML schema datatypes depends on where the casting is defined according to Section 17.1 of [XPath-Functions]: for all the casting functions to XML schema datatypes the domain of ?arg is at most the set of all data values in the value spaces of XML schema datatypes such that the conversion to DATATYPE-IRI does not raise a type error or an invalid value for cast/constructor error [err:FORG0001] or an invalid lexical value error [err:FOCA0002] according to Section 17.1 of [XPath-Functions]. We will mention additional constraints on the domain for casts to specific datatypes below separately.
I_{external}( ?arg; DATATYPE-IRI ( ?arg ) )(SV) = TV, which is a value the value space of the datatype with IRI DATATYPE-IRI in derived from a type of SV, as defined in Section 17.1 of [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified. We will mention additional constraints on the mappings for casts to specific datatypes below separately.
Accordingly, the following schemas are defined:
Additional restriction on the Domain: Note that unlike [XPath-Functions] the extent to which an implementation validates the lexical form of xs:anyURI is not implementation dependent, but RIF requires all lexical forms of xs:anyURI appearing as constants in the xs:string symbol space to be castable to xs:anyURI.
Additional restriction on the Domain: The domain where this function is specified in RIF is further restricted to data values in the value spaces of XML schema datatypes such that the conversion to xs:date does not result in a value from the xs:date value space outside what [http://www.w3.org/TR/xmlschema11-2/#dt-minimally-conforming minimal conformance] as defined in Section 5.4 of [XML Schema Datatypes] requires for xs:date.
Additional restriction on the Domain: The domain where this functions is specified in RIF is further restricted to data values in the value spaces of XML schema datatypes such that the conversion to xs:date does not result in a value from the xs:dateTime value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for xs:dateTime.
Additional restriction on the Domain: Since xs:dateTimeStamp is a derived type of dateTime the domain if this function is the same as for casting to xs:dateTime with the additional restriction that casting to xs:dateTimeStamp is only defined for values such that the conversion to xs:dateTime has a non-empty timezone component.
Additional restriction on the Domain: The domain where this functions is specified in RIF is further restricted to data values in the value spaces of XML schema datatypes such that the conversion to xs:decimal does not result in a value from the xs:decimal value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for xs:decimal.
Additional restriction on the Domain: The domain where this functions is specified in RIF is further restricted to data values in the value spaces of XML schema datatypes such that the conversion to xs:integer does not result in a value from the xs:integer value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for xs:integer.
Additional restrictions on the Domain:
Additional remark on the mapping:
If SV is a value in the value space of rdf:XMLLiteral, then
I_{external}( ?arg; xs:string( ?arg ) )(SV) = TV such that
TV is the string in the lexical space of rdf:XMLLiteral correspoding to SV (cf. [RDF-CONCEPTS]).
( ?arg; rdf:XMLLiteral ( ?arg ) )
The intersection of the value space of xs:string with the lexical space of rdf:XMLLiteral, i.e. an xs:string can be cast to rdf:XMLLiteral if and only if its value is in the lexical space of rdf:XMLLiteral as defined in Resource Description Framework (RDF): Concepts and Abstract Syntax
I_{external}( ?arg; xs:XMLLiteral ( ?arg ) )(s) = s' such that s' is the XMLLiteral corresponding to the given string s.
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg; rdf:PlainLiteral ( ?arg ) )
The union of the value spaces of XML schema datatypes.
Since the value space of xs:string is included in the value space of rdf:PlainLiteral, the mapping is defined in precisely the same way as for casts to xs:string.
Conversions from rif:iri to xs:string and vice versa cannot be defined by the casting functions as above since rif:iri is not a datatype with a well-defined value space.
To this end, since conversions from IRIs (resources) to strings are a needed feature, for instance, for conversions between RDF formats (see example below), we introduce a built-in predicate which supports such conversions.
( ?arg_{1} ?arg_{2}; pred:iri-string ( ?arg_{1}, ?arg_{2} ) )
The first argument is not restricted by a specific domain, the second argument is the value space of xs:string.
I_{external}( ?arg_{1} ?arg_{2}; pred:iri-string ( ?arg_{1} ?arg_{2} ) )(iri_{1} str_{1}) = t if and only if str_{1} is a string in the lexical space of rif:iri and iri_{1} is an element of the domain such that I( "str_{1}"^^rif:iri ) = iri_{1} holds in the current interpretation.
Note that this definition restricts allowed RIF interpretations in such a way that the interpretation of pred:iri-string always needs to comply with respect to the symbols in the rif:iri symbol space for the first argument and elements of the xs:string value space for the second argument. The truth value of the predicate is left unspecified for other elements of the domain.
This predicate could be usable, for instance, to map telephone numbers between an RDF Format for vCard (http://www.w3.org/TR/vcard-rdf) and FOAF (http://xmlns.com/foaf/0.1/). vCard stores telephone numbers as string literals, whereas FOAF uses resources, i.e., URIs with the tel: URI-scheme. So, a mapping from FOAF to vCard would need to convert the tel: URI to a string and then cut off the first four characters ("tel:"). Such a mapping expressed in RIF could involve e.g. a rule as follows:
... Prefix( VCard <http://www.w3.org/TR/vcard-rdf#> ) Prefix( foaf <http://xmlns.com/foaf/0.1/> ) ... Forall ?X ?foafTelIri ?foafTelString ( ?X[ VCard:tel -> External( func:substring( ?foafTelString 4 ) ] :- And ( ?X[ foaf:phone -> ?foafTelIri ] External( pred:iri-string( ?foafTelIri ?foafTelString ) ) )
The following functions and predicates are adapted from the respective numeric functions and operators in [XPath-Functions].
The following numeric binary built-in functions func:numeric-add, func:numeric-subtract, func:numeric-multiply, func:numeric-divide, func:numeric-integer-divide, and func:numeric-mod are defined in accordance with their corresponding operators in [XPath-Functions].
The schemas for these functions have the general form
(?arg_{1} ?arg_{2}; func:numeric-BINOP(?arg_{1} ?arg_{2}))
The domain of these functions is made up of pairs of values from value spaces of xs:integer, xs:double, xs:float, or xs:decimal for both arguments such that op:numeric-BINOP as defined in [XPath-Functions] after type promotion does not result in a numeric operation overflow/underflow error err:FOAR0002, division by zero error err:FOAR0001, or a value from the xs:decimal value spaces expressible with sixteen total digits, i.e., RIF requires minimal conformance as defined in Section 5.4 of [XML Schema Datatypes].
I_{external}( ?arg_{1} ?arg_{2}; func:numeric-BINOP(?arg_{1} ?arg_{2}) )(a_{1} a_{2}) = res such that res is the result of op:numeric-BINOP(a_{1}', a_{2}') as defined in [XPath-Functions], in case both a_{1} and a_{2} belong to their domains. Here, a_{1}' and a_{2}' are obtained from a_{1} and a_{2} as follows:
If an argument value is outside of its domain, the value of the function is left unspecified.
Accordingly, the following schemas are defined:
(?arg_{1} ?arg_{2}; pred:numeric-equal(?arg_{1} ?arg_{2}))
The value spaces of xs:integer, xs:double, xs:float, or xs:decimal for both arguments.
When both a_{1} and a_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:numeric-equal(?arg_{1} ?arg_{2}) )(a_{1} a_{2}) = t if and only if op:numeric-equal(a_{1}, a_{2}) returns true, as defined in [XPath-Functions], f otherwise.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
(?arg_{1} ?arg_{2}; pred:numeric-less-than( ?arg_{1} ?arg_{2}) )
The value spaces of xs:integer, xs:double, xs:float, or xs:decimal for both arguments.
When both a_{1} and a_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:numeric-less-than(?arg_{1} ?arg_{2}) )(a_{1} a_{2}) = t if and only if op:numeric-less-than(a_{1}, a_{2}) returns true, as defined in [XPath-Functions], f otherwise.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
(?arg_{1} ?arg_{2}; pred:numeric-greater-than( ?arg_{1} ?arg_{2}) )
The value spaces of xs:integer, xs:double, xs:float, or xs:decimal for both arguments.
When both a_{1} and a_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:numeric-greater-than(?arg_{1} ?arg_{2}) )(a_{1} a_{2}) = t if and only if op:numeric-greater-than(a_{1}, a_{2}) returns true, as defined in [XPath-Functions], f otherwise.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
(?arg_{1} ?arg_{2}; pred:numeric-not-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:numeric-not-equal has the same domains as pred:numeric-equal and is true whenever pred:numeric-equal is false and false otherwise.
(?arg_{1} ?arg_{2}; pred:numeric-less-than-or-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:numeric-less-than-or-equal has the same domains as pred:numeric-equal and is true whenever pred:numeric-equal is true or pred:numeric-less-than is true and false otherwise.
(?arg_{1} ?arg_{2}; pred:numeric-greater-than-or-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:numeric-greater-than-or-equal has the same domains as pred:numeric-equal and is true whenever pred:numeric-equal is true or pred:numeric-greater-than is true and false otherwise.
The following functions and predicates are adapted from the respective functions and operators on boolean values in [XPath-Functions].
(?arg ; func:not( ?arg ) )
The value space of xs:boolean for ?arg.
I_{external}( ?arg ; func:numeric-mod(?arg) )(a_{1}) = res such that res is the result of fn:not(a_{1}) as defined in [XPath-Functions], in case a_{1} belongs to its domain.
If the argument value is outside of its domain, the value of the function is left unspecified.
(?arg_{1} ?arg_{2}; pred:boolean-equal(?arg_{1} ?arg_{2}))
The value space of xs:boolean for both arguments.
When both a_{1} and a_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:boolean-equal(?arg_{1} ?arg_{2}) )(a_{1} a_{2}) = t if and only if op:boolean-equal(a_{1}, a_{2}) returns true, as defined in [XPath-Functions], f otherwise.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
The following built-in predicates pred:boolean-less-than and pred:boolean-greater-than are defined analogously with respect to their corresponding operators in [XPath-Functions].
(?arg_{1} ?arg_{2}; pred:boolean-less-than( ?arg_{1} ?arg_{2}) )
The value space of xs:boolean for both arguments.
When both a_{1} and a_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:boolean-less-than(?arg_{1} ?arg_{2}) )(a_{1} a_{2}) = t if and only if op:boolean-less-than(a_{1}, a_{2}) returns true, as defined in [XPath-Functions], f otherwise.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
(?arg_{1} ?arg_{2}; pred:boolean-greater-than( ?arg_{1} ?arg_{2}) )
The value space of xs:boolean for both arguments.
When both a_{1} and a_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:boolean-greater-than(?arg_{1} ?arg_{2}) )(a_{1} a_{2}) = t if and only if op:boolean-greater-than(a_{1}, a_{2}) returns true, as defined in [XPath-Functions], f otherwise.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
The following functions and predicates are adapted from the respective functions and operators on strings in [XPath-Functions].
( ?comparand_{1} ?comparand_{2}; func:compare(?comparand_{1} ?comparand_{2}) )
( ?comparand_{1} ?comparand_{2} ?collation; func:compare(?comparand_{1} ?comparand_{2} ?collation) )
The value space of xs:string for ?comparand_{1} and ?comparand_{2}; the domain of ?collation is empty.
I_{external}( ?comparand_{1} ?comparand_{2}; func:compare(?comparand_{1} ?comparand_{2}) )(s_{1} s_{2}) = res such that res = -1, 0, or 1 (from the value space of xs:integer), depending on whether the value of the s_{1} is respectively less than, equal to, or greater than the value of s_{2} according to the default codepoint collation as defined in Section 7.3.1 of [XPath-Functions]. I.e., this function computes the result of fn:compare(s_{1}, s_{2}) as defined in [XPath-Functions], in case all arguments belong to their domains, where the default behavior in RIF is the codepoint collation.
If an argument value is outside of its domain, the value of the function is left unspecified. Note that specifically the defined domain for the ?collation argument is empty in RIF. That means RIF does not prescribe any specific collation apart from the default codepoint collation and - consequently - the result of this function with a given collation argument is not defined by RIF and may vary between implementations.
( ?arg_{1} ?arg_{2}; func:concat(?arg_{1} ?arg_{2} ) )
...
( ?arg_{1} ?arg_{2} ... ?arg_{n}; func:concat(?arg_{1} ?arg_{2} ... ?arg_{n} ) )
Following the definition of fn:concat this function casts its arguments to xs:string. Thus, the domain for all arguments is the union of all values castable to xs:string as defined in Section Datatype Conversion and Casting above.
I_{external}( ?arg_{1} ... ?arg_{n}; func:concat(?arg_{1} ... ?arg_{n}) )(s_{1} ... s_{n}) = res such that res is the result of fn:concat(s_{1} ... s_{n}) as defined in [XPath-Functions], in case all arguments belong to their domains.
If an argument value is outside of its domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; func:string-join(?arg_{1} ?arg_{2} ) )
( ?arg_{1} ?arg_{2} ?arg_{3}; func:string-join(?arg_{1} ?arg_{2} ?arg_{3} ) )
...
( ?arg_{1} ?arg_{2} ... ?arg_{n-1} ?arg_{n}; func:string-join(?arg_{1} ?arg_{2} ... ?arg_{n-1} ?arg_{n} ) )
The value space of xs:string for all arguments.
I_{external}( ?arg_{1} ... ?arg_{n-1} ?arg_{n}; func:string-join(?arg_{1} ... ?arg_{n-1} ?arg_{n}) )(s_{1} ... s_{n-1} s_{n}) = res such that res is the result of fn:string-join((s_{1} ... s_{n-1} ) s_{n}) as defined in [XPath-Functions], in case all arguments belong to their domains.
If an argument value is outside of its domain, the value of the function is left unspecified.
( ?sourceString ?startingLoc; func:substring( ?sourceString ?startingLoc) )
( ?sourceString ?startingLoc ?length ; func:substring( ?sourceString ?startingLoc ?length) )
The value space of xs:string for ?sourceString and the union of the value spaces of xs:integer, xs:double, xs:float and xs:decimal for the remaining two arguments.
I_{external}( ?sourceString ?startingLoc ?length; func:substring( ?sourceString ?startingLoc ?length ) )(src loc len) = res such that res is the result of fn:substring(src loc len) as defined in [XPath-Functions], in case all arguments belong to their domains.
If an argument value is outside of its domain, the value of the function is left unspecified.
Note that, as in XPath-Functions, the first character of a string is located at position 1, not position 0.
( ?arg ; func:string-length( ?arg ) )
The value space of xs:string for ?arg.
I_{external}( ?arg; func:string-length( ?arg ) )(s) = res such that res is the result of fn:string-length(s) as defined in [XPath-Functions], in case the argument belongs to its domain.
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:upper-case( ?arg ) )
The value space of xs:string for ?arg.
I_{external}( ?arg; func:upper-case( ?arg ) )(s) = res such that res is the result of fn:upper-case(s) as defined in [XPath-Functions], in case the argument belongs to its domain.
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:lower-case( ?arg ) )
The value space of xs:string for ?arg.
I_{external}( ?arg; func:lower-case( ?arg ) )(s) = res such that res is the result of fn:lower-case(s) as defined in [XPath-Functions], in case the argument belongs to its domain.
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:encode-for-uri( ?arg ) )
The value space of xs:string for ?arg.
I_{external}( ?arg; func:encode-for-uri( ?arg ) )(s) = res such that res is the result of fn:encode-for-uri(s) as defined in [XPath-Functions], in case the argument belongs to its domain.
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?iri ; func:iri-to-uri ( ?arg ) )
The value space of xs:string for ?arg.
I_{external}( ?arg; func:iri-to-uri( ?arg ) )(s) = res such that res is the result of fn:iri-to-uri(s) as defined in [XPath-Functions], in case the argument belongs to its domain.
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?uri ;func:escape-html-uri( ?arg ) )
The value space of xs:string for ?arg.
I_{external}( ?arg; func:escape-html-uri( ?arg ) )(s) = res such that res is the result of fn:escape-html-uri(s) as defined in [XPath-Functions], in case the argument belongs to its domain.
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; func:substring-before( ?arg_{1} ?arg_{2} ) )
( ?arg_{1} ?arg_{2} ?collation; func:substring-before( ?arg_{1} ?arg_{2} ?collation ) )
The value space of xs:string for ?arg_{1} and ?arg_{2}; the domain of ?collation is empty.
I_{external}( ?arg_{1} ?arg_{2}; func:substring-before(?arg_{1} ?arg_{2}) )(s_{1} s_{2}) = res, such that res is the substring of s_{1} that precedes in the value of s_{1} the first occurrence of a sequence of collation units that provides a minimal match to the collation units of s_{2} according to the default codepoint collation as defined in Section 7.3.1 of [XPath-Functions].
If any argument value is outside of its domain, the value of the function is left unspecified. Note that specifically the defined domain for the ?collation argument is empty in RIF. That means RIF does not prescribe any specific collation apart from the default codepoint collation and - consequently - the result of this function with a given collation argument is not defined by RIF and may vary between implementations.
( ?arg_{1} ?arg_{2}; func:substring-after( ?arg_{1} ?arg_{2} ) )
( ?arg_{1} ?arg_{2} ?collation; func:substring-after( ?arg_{1} ?arg_{2} ?collation ) )
The value space of xs:string for ?arg_{1} and ?arg_{2}; the domain of ?collation is empty.
I_{external}( ?arg_{1} ?arg_{2}; func:substring-after(?arg_{1} ?arg_{2}) )(s_{1} s_{2}) = res, such that res is the substring of s_{1} that follows in the value of ?s_{1} the first occurrence of a sequence of collation units that provides a minimal match to the collation units of s_{2} according to the default codepoint collation as defined in Section 7.3.1 of [XPath-Functions].
If any argument value is outside of its domain, the value of the function is left unspecified. Note that specifically the defined domain for the ?collation argument is empty in RIF. That means RIF does not prescribe any specific collation apart from the default codepoint collation and - consequently - the result of this function with a given collation argument is not defined by RIF and may vary between implementations.
( ?input ?pattern ?replacement; func:replace( ?input ?pattern ?replacement ) )
( ?input ?pattern ?replacement ?flags; func:replace( ?input ?pattern ?replacement ?flags ) )
The value space of xs:string for the first three arguments and all values in the value space of xs:string that are valid flags following Section 7.6.1.1 of [XPath-Functions] for ?flags.
I_{external} ( ?input ?pattern ?replacement ?flags; func:replace( ?input ?pattern ?replacement ?flags ) ) (i p r f ) = res, such that res is the result of fn:replace(i p r f) as defined in [XPath-Functions], in case the arguments belongs to their domains.
If any argument value is outside of its domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:contains( ?arg_{1} ?arg_{2} ) )
( ?arg_{1} ?arg_{2} ?collation ; pred:contains( ?arg_{1} ?arg_{2} ?collation ) )
The value space of xs:string for ?arg_{1} and ?a_{2}; the domain of ?collation is empty.
When all arguments belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:contains(?arg_{1} ?arg_{2}) )(s_{1} s_{2}) = t if and only if fn:contains(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f otherwise. I.e., this function returns true or false indicating whether or not ?s_{1} 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 ?s_{2}, according to the default codepoint collation as defined in Section 7.3.1 of [XPath-Functions].
If an argument value is outside of its domain, the truth value of the function is left unspecified. Note that specifically the defined domain for the ?collation argument is empty in RIF. That means RIF does not prescribe any specific collation apart from the default codepoint collation and - consequently - the result of this function with a given collation argument is not defined by RIF and may vary between implementations.
( ?arg_{1} ?arg_{2}; pred:starts-with( ?arg_{1} ?arg_{2} )
( ?arg_{1} ?arg_{2} ?collation; pred:starts-with( ?arg_{1} ?arg_{2} ?collation)
The value space of xs:string for ?arg_{1} and ?a_{2}; the domain of ?collation is empty.
When all arguments belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:starts-with(?arg_{1} ?arg_{2}) )(s_{1} s_{2}) = t if and only if fn:starts-with(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f otherwise.
If an argument value is outside of its domain, the value of the function is left unspecified.
(?arg_{1} ?arg_{2}; fn:ends-with( ?arg_{1} ?arg_{2} ) )
(?arg_{1} ?arg_{2} ?collation; fn:ends-with( ?arg_{1} ?arg_{2} ?collation) )
The value space of xs:string for ?arg_{1} and ?a_{2}; the domain of ?collation is empty.
When all arguments belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:ends-with(?arg_{1} ?arg_{2}) )(s_{1} s_{2}) = t if and only if fn:ends-with(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f otherwise.
If an argument value is outside of its domain, the value of the function is left unspecified.
( ?input ?pattern; pred:matches( ?input ?pattern) )
( ?input ?pattern ?flags; pred:matches( ?input ?pattern ?flags ) )
The value space of xs:string for the first two arguments and all values in the value space of xs:string that are valid flags following Section 7.6.1.1 of [XPath-Functions] for ?flags.
When all arguments belong to their domains, I_{truth} ο I_{external}( ?input ?pattern ?flags; pred:matches(?input ?pattern ?flags) )(i p f) = t if and only if pred:matches( i p f ) returns true, as defined in [XPath-Functions], f otherwise.
If an argument value is outside of its domain, the value of the function is left unspecified.
If not stated otherwise, in the following we define schemas for functions and operators defined on the date, time and duration datatypes in [XPath-Functions].
As defined in Section 3.3.2 Dates and Times, xs:dateTime, xs:date, xs:time, xs:gYearMonth, xs:gYear, xs:gMonthDay, xs:gMonth, xs:gDay values, referred to collectively as date/time values, are represented as seven components or properties: year, month, day, hour, minute, second and timezone. The value of the first five components are xs:integers. The value of the second component is an xs:decimal and the value of the timezone component is an xs:dayTimeDuration. For all the date/time datatypes, the timezone property is optional and may or may not be present. Depending on the datatype, some of the remaining six properties must be present and some must be absent. Absent, or missing, properties are represented by the empty sequence. This value is referred to as the local value in that the value is in the given timezone. Before comparing or subtracting xs:dateTime values, this local value must be translated or normalized to UTC.
( ?arg ; func:year-from-dateTime( ?arg ) )
The value space of xs:dateTime for ?arg.
I_{external}( ?arg ; func:year-from-dateTime( ?arg ) )(s) = res
such that res is the result of fn:year-from-dateTime(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
Note that we we slightly deviate here from the original definition of fn:year-from-dateTime which says: "If ?arg is the empty sequence, returns the empty sequence." The RIF version of func:year-from-dateTime does not support "empty sequences".
( ?arg ; func:month-from-dateTime( ?arg ) )
The value space of xs:dateTime for ?arg.
I_{external}( ?arg ; func:month-from-dateTime( ?arg ) )(s) = res
such that res is the result of fn:month-from-dateTime(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:day-from-dateTime( ?arg ) )
The value space of xs:dateTime for ?arg.
I_{external}( ?arg ; func:day-from-dateTime( ?arg ) )(s) = res
such that res is the result of fn:day-from-dateTime(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:hours-from-dateTime( ?arg ) )
The value space of xs:dateTime for ?arg.
I_{external}( ?arg ; func:hours-from-dateTime( ?arg ) )(s) = res
such that res is the result of fn:hours-from-dateTime(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:minutes-from-dateTime( ?arg ) )
The value space of xs:dateTime for ?arg.
I_{external}( ?arg ; func:minutes-from-dateTime( ?arg ) )(s) = res
such that res is the result of fn:minutes-from-dateTime(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:seconds-from-dateTime( ?arg ) )
The value space of xs:dateTime for ?arg.
I_{external}( ?arg ; func:seconds-from-dateTime( ?arg ) )(s) = res
such that res is the result of fn:seconds-from-dateTime(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:year-from-date( ?arg ) )
The value space of xs:date for ?arg.
I_{external}( ?arg ; func:year-from-date( ?arg ) )(s) = res
such that res is the result of fn:year-from-date(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:month-from-date( ?arg ) )
The value space of xs:date for ?arg.
I_{external}( ?arg ; func:month-from-date( ?arg ) )(s) = res
such that res is the result of fn:month-from-date(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:day-from-date( ?arg ) )
The value space of xs:date for ?arg.
I_{external}( ?arg ; func:day-from-date( ?arg ) )(s) = res
such that res is the result of fn:day-from-date(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:hours-from-time( ?arg ) )
The value space of xs:time for ?arg.
I_{external}( ?arg ; func:hours-from-time( ?arg ) )(s) = res
such that res is the result of fn:hours-from-time(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:minutes-from-time( ?arg ) )
I_{external}( ?arg ; func:minutes-from-time( ?arg ) )(s) = res
such that res is the result of fn:minutes-from-time(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:seconds-from-time( ?arg ) )
The value space of xs:time for ?arg.
I_{external}( ?arg ; func:seconds-from-time( ?arg ) )(s) = res
such that res is the result of fn:seconds-from-time(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:years-from-duration( ?arg ) )
The value space of xs:yearMonthDuration for ?arg.
I_{external}( ?arg ; func:years-from-duration( ?arg ) )(s) = res
such that res is the result of fn:years-from-duration(s) as defined in [XPath-Functions].
( ?arg ; func:months-from-duration( ?arg ) )
The value space of xs:yearMonthDuration for ?arg.
I_{external}( ?arg ; func:months-from-duration( ?arg ) )(s) = res
such that res is the result of fn:months-from-duration(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:days-from-duration( ?arg ) )
The value space of xs:dayTimeDuration for ?arg.
I_{external}( ?arg ; func:days-from-duration( ?arg ) )(s) = res
such that res is the result of fn:days-from-duration(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:hours-from-duration( ?arg ) )
The value space of xs:dayTimeDuration for ?arg.
I_{external}( ?arg ; func:hours-from-duration( ?arg ) )(s) = res
such that res is the result of fn:hours-from-duration(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:minutes-from-duration( ?arg ) )
The value space of xs:dayTimeDuration for ?arg.
I_{external}( ?arg ; func:minutes-from-duration( ?arg ) )(s) = res
such that res is the result of fn:minutes-from-duration(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:seconds-from-duration( ?arg ) )
The value space of xs:dayTimeDuration for ?arg.
I_{external}( ?arg ; func:seconds-from-duration( ?arg ) )(s) = res
such that res is the result of fn:seconds-from-duration(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?arg ; func:timezone-from-dateTime( ?arg ) )
The value space of xs:dateTimeStamp.
I_{external}( ?arg ; func:timezone-from-dateTime( ?arg ) )(s) = res
such that res is the result of fn:timezone-from-dateTime(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified. Note that RIF restricts the domain of this function to xs:dateTimeStamp instead of xs:dateTime, i.e. RIF leaves the return value for xs:dateTime values without a timezone unspecified.
The following two functions are defined analogously for domains xs:date and xs:time
( ?arg ; func:timezone-from-date( ?arg ) )
The values of value space xs:date with a timezone component.
I_{external}( ?arg ; func:timezone-from-date( ?arg ) )(s) = res
such that res is the result of fn:timezone-from-date(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified. Note that RIF restricts the domain of this function to xs:date values with a timezone component, i.e. RIF leaves the return value for xs:date values without a timezone unspecified.
( ?arg ; func:timezone-from-time( ?arg ) )
The values of value space xs:time with a timezone component.
I_{external}( ?arg ; func:timezone-from-time( ?arg ) )(s) = res
such that res is the result of fn:timezone-from-time(s) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified. Note that RIF restricts the domain of this function to xs:time values with a timezone component, i.e. RIF leaves the return value for xs:time values without a timezone unspecified.
( ?arg_{1} ?arg_{2}; func:subtract-dateTimes( ?arg_{1} ?arg_{2} ) )
The value space of xs:dateTimeStamp for both arguments.
I_{external}( ?arg_{1} ?arg_{2}; func:subtract-dateTimes( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:subtract-dateTimes(s_{1} s_{2}) as defined in [XPath-Functions].
If the argument value is outside of its domain, the value of the function is left unspecified. Note that RIF restricts the domain of this function to xs:dateTimeStamps instead of xs:dateTime, i.e. RIF leaves the return value for xs:dateTime arguments values without a timezone unspecified.
( ?arg_{1} ?arg_{2}; func:subtract-dates( ?arg_{1} ?arg_{2} ) )
The value space of xs:date with given timezone for both arguments.
I_{external}( ?arg_{1} ?arg_{2}; func:subtract-dates( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:subtract-dates(s_{1} s_{2}) as defined in [XPath-Functions].
If any argument value is outside of its domain, the value of the function is left unspecified. Note that RIF restricts the domain of this function to xs:dates with explicit timezone, i.e. RIF leaves the return value for xs:date arguments values without a timezone unspecified.
( ?arg_{1} ?arg_{2}; func:subtract-times( ?arg_{1} ?arg_{2} ) )
The value space of xs:time with given timezone for both arguments.
I_{external}( ?arg_{1} ?arg_{2}; func:subtract-times( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:subtract-times(s_{1} s_{2}) as defined in [XPath-Functions].
If any argument value is outside of its domain, the value of the function is left unspecified. Note that RIF restricts the domain of this function to xs:times with explicit timezone, i.e. RIF leaves the return value for xs:date arguments values without a timezone unspecified.
( ?arg_{1} ?arg_{2}; func:add-yearMonthDurations( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:yearMonthDuration for both ?arg_{1} and ?arg_{2} such that fn:add-yearMonthDurations does not result in a duration operation overflow/underflow error err:FODT0002 or in a value from the xs:yearMonthDuration value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:add-yearMonthDurations( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:add-yearMonthDurations(s_{1} s_{2}) as defined in [XPath-Functions].
If any argument value is outside of its domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; func:subtract-yearMonthDurations( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:yearMonthDuration for both ?arg_{1} and ?arg_{2} such that fn:subtract-yearMonthDurations does not result in a duration operation overflow/underflow error err:FODT0002 or in a value from the xs:yearMonthDuration value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:subtract-yearMonthDurations( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:subtract-yearMonthDurations(s_{1} s_{2}) as defined in [XPath-Functions].
If any argument value is outside of its domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; func:multiply-yearMonthDuration( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:yearMonthDuration for ?arg_{1} and xs:integer, xs:double, xs:float, or xs:decimal for ?arg_{2} such that fn:multiply-yearMonthDuration does not result in a duration operation overflow/underflow error err:FODT0002, NaN supplied as double value error err:FOCA0005, or in a value from the xs:yearMonthDuration value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:multiply-yearMonthDuration( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:multiply-yearMonthDuration(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:divide-yearMonthDuration( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:yearMonthDuration for ?arg_{1} and xs:integer, xs:double, xs:float, or xs:decimal for ?arg_{2} such that fn:divide-yearMonthDuration does not result in a duration operation overflow/underflow error err:FODT0002, NaN supplied as double value error err:FOCA0005, or in a value from the xs:yearMonthDuration value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:divide-yearMonthDuration( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:divide-yearMonthDuration(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; func:divide-yearMonthDuration-by-yearMonthDuration( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:yearMonthDuration for both ?arg_{1} and ?arg_{2} such that fn:divide-yearMonthDuration-by-yearMonthDuration does not result in a duration operation overflow/underflow error err:FODT0002 or in a value from the xs:yearMonthDuration value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:divide-yearMonthDuration-by-yearMonthDuration( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:divide-yearMonthDuration-by-yearMonthDuration(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; func:add-dayTimeDurations( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value space of xs:dayTimeDuration for ?arg_{1} and ?arg_{2} such that fn:add-dayTimeDurations does not result in a duration operation overflow/underflow error err:FODT0002 or in a value from the xs:dayTimeDuration value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:add-dayTimeDurations( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:add-dayTimeDurations(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; func:subtract-dayTimeDurations( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value space of xs:dayTimeDuration for ?arg_{1} and ?arg_{2} such that fn:subtract-dayTimeDurations does not result in a duration operation overflow/underflow error err:FODT0002 or in a value from the xs:dayTimeDuration value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:subtract-dayTimeDurations( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:subtract-dayTimeDurations(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; func:multiply-dayTimeDuration( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:dayTimeDuration for ?arg_{1} and xs:integer, xs:double, xs:float, or xs:decimal for ?arg_{2} such that fn:multiply-dayTimeDuration does not result in a duration operation overflow/underflow error err:FODT0002, NaN supplied as double value error err:FOCA0005, or in a value from the xs:dayTimeDuration value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:multiply-dayTimeDuration( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:multiply-dayTimeDuration(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:divide-dayTimeDuration( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:dayTimeDuration for ?arg_{1} and xs:integer, xs:double, xs:float, or xs:decimal for ?arg_{2} such that fn:divide-dayTimeDuration does not result in a duration operation overflow/underflow error err:FODT0002, NaN supplied as double value error err:FOCA0005, or in a value from the xs:dayTimeDuration value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:divide-dayTimeDuration( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:divide-dayTimeDuration(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; func:divide-dayTimeDuration-by-dayTimeDuration( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:dayTimeDuration for both ?arg_{1} and ?arg_{2} such that fn:divide-dayTimeDuration-by-dayTimeDuration does not result in a duration operation overflow/underflow error err:FODT0002 or in a value from the xs:dayTimeDuration value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:divide-dayTimeDuration-by-dayTimeDuration( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:divide-dayTimeDuration-by-dayTimeDuration(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:add-yearMonthDuration-to-dateTime( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:dateTime for ?arg_{1} and xs:yearMonthDuration for ?arg_{2} such that fn:add-yearMonthDuration-to-dateTime does not result in a date/time operation overflow/underflow error err:FODT0001 or in a value from the xs:dateTime value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:add-yearMonthDuration-to-dateTime( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:add-yearMonthDuration-to-dateTime(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:add-yearMonthDuration-to-date( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:date for ?arg_{1} and xs:yearMonthDuration for ?arg_{2} such that fn:add-yearMonthDuration-to-date does not result in a date/time operation overflow/underflow error err:FODT0001 or in a value from the xs:date value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:add-yearMonthDuration-to-date( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:add-yearMonthDuration-to-date(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:add-dayTimeDuration-to-dateTime( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:dateTime for ?arg_{1} and xs:dayTimeDuration for ?arg_{2} such that fn:add-dayTimehDuration-to-dateTime does not result in a date/time operation overflow/underflow error err:FODT0001 or in a value from the xs:dateTime value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:add-dayTimeDuration-to-dateTime( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:add-dayTimeDuration-to-dateTime(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:add-dayTimeDuration-to-date( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:date for ?arg_{1} and xs:dayTimeDuration for ?arg_{2} such that fn:add-dayTimehDuration-to-date does not result in a date/time operation overflow/underflow error err:FODT0001 or in a value from the xs:date value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:add-dayTimeDuration-to-date( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:add-dayTimeDuration-to-date(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:add-dayTimeDuration-to-time( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:time for ?arg_{1} and xs:dayTimeDuration for ?arg_{2} such that fn:add-dayTimehDuration-to-time does not result in a date/time operation overflow/underflow error err:FODT0001 or in a value from the xs:time value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:add-dayTimeDuration-to-time( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:add-dayTimeDuration-to-time(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:subtract-yearMonthDuration-from-dateTime( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:dateTime for ?arg_{1} and xs:yearMonthDuration for ?arg_{2} such that fn:subtract-yearMonthDuration-from-dateTime does not result in a date/time operation overflow/underflow error err:FODT0001 or in a value from the xs:dateTime value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:subtract-yearMonthDuration-from-dateTime( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:subtract-yearMonthDuration-from-dateTime(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:subtract-yearMonthDuration-from-date( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:date for ?arg_{1} and xs:yearMonthDuration for ?arg_{2} such that fn:subtract-yearMonthDuration-from-date does not result in a date/time operation overflow/underflow error err:FODT0001 or in a value from the xs:date value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:subtract-yearMonthDuration-from-date( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:subtract-yearMonthDuration-from-date(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:subtract-dayTimeDuration-from-dateTime( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:dateTime for ?arg_{1} and xs:dayTimeDuration for ?arg_{2} such that fn:subtract-dayTimehDuration-from-dateTime does not result in a date/time operation overflow/underflow error err:FODT0001 or in a value from the xs:dateTime value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:subtract-dayTimeDuration-from-dateTime( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:subtract-dayTimeDuration-from-dateTime(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:subtract-dayTimeDuration-from-date( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:date for ?arg_{1} and xs:dayTimeDuration for ?arg_{2} such that fn:subtract-dayTimehDuration-from-date does not result in a date/time operation overflow/underflow error err:FODT0001 or in a value from the xs:date value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:subtract-dayTimeDuration-from-date( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:subtract-dayTimeDuration-from-date(s_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2} ; func:subtract-dayTimeDuration-from-time( ?arg_{1} ?arg_{2} ) )
The domain of this functions is made up of pairs of values from value spaces of xs:time for ?arg_{1} and xs:dayTimeDuration for ?arg_{2} such that fn:subtract-dayTimehDuration-from-time does not result in a date/time operation overflow/underflow error err:FODT0001 or in a value from the xs:time value space outside what minimal conformance as defined in Section 5.4 of [XML Schema Datatypes] requires for durations.
I_{external}( ?arg_{1} ?arg_{2}; func:subtract-dayTimeDuration-from-time( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = res
such that res is the result of fn:subtract-dayTimeDuration-from-Time_{1} s_{2}) as defined in [XPath-Functions].
If the arguments are outside of the domain, the value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:dateTime-equal( ?arg_{1} ?arg_{2}) )
The value space of xs:dateTime for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:dateTime-equal( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:dateTime-equal(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:dateTime-less-than(?arg_{1} ?arg_{2} ) )
The value space of xs:dateTime for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:dateTime-less-than( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:dateTime-less-than(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:dateTime-greater-than(?arg_{1} ?arg_{2} ) )
The value space of xs:dateTime for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:dateTime-greater-than( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:dateTime-greater-than(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:date-equal( ?arg_{1} ?arg_{2}) )
The value space of xs:date for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:date-equal( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:date-equal(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:date-less-than(?arg_{1} ?arg_{2} ) )
The value space of xs:date for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:date-less-than( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:date-less-than(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:date-greater-than(?arg_{1} ?arg_{2} ) )
The value space of xs:date for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:date-greater-than( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:date-greater-than(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:time-equal( ?arg_{1} ?arg_{2}) )
The value space of xs:time for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:time-equal( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:time-equal(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:time-less-than(?arg_{1} ?arg_{2} ) )
The value space of xs:time for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:time-less-than( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:time-less-than(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:time-greater-than(?arg_{1} ?arg_{2} ) )
The value space of xs:time for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:time-greater-than( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:time-greater-than(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:duration-equal( ?arg_{1} ?arg_{2}) )
The union of the value spaces of xs:dayTimeDuration and xs:yearMonthDuration for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:duration-equal( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:duration-equal(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:dayTimeDuration-less-than(?arg_{1} ?arg_{2} ) )
The value space of xs:dayTimeDuration for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:dayTimeDuration-less-than( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:dayTimeDuration-less-than(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:dayTimeDuration-greater-than(?arg_{1} ?arg_{2} ) )
The value space of xs:dayTimeDuration for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:dayTimeDuration-greater-than( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:dayTimeDuration-greater-than(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:yearMonthDuration-less-than(?arg_{1} ?arg_{2} ) )
The value space of xs:yearMonthDuration for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:yearMonthDuration-less-than( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:yearMonthDuration-less-than(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
( ?arg_{1} ?arg_{2}; pred:yearMonthDuration-greater-than(?arg_{1} ?arg_{2} ) )
The value space of xs:yearMonthDuration for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:yearMonthDuration-greater-than( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if op:yearMonthDuration-greater-than(s_{1}, s_{2}) returns true, as defined in [XPath-Functions], f in case false is returned.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
(?arg_{1} ?arg_{2}; pred:dateTime-not-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:dateTime-not-equal has the same domains as pred:dateTime-equal and is true whenever pred:dateTime-equal is false.
(?arg_{1} ?arg_{2}; pred:dateTime-less-than-or-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:dateTime-less-than-or-equal has the same domains as pred:dateTime-equal and is true whenever pred:dateTime-equal is true or pred:dateTime-less-than is true.
(?arg_{1} ?arg_{2}; pred:dateTime-greater-than-or-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:dateTime-greater-than-or-equal has the same domains as pred:dateTime-equal and is true whenever pred:dateTime-equal is true or pred:dateTime-greater-than is true.
(?arg_{1} ?arg_{2}; pred:date-not-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:date-not-equal has the same domains as pred:date-equal and is true whenever pred:date-equal is false.
(?arg_{1} ?arg_{2}; pred:date-less-than-or-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:date-less-than-or-equal has the same domains as pred:date-equal and is true whenever pred:date-equal is true or pred:date-less-than is true.
(?arg_{1} ?arg_{2}; pred:date-greater-than-or-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:date-greater-than-or-equal has the same domains as pred:date-equal and is true whenever pred:date-equal is true or pred:date-greater-than is true.
(?arg_{1} ?arg_{2}; pred:time-not-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:time-not-equal has the same domains as pred:time-equal and is true whenever pred:time-equal is false.
(?arg_{1} ?arg_{2}; pred:time-less-than-or-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:time-less-than-or-equal has the same domains as pred:time-equal and is true whenever pred:time-equal is true or pred:time-less-than is true.
(?arg_{1} ?arg_{2}; pred:time-greater-than-or-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:time-greater-than-or-equal has the same domains as pred:time-equal and is true whenever pred:time-equal is true or pred:time-greater-than is true.
(?arg_{1} ?arg_{2}; pred:duration-not-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:duration-equal has the same domains as pred:duration-equal and is true whenever pred:duration-equal is false.
(?arg_{1} ?arg_{2}; pred:dayTimeDuration-less-than-or-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:dayTimeDuration-less-than-or-equal has the same domains as pred:dayTimeDuration-less-than and is true whenever pred:duration-equal is true or pred:dayTimeDuration-less-than is true.
(?arg_{1} ?arg_{2}; pred:dayTimeDuration-greater-than( ?arg_{1} ?arg_{2}) )
The predicate pred:dayTimeDuration-greater-than-or-equal has the same domains as pred:dayTimeDuration-greater-than and is true whenever pred:duration-equal is true or pred:dayTimeDuration-greater-than is true.
(?arg_{1} ?arg_{2}; pred:yearMonthDuration-less-than-or-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:yearMonthDuration-less-than-or-equal has the same domains as pred:yearMonthDuration-less-than and is true whenever pred:duration-equal is true or pred:yearMonthDuration-less-than is true.
(?arg_{1} ?arg_{2}; pred:yearMonthDuration--greater-than( ?arg_{1} ?arg_{2}) )
The predicate pred:yearMonthDuration-greater-than-or-equal has the same domains as pred:yearMonthDuration-greater-than and is true whenever pred:duration-equal is true or pred:yearMonthDuration-greater-than is true.
( ?arg_{1} ?arg_{2}; pred:XMLLiteral-equal( ?arg_{1} ?arg_{2}) )
The value space of rdf:XMLLiteral for both arguments.
When both s_{1} and s_{2} belong to their domains, I_{truth} ο I_{external}( ?arg_{1} ?arg_{2}; pred:XMLLiteral-equal( ?arg_{1} ?arg_{2} ) )(s_{1} s_{2}) = t
if and only if s_{1} = s_{2}, f otherwise.
If an argument value is outside of its domain, the truth value of the function is left unspecified.
(?arg_{1} ?arg_{2}; pred:XMLLiteral-not-equal( ?arg_{1} ?arg_{2}) )
The predicate pred:time-not-equal has the same domains as pred:XMLLiteral-equal and is true whenever pred:XMLLiteral-equal is false.
The following functions and predicates are adapted from the respective functions and operators in [RDF-PLAINLITERAL].
(?arg_{1} ?arg_{2} ; func:PlainLiteral-from-string-lang( ?arg_{1} ?arg_{2} ) )
The value space of xs:string for ?arg_{1} and the intersection of the elements of the value space of xs:string which represent valid language tags according to [BCP-47] for ?arg_{2}.
I_{external}((?arg_{1} ?arg_{2} ; func:PlainLiteral-from-string-lang( ?arg_{1} ?arg_{2} ) )(s l) = res such that res is the pair < s, l > in the value space of rdf:PlainLiteral.
If any argument value is outside of its domain, the value of the function is left unspecified.
(?arg ; func:string-from-PlainLiteral( ?arg ) )
The value space of rdf:PlainLiteral for ?arg.
I_{external}(?arg ; func:string-from-PlainLiteral( ?arg ) )(t) = res such that res is the string part s of t if t is a pair < s, l > or res = t if t is a string value.
If the argument value is outside of its domain, the value of the function is left unspecified.
(?arg ; func:lang-from-PlainLiteral( ?arg ) )
The value space of rdf:PlainLiteral for ?arg.
I_{external}(?arg ; func:lang-from-PlainLiteral( ?arg ) )(t) = l such that l is the language tag string of t if t is a pair < s, l > and ""^^xs:string if t is a string value.
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?comparand_{1} ?comparand_{2}; func:PlainLiteral-compare(?comparand_{1} ?comparand_{2}) )
( ?comparand_{1} ?comparand_{2} ?collation; func:PlainLiteral-compare(?comparand_{1} ?comparand_{2} ?collation) )
The value space of rdf:PlainLiteral for ?comparand_{1} and $comparand_{2}, and the empty set for ?collation.
I_{external}( ?comparand_{1} ?comparand_{2}; func:PlainLiteral-compare(?comparand_{1} ?comparand_{2}) )(t_{1} t_{2}) = res such that, whenever t_{1}=( s_{1}, l ) and t_{2}=( s_{2}, l ) are two pairs with the same language tag l in the value space ofrdf:PlainLiteral, or two string values t_{1}=s_{1} and t_{2}=s_{2}, respectively, then res = -1, 0, or 1 (from the value space of xs:integer), depending on whether the value of s_{1} is respectively less than, equal to, or greater than the value of s_{2} according to the default codepoint collation as defined in Section 7.3.1 of [XPath-Functions].
In case an argument value is outside of its domain, or if the language tags of the values for ?comparand_{1} and $comparand_{2} differ, the function value is left unspecified. That means RIF does not prescribe any specific collation apart from the default codepoint collation and - consequently - the result of this function with a given collation argument is not defined by RIF and may vary between implementations.
( ?arg ; func:PlainLiteral-length( ?arg ) )
The value space of rdf:PlainLiteral for ?arg.
I_{external}( ?arg ; func:PlainLiteral-length( ?arg ) )(s) = res such that res is a value in the value space of xs:integer equal to the length in characters of the string part s of the argument if it is a pair ( s,l ), or the argument is a string value s, respectively.
If the argument value is outside of its domain, the value of the function is left unspecified.
( ?input ?range; pred:matches-language-range( ?input ?range) )
The value space of rdf:PlainLiteral for ?input and the values of value space xs:string that correspond to valid language tags according to [BCP-47] for ?range.
Whenever both arguments are within their domains, <p>I_{external} ( ?input ?range; pred:matches-language-range( ?input ?range) )(i r) = t if and only if plfn:matches-language-range(i r) as specified in [RDF-PLAINLITERAL] returns true, f otherwise.
If an argument value is outside of its domain, the truth value of the predicate is left unspecified.
RIF Lists are similar to list and array types in many systems, as well as XPath/XQuery Sequences [XPath-Functions]. They differ from XPath as follows:
The positions in a list are numbered starting with zero. That is, in a list of length n+1, the first item has position 0, and the last item has position n. When a negative position number is provided to a builtin, the length of the list is added to it before it is used, so it effectively counts backward from the end of the list: position -1 points to the last item in the list, i.e. corresponds effectively to position n, etc.
List items are compared for equality (as required by many of these builtins) using normal RIF equality testing, not datatype equality (e.g., pred:numeric-equal).
Several list builtins need to establish inequality in order to compute a result. If all the compared items are literals or lists, this is not a problem, but if they are rif:local or rif:iri terms, the knowledge base is unlikely to contain inequality information. This may lead to counter-intuitive results. For example, the empty ruleset does not entail External(func:index-of( List(ex:foo ex:bar) ex:foo) ) == List(0), because the empty ruleset provides no indication whether eg:foo = eg:bar.
(?object; pred:is-list(?object))
?object: unrestricted
I_{truth} ο I_{external}( ?object; pred:is-list ( ?object ) )(s) = t if and only if there exists some (t_{0}, ... , t_{n}) such that either I_{list}(t_{0} ... t_{n}) = s or I_{tail}(t_{0}, ... , t_{n}) = s, and f otherwise.
Note, that since the syntactic forms of open and closed lists using the List operator refer to I_{list}^{-1} and I_{tail}^{-1}, respectively, pred:is-list is always true on these syntactic forms. Further note that per definition I_{list}(D_{ind}) is disjoint from the value spaces of all data types in DTS, and consequently pred:is-list is always false on constants belonging to a datatype supported by the RIF dialect at hand. this is illustrated by the following examples.
(?list ?item; pred:list-contains(?list ?item))
?list: D_{list}
?item: unrestricted
I_{truth} ο I_{external}( ?list ?item; pred:list-contains ( ?list ?item ) )(l s) = t if and only if I_{list}^{-1}(l) = (t_{0} ... t_{n}) such that t_{i} = s for some i between 0 and n, and f otherwise.
If an argument value is outside of its domain, the value of the function is left unspecified.
(?item_{1} ... ?item_{n}; func:make-list(?item_{1} ... ?item_{n}))
?item0: unrestricted
...
?itemn: unrestricted
Returns a list of the arguments ?item_{1}, ... ?item_{n}, in the same order they appear as arguments. That is, I_{external}( ?item_{1} ... ?item_{n}; func:make-list( ?item_{1} ... ?item_{n} ) )(s_{1} ... s_{n}) = I_{list}(s_{1} ... s_{n})
This function is useful in RIF Core because the List construction operator is syntactically prohibited from being used with variables.
External( func:make-list(0 1 2) ) = List(0 1 2) External( func:make-list() ) = List() External( func:make-list(0) ) = List(0) External( func:make-list(0 1 List(20 21))) = List(0 1 List(20 21)) External( func:make-list(List(0 1))) = List(List(0 1))
(?list; func:count(?list))
?list: D_{list}
Returns the number of entries in the list (the length of the list). That is, I_{external}( ?list; func:count( ?list ) )(l) = n if I_{list}^{-1}(l) = (t_{0} ... t_{n-1}) is an element of D_{ind}^{n}.
If an argument value is outside of its domain, the value of the function is left unspecified.
External(func:count(List(0 1 2 3 4))) = 5 External(func:count(List(0))) = 1 External(func:count(List(0 0 0))) = 3 External(func:count(List())) = 0
(?list ?position; func:get(?list ?position))
?list: D_{list}
?position: value space of xs:int
Returns the item at the given position in the list. That is, I_{external}( ?list ?position; func:get(?list ?position) )(l i) = t_{i} if I_{list}^{-1}(l) = (t_{0} ... t_{n}) and i corresponds to a position between 0 and n, as defined in Section Position Numbering.
If an argument value is outside of its domain or i does not correspond to a position between 0 and n as described in Section Position Numbering the value of the function is left unspecified.
External( func:get(List(0 1 2 3 4) 0) ) = 0 External( func:get(List(0 1 2 3 4) 1) ) = 1 External( func:get(List(0 1 2 3 4) 4) ) = 4 External( func:get(List(0 1 2 3 4) -1) ) = 4 External( func:get(List(0 1 2 3 4) -5) ) = 0 External( func:get(List(0 1 2 3 4) -10) ) = (unspecified) External( func:get(List(0 1 2 3 4) 5) ) = (unspecified)
(?list ?start ?stop; func:sublist(?list ?start ?stop))
(?list ?start; func:sublist(?list ?start))
?list: D_{list}
?start: value space of xs:int
?stop: value space of xs:int
Returns a list, containing (in order) the items starting at position '?start' and continuing up to, but not including, the '?stop' position, if '?start' is before '?stop'. The '?stop' position may be omitted, in which case it defaults to the length of the list. That is, I_{external}( ?list ?start ?stop; func:sublist(?list ?start ?stop) )(l i j) = I_{list}(t_{i} ... t_{j}) if I_{list}^{-1}(l) = (t_{0} ... t_{n}) such that i and j correspond to positions between 0 and n, as defined in Section Position Numbering. In case i is omitted it defaults to n.
If an argument value is outside of its domain or, respectively, i and j do not correspond to positions between 0 and n such that the corresponding position of i is smaller than the corresponding position of j, as described in Section Position Numbering the value of the function is left unspecified.
This differs from XPath's fn:subsequence function in using a 'stop' position parameter instead of a 'length' parameter (in addition to the name change, the zero-based indexing, and allowing negative indexes).
External( func:sublist(List(0 1 2 3 4) 0 0) ) = List() External( func:sublist(List(0 1 2 3 4) 0 1) ) = List(0) External( func:sublist(List(0 1 2 3 4) 0 4) ) = List(0 1 2 3) External( func:sublist(List(0 1 2 3 4) 0 5) ) = List(0 1 2 3 4) External( func:sublist(List(0 1 2 3 4) 0 10) ) = List(0 1 2 3 4) External( func:sublist(List(0 1 2 3 4) 0 -2) ) = List(0 1 2) External( func:sublist(List(0 1 2 3 4) 2 4) ) = List(2 3) External( func:sublist(List(0 1 2 3 4) 2 -2) ) = List(2) External( func:sublist(List(0 1 2 3 4) 0) ) = List(0 1 2 3 4) External( func:sublist(List(0 1 2 3 4) 3) ) = List(3 4) External( func:sublist(List(0 1 2 3 4) -2) ) = List(3 4)
(?list ?item_{1} ... ?item_{n}; func:append(?list ?item_{1} ... ?item_{n}))
?list: D_{list}
?item_{1}: unrestricted
...
?item_{n}: unrestricted
Returns a list consisting of all the items in ?list, followed by ?item_{i}, for each i, 1 <= i <= n. That is, I_{external}( ?list ?item_{1} ... ?item_{n}; func:append(?list ?item_{1} ... ?item_{n}) )(l s_{1} ... s_{n}) = I_{list}(t_{0} ... t_{k} s_{1} ... s_{n}) if I_{list}^{-1}(l) = (t_{0} ... t_{k}).
If an argument value is outside of its domain, the value of the function is left unspecified.
External( func:append(List(0 1 2) 3) )= List(0 1 2 3) External( func:append(List(0 1 2) 3 4) ) = List(0 1 2 3 4) External( func:append(List(1 1) List(1) List(1) List(List(1))) ) = List(1 1 List(1) List(1) List(List(1))) External( func:append(List() 1) ) = List(1)
(?list_{1} ... ?list_{n}; func:concatenate(?list_{1} ... ?list_{n}))
Returns a list consisting of all the items in list_{1}, followed by all the items in list_{i}, for each i <= n. That is, I_{external}( ?list_{1} ... ?list_{n}; func:concatenate(?list_{1} ... ?list_{n}) )(l_{1} ... l_{n}) = I_{list}(t_{1,0} ... t_{1,k1} ... t_{n,0} ... t_{n,kn}) if, for each i between 1 and n, I_{list}^{-1}(l_{i}) = (t_{i,0} ... t_{i,ki}).
If an argument value is outside of its domain, the value of the function is left unspecified.
External( func:concatenate(List(0 1 2) List(3 4 5)) ) = List(0 1 2 3 4 5) External( func:concatenate(List(1 1) List(1) List(1)) ) = List(1 1 1 1) External( func:concatenate(List())) = List() External( func:concatenate(List() List(1) List() List(2)) ) = List(1 2)
(?list ?position ?newItem; func:insert-before(?list ?position ?newItem))
?list: D_{list}
?position: value space of xs:int
?newItem: unrestricted
Return a list which is ?list, except that ?newItem is inserted at the given ?position, with the item (if any) that was at that position, and all following items, shifted down one position. That is, I_{external}( ?list ?position ?newItem; func:insert-before(?list ?position ?newItem) )(l i s) = I_{list}(t_{0} ... t_{i-1} s t_{i} ... t_{n}) if I_{list}^{-1}(l) = (t_{0} ... t_{n}) and i corresponds to a position between 0 and n, as defined in Section Position Numbering.
If an argument value is outside of its domain or i does not correspond to a position between 0 and n as described in Section Position Numbering the value of the function is left unspecified.
External( func:insert-before(List(0 1 2 3 4) 0 99) ) = List(99 0 1 2 3 4) External( func:insert-before(List(0 1 2 3 4) 1 99) ) = List(0 99 1 2 3 4) External( func:insert-before(List(0 1 2 3 4) 5 99) ) = (unspecified) External( func:insert-before(List(0 1 2 3 4) -1 99) ) = List(0 1 2 3 99 4) External( func:insert-before(List(0 1 2 3 4) -5 99) ) = List(99 0 1 2 3 4) External( func:insert-before(List(0 1 2 3 4) -10 99) ) = (unspecified)
(?list ?position; func:remove(?list ?position))
?list: D_{list}
?position: value space of xs:int
Returns a list which is ?list except that the item at the given ?position has been removed. That is, I_{external}( ?list ?position; func:remove(?list ?position) )(l i) = I_{list}(t_{0} ... t_{i-1} t_{i+1} ... t_{n}) if I_{list}^{-1}(l) = (t_{0} ... t_{n}) and i corresponds to a position between 0 and n, as defined in Section Position Numbering.
If an argument value is outside of its domain or i does not correspond to a position between 0 and n as described in Section Position Numbering the value of the function is left unspecified.
External( func:remove(List(0 1 2 3 4) 0) ) = List(1 2 3 4) External( func:remove(List(0 1 2 3 4) 1) ) = List(0 2 3 4) External( func:remove(List(0 1 2 3 4) 4) ) = List(0 1 2 3) External( func:remove(List(0 1 2 3 4) 5) ) = (unspecified) External( func:remove(List(0 1 2 3 4) 6) ) = (unspecified) External( func:remove(List(0 1 2 3 4) -1) ) = List(0 1 2 3) External( func:remove(List(0 1 2 3 4) -5) ) = List(1 2 3 4) External( func:remove(List(0 1 2 3 4) -6) ) = (unspecified)
(?list; func:reverse(?list))
?list: D_{list}
Return a list with all the items in ?list, but in reverse order. That is, I_{external}( ?list; func:reverse(?list) )(l) = I_{list}(t_{n} ... t_{0}) if I_{list}^{-1}(l) = (t_{0} ... t_{n}).
If the argument value is outside of its domain, the value of the function is left unspecified.
External( func:reverse(List(0 1 2 3 4)) ) = List(4 3 2 1 0) External( func:reverse(List(1)) ) = List(1) External( func:reverse(List()) ) = List()
(?list ?matchValue; func:index-of(?list ?matchValue))
?list: D_{list}
?matchValue: unrestricted
Returns the ascending list of all integers, i>=0, such that External( func:get(?list,i) ) = ?matchValue. That is, I_{external}(?list ?matchValue; func:index-of(?list ?matchValue))(l v) = I_{list}(i_{1} ... i_{k}) if I_{list}^{-1}(l) = (t_{0} ... t_{n}) such that (i_{1} ... i_{k}) is the ordered list of positions (as defined in Section Position Numbering) between 0 and n with t_{i1} = ... = t_{ik} = v.
If an argument value is outside of its domain, the value of the function is left unspecified.
External( func:index-of(List(0 1 2 3 4) 2) ) = List(2) External( func:index-of(List(0 1 2 3 4 5 2 2) 2) ) = List(2 6 7) External( func:index-of(List(2 2 3 4 5 2 2) 2) ) = List(0 1 5 6) External( func:index-of(List(2 2 3 4 5 2 2) 1) ) = List()
(?list_{1} ... ?list_{n}; func:union(?list_{1} ... ?list_{n}))
Returns a list containing all the items in ?list_{1}, ..., ?list_{n}, in the same order, but with all duplicates removed.
If an argument value is outside of its domain, the value of the function is left unspecified.
External( func:union(list_{1} ... list_{n}) ) is equivalent to External( func:distinct_values(External( func:concatenate(list_{1} ... list_{n}) ) ) ).
External( func:union(List(0 1 2 4) List(3 4 5 6)) ) = List(0 1 2 4 3 5 6) External( func:union(List(0 1 2 3) List(4)) ) = List(0 1 2 3 4) External( func:union(List(0 1 2 3) List(3)) ) = List(0 1 2 3)External( func:union(List(0 2 1 0)) ) = List( 0 2 1 )
(?list; func:distinct-values(?list))
?list: D_{list}
Returns a list which contains exactly those items which are in ?list, in the order of first appearance, except that all except the first occurance of any item are deleted.
If an argument value is outside of its domain, the value of the function is left unspecified.
External( func:distinct-values(List(0 1 2 3 4)) ) = List(0 1 2 3 4) External( func:distinct-values(List(0 1 2 3 4 0 4)) ) = List(0 1 2 3 4) External( func:distinct-values(List(3 3 3)) ) = List(3)
(?list_{1} ... ?list_{n}; func:intersect(?list_{1} ... ?list_{n}))
Returns a list which contains exactly those items which are common to all argument lists. The order of the items in the returned list is the same as the order in ?list_{1}.
If an argument value is outside of its domain, the value of the function is left unspecified.
External( func:intersect(List(0 1 2 3 4) List(1 3)) ) = List(1 3) External( func:intersect(List(0 1 2 3 4) List(3 1)) ) = List(1 3) External( func:intersect(List(0 1 2 3 4) List()) ) = List() External( func:intersect(List(0 1 2 3 4) List(0 1 2 3 4 5 6)) ) = List(0 1 2 3 4)
(?list_{1} ?list_{2}; func:except(?list_{1} ?list_{2}))
Returns a list which contains exactly those items which are in ?list_{1} and not in ?list_{2}. The order of the items is the same as in ?list_{1}.
If an argument value is outside of its domain, the value of the function is left unspecified.
External( func:except(List(0 1 2 3 4) List(1 3)) ) = List(0 2 4) External( func:except(List(0 1 2 3 4) List()) ) = List(0 1 2 3 4) External( func:except(List(0 1 2 3 4) List(0 1 2 3 4)) ) = List()
The RIF Framework for Logic Dialects introduces a general notion of externally defined terms and their schemes. However, RIF-BLD and the present document use only restricted kinds of external terms. To make this document self-contained, this appendix provides a complete description of these restricted notions.
In RIF-FLD, an external term is an expression of the form External(id τ), where id is a term that identifies the source that defines the term τ and τ itself can be a constant, a positional or named-arguments term, a frame, an equality, or a classification term. In RIF-BLD, only positional and named-argument terms are allowed as τ, and RIF-DTB builtins can only be positional terms. So, only a restricted kind of external terms is used: External(τ), where τ has one of the aforementioned forms. If τ is a term of the form p(...) then External(τ) is treated as a shorthand for External(p τ), but this extended 2-argument form of External itself is not allowed in RIF-BLD.
External schemas serve as templates for externally defined terms. These schemas determine which externally defined terms are acceptable in a RIF dialect. Externally defined terms include RIF built-ins, but are more general. They are designed to also accommodate the ideas of procedural attachments and querying of external data sources.
Definition (Schema for external term). An external schema is a statement of the form (?X_{1} ... ?X_{n}; τ) where
The names of the variables in an external schema are immaterial, but their order is important. For instance, (?X ?Y; ?X[foo->?Y]) and (?V ?W; ?V[foo->?W]) are considered to be indistinguishable, but (?X ?Y; ?X[foo->?Y]) and (?Y ?X; ?X[foo->?Y]) are viewed as different schemas.
Note that RIF-FLD defines external schemas as triples (id; ?X_{1} ... ?X_{n}; τ), where id is the identifying term for the schema's source. However, since RIF-BLD uses a simplified version of externally defined terms in which id is determined by the predicate/function name in τ, the id-part is omitted in the above simplified version of external schemas.
A term t is an instantiation of an external schema (?X_{1} ... ?X_{n}; τ) iff t can be obtained from τ by a simultaneous substitution ?X_{1}/s_{1} ... ?X_{n}/s_{n} of the variables ?X_{1} ... ?X_{n} with terms s_{1} ... s_{n}, respectively. Some of the terms s_{i} can be variables themselves. For example, ?Z[foo->f(a ?P)] is an instantiation of (?X ?Y; ?X[foo->?Y]) by the substitution ?X/?Z ?Y/f(a ?P). ☐
Observe that a variable cannot be an instantiation of an external schema, since τ in the above definition cannot be a variable. It will be seen later that this implies that a term of the form External(?X) is not well-formed in RIF.
The intuition behind the notion of an external schema, such as (?X ?Y; ?X["foo"^^xs:string->?Y]) or (?V; "pred:isTime"^^rif:iri(?V)), is that ?X["foo"^^xs:string->?Y] or "pred:isTime"^^rif:iri(?V) are invocation patterns for querying external sources, and instantiations of those schemas correspond to concrete invocations. Thus, External("http://foo.bar.com"^^rif:iri["foo"^^xs:string->"123"^^xs:integer]) and External("pred:isTime"^^rif:iri("22:33:44"^^xs:time) are examples of invocations of external terms -- one querying an external source and another invoking a built-in.
Definition (Coherent set of external schemas).
A set of external schemas is coherent if there is no term, t, that is an instantiation of two distinct schemas in the set. ☐
The intuition behind this notion is to ensure that any use of an external term is associated with at most one external schema. This assumption is relied upon in the definition of the semantics of externally defined terms. Note that the coherence condition is easy to verify syntactically and that it implies that schemas like (?X ?Y; ?X[foo->?Y]) and (?Y ?X; ?X[foo->?Y]), which differ only in the order of their variables, cannot be in the same coherent set.
It is important to keep in mind that external schemas are not part of the language in RIF, since they do not appear anywhere in RIF statements. Instead, they are best thought of as part of the grammar of the language.