Informational or Testing Functions

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

Typographical Conventions

This documentation uses the following conventions in function syntax:

  • CAPS: Although SPARQL is case-insensitive, function names and other keywords are written in uppercase for readability.
  • [ argument ]: Brackets are used to indicate optional arguments. Arguments without brackets are required.

Functions

  • CONTAINS: Evaluates whether the specified string contains the given pattern.
  • GE: Evaluates whether one value is greater than or equal to (>=) another value.
  • GT: Evaluates whether one value is greater than (>) another value.
  • ISBLANK: Evaluates whether the given RDF term is a blank node.
  • ISDATATYPE: Evaluates whether the given literal value is typed as the specified data type.
  • ISERROR: Tests whether the given RDF term evaluates to an error. Only valid in queries against the Anzo System Datasource or other volume.
  • 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.
  • LE: Evaluates whether one value is less than or equal to (<=) another value.
  • LOCALNAME: Retrieves the local name from the given URI.
  • LT: Evaluates whether one value is less than (<) another value.
  • METADATAGRAPHURI: Returns the metadata graph URI for the given URI.
  • NAMESPACE: Retrieves the namespace for the specified URI.
  • SAMETERM: Evaluates whether two RDF term type values are the same.

CONTAINS

This function evaluates whether the specified strings contain the given pattern. Results are grouped under "true" or "false."

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.

GE

This function evaluates whether value1 is greater than or equal to (>=) value2.

Syntax

GE(value1, value2)
Argument Type Description
value1 numeric, boolean, dateTime, RDF term The number, boolean, datetime, literal, URI, or blank node value to compare to value2. This is the value that will be checked to see if it is greater than or equal to value2.
value2 numeric, boolean, dateTime, RDF term The number, boolean, datetime, literal, URI, or blank node value to compare to value1.

Returns

Type Description
boolean True if value1 >= value2. False if not.

GT

This function evaluates whether value1 is greater than (>) value2.

Syntax

GE(value1, value2)
Argument Type Description
value1 numeric, boolean, dateTime, RDF term The number, boolean, datetime, literal, URI, or blank node value to compare to value2. This is the value that will be checked to see if it is greater than value2.
value2 numeric, boolean, dateTime, RDF term The number, boolean, datetime, literal, URI, or blank node value to compare to value1.

Returns

Type Description
boolean True if value1 > value2. False if 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.

ISDATATYPE

This function evaluates whether the given literal value is typed as the specified data type. It returns true if the value is typed as the provided type or false if it is not.

Syntax

ISDATATYPE(value, datatype_uri)
Argument Type Description
value literal The literal value that you want to test against the datatype_uri.
datatype_uri URI The URI for the data type that you want to test the value against.

Returns

Type Description
boolean True if the literal is typed as specified data type and false if it is not.

ISERROR

This function tests whether the given RDF term evaluates to an error. It returns true if it does evaluate to an error or false if it does not.

The ISERROR function is only for use in queries that are run against the Anzo System Datasource or other volume. It is invalid for graphmart queries.

Syntax

ISERROR(term)
Argument Type Description
term RDF term The literal, URI, or blank node value to evaluate for an error.

Returns

Type Description
boolean True if the term evaluates to an error and false if it does 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 RDF term type 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.

Example

LANGMATCHES(LANG(?prop),"en")

Returns

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

LE

This function evaluates whether value1 is less than or equal to (<=) value2.

Syntax

LE(value1, value2)
Argument Type Description
value1 numeric, boolean, dateTime, RDF term The number, boolean, datetime, literal, URI, or blank node value to compare to value2. This is the value that will be evaluated to see if it is less than or equal to value2.
value2 numeric, boolean, dateTime, RDF term The number, boolean, datetime, literal, URI, or blank node value to compare to value1.

Returns

Type Description
boolean True if value1 <= value2. False if 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.

LT

This function evaluates whether value1 is less than (<) value2.

Syntax

LT(value1, value2)
Argument Type Description
value1 numeric, boolean, dateTime, RDF term The number, boolean, datetime, or RDF term type value to compare to value2. This is the value that will be evaluated to see if it is less than value2.
value2 numeric, boolean, dateTime, RDF term The number, boolean, datetime, or RDF term type value to compare to value1.

Returns

Type Description
boolean True if value1 < value2. False if not.

METADATAGRAPHURI

This function returns the metadata graph URI for the specified URI.

Syntax

METADATAGRAPHURI(uri)
Argument Type Description
uri URI The URI for which you want to return the corresponding metadata graph URI.

Returns

Type Description
URI The metadata graph URI.

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.

SAMETERM

This function evaluates whether two RDF term type values are the same.

Syntax

SAMETERM(term1, term2)
Argument Type Description
term1 RDF term The first literal, URI, or blank node value to compare.
term2 RDF term The literal, URI, or blank node value to compare to term1.

Returns

Type Description
boolean True if the terms are the same and false if they are not.