Informational or Testing Functions

This topic describes the functions in that retrieve information from your values and let you ask questions about them or test whether the values match expectations.

  • CONTAINS: Evaluates whether the specified string contains the given pattern.
  • ISBLANK: Evaluates whether the given RDF term is a blank node.
  • ISIRI: Evaluates whether the given RDF term is an IRI.
  • ISLITERAL: Evaluates whether the given RDF term is a literal value.
  • ISNUMERIC: Evaluates whether the given RDF term is a numeric literal value.
  • ISURI: Evaluates whether the given RDF term is a URI.
  • LANG: Returns any language tags that are included with strings.
  • LANGMATCHES: Evaluates whether a string includes a language tag that matches the specified language range.
  • LOCALNAME: Retrieves the local name from the given URI.
  • NAMESPACE: Retrieves the namespace for the specified URI.

Typographical Conventions

The following list describes the conventions used to document function syntax:

  • CAPS: Although SPARQL is case-insensitive, SPARQL keywords in this section are written in uppercase for readability.
  • [ argument ]: Brackets indicate an optional argument or keyword.
  • |: Means OR. Indicates that you can use one or more of the specified options.

CONTAINS

This function evaluates whether the specified strings contain the given pattern.

Syntax

CONTAINS(text, pattern)
Argument Type Description
text string The string value that you want to check against the specified pattern.
pattern string The string pattern that you want to look for in the supplied text.

Returns

Type Description
boolean True if the strings contain the pattern and false if they do not.

ISBLANK

This function evaluates whether the given RDF term value is a blank node. It returns true if it is a blank node or false if it is not.

Syntax

ISBLANK(value)
Argument Type Description
value RDF term The literal, URI, or blank node value to test and determine if it is a blank node.

Returns

Type Description
boolean True if the term is a blank node and false if it is not.

ISIRI

This function evaluates whether the given RDF term type value is an IRI. It returns true if the value is an IRI or false if it is not.

Syntax

ISIRI(term)
Argument Type Description
term RDF term The literal, URI, or blank node value to evaluate whether it is an IRI.

Returns

Type Description
boolean True if the term is an IRI and false if it is not.

ISLITERAL

This function evaluates whether the given RDF term type value is a literal value. It returns true if the value is a literal or false if it is not.

Syntax

ISLITERAL(term)
Argument Type Description
term RDF term The literal, URI, or blank node value to evaluate whether it is a literal.

Returns

Type Description
boolean True if the term is a literal value and false if it is not.

ISNUMERIC

This function evaluates whether the given RDF term type value is a numeric literal. It returns true if the value is a numeric literal or false if it is not.

Syntax

ISNUMERIC(term)
Argument Type Description
term RDF term The literal, URI, or blank node value to evaluate whether it is a numeric literal.

Returns

Type Description
boolean True if the term is a numeric literal and false if it is not.

ISURI

This function evaluates whether the given value is a URI. It returns true if the value is a URI or false if it is not.

Syntax

ISURI(term)
Argument Type Description
term RDF term The literal, URI, or blank node value to evaluate whether it is a URI.

Returns

Type Description
boolean True if the term is a URI and false if it is not.

LANG

This function returns any language tags that are included in the string. The results are grouped by each language tag or by "blank" if a value does not have a language tag.

Syntax

LANG(text)
Argument Type Description
text string The string to search for language tags.

Returns

Type Description
string The found language tags.

LANGMATCHES

This function tests whether a string includes a language tag that matches the specified language range.

Syntax

LANGMATCHES(text, language_range)
Argument Type Description
text string The string to evaluate.
language_range string The language tag to match in the text.

Returns

Type Description
boolean True if strings include a language tag that matches the range and false if they do not.

LOCALNAME

This function retrieves the local name from the given URI.

Syntax

LOCALNAME(uri)
Argument Type Description
uri URI The URI from which to retrieve the local name.

Returns

Type Description
string The local name.

NAMESPACE

This function retrieves the namespace for the given URI.

Syntax

NAMESPACE(uri)
Argument Type Description
uri URI The URI from which to retrieve the namespace.

Returns

Type Description
string The namespace.