HomeGetting StartedInstallation & SetupDevelopment & IntegrationDeployment & OperationsData ManagementTechnical SupportPlatform Updates
DocsData ManagementQueryingquery functions

Query Functions

This page describes all query functions supported by Stardog. For information on implementing your own please see the guide in the Extending Stardog chapter.

<details open markdown="block"> <summary> Page Contents </summary> 1. TOC </details>

Stardog Function Namespaces

Stardog supports all of the functions from the SPARQL spec, as well as some others from XPath and SWRL and many custom functions. Any of these functions can be used in queries or rules. Stardog allows functions in SPARQL queries to be used with a namespace prefix. However, some function names appear in multiple namespaces so using a namespace is recommended to avoid ambiguities. For compatibility with other libraries and systems a single function may appear under different namespaces too. The function behavior will be same regardless of which namespace is used to refer to the function. All the namespaces associated with functions are documented below. Refer to the namespaces from the following table to resolve the functions IRIs.

PrefixNamespace
stardogtag:stardog:api:
analyticstag:stardog:api:analytics:
arraytag:stardog:api:array:
escapetag:stardog:api:string:escape:
mathtag:stardog:api:math:
metrictag:stardog:api:string:metric:
phonetictag:stardog:api:string:phonetic:
stringtag:stardog:api:string:
unescapetag:stardog:api:string:unescape:
geofhttp://www.opengis.net/def/function/geosparql/
xpathhttp://www.w3.org/2005/xpath-functions#
xpathmhttp://www.w3.org/2005/xpath-functions/math#
swrlbhttp://www.w3.org/2003/11/swrlb#
leviathanhttp://www.dotnetrdf.org/leviathan#
afnhttp://jena.hpl.hp.com/ARQ/function#

Many custom functions supported by Stardog were originally developed by Zachary Whitley under the open-source Semantalytics project. If you have deployed the Semantalytics jar in your Stardog server those functions will continue working in their namespaces but the corresponding function in the Stardog namespace can also be used without a custom jar in the server classpath.

Stardog Query Functions

The function names and IRIs supported by Stardog are included below. Some of the functions have an IRI that can be used, but they are also overloaded arithmetic operators. For example, if you want to add two day time durations, you can simply use the expression ?duration1 + ?duration2 instead of swrlb:addDayTimeDurations(?duration1 + ?duration2).

Regular Functions

  • abbreviate(string: xsd:string, maxWidth: xsd:integer, [offset: xsd:integer]) -> xsd:string<br> IRIs: string:abbreviate<br> Abbreviates a given string to a specified maximum width, optionally starting from a specified offset.

  • abbreviateMiddle(string: xsd:string, middle: xsd:string, length: xsd:integer) -> xsd:string<br> IRIs: string:abbreviateMiddle<br> Abbreviates the middle of a string.

  • abbreviateWithMarker(string: xsd:string, abbrevMarker: xsd:string, maxWidth: xsd:integer, [offset: xsd:integer]) -> xsd:string<br> IRIs: string:abbreviateWithMarker<br> Abbreviates a string with a marker, optionally with a specified offset.

  • ABS(arg: xsd:numeric) -> xsd:numeric<br> IRIs: ABS, xpath:numeric-abs, swrlb:abs<br> Returns the absolute value of a given numeric argument.

  • acos(arg: xsd:double) -> xsd:double<br> IRIs: math:acos, xpathm:acos, leviathan:cos-1<br> Returns the arc cosine of a number.

  • acosec(arg: xsd:double) -> xsd:double<br> IRIs: math:acosec, leviathan:cosec-1<br> Returns the inverse cosecant of the input value.

  • acotan(arg: xsd:double) -> xsd:double<br> IRIs: math:acotan, leviathan:cotan-1<br> Returns the inverse cotangent of the input value.

  • addDayTimeDurations(arg1: xsd:dayTimeDuration, arg2: xsd:dayTimeDuration) -> xsd:dayTimeDuration<br> IRIs: swrlb:addDayTimeDurations, +<br> Adds two daytime durations together.

  • addDayTimeDurationToDate(date: xsd:date, duration: xsd:dayTimeDuration) -> xsd:date<br> IRIs: swrlb:addDayTimeDurationToDate, +<br> Adds a day-time duration to a date.

  • addDayTimeDurationToDateTime(arg1: xsd:dateTime, arg2: xsd:dayTimeDuration) -> xsd:dateTime<br> IRIs: swrlb:addDayTimeDurationToDateTime, +<br> Adds a day-time duration to a date-time.

  • addDayTimeDurationToTime(time: xsd:time, duration: xsd:dayTimeDuration) -> xsd:time<br> IRIs: swrlb:addDayTimeDurationToTime, +<br> Adds a day-time duration to a time.

  • addYearMonthDurations(arg1: xsd:duration, arg2: xsd:duration) -> xsd:duration<br> IRIs: swrlb:addYearMonthDurations, +<br> Adds two year-month durations together.

  • addYearMonthDurationToDate(date: xsd:date, duration: xsd:yearMonthDuration) -> xsd:date<br> IRIs: swrlb:addYearMonthDurationToDate, +<br> Adds a year-month duration to a date.

  • addYearMonthDurationToDateTime(arg1: xsd:dateTime, arg2: xsd:yearMonthDuration) -> xsd:dateTime<br> IRIs: swrlb:addYearMonthDurationToDateTime, +<br> Adds a year-month duration to a date-time value.

  • all(edge: RDF term, predicate: RDF term) -> xsd:boolean<br> IRIs: stardog:all<br> Returns true if the predicate holds for all edges in the path.

  • any(edge: RDF term, predicate: RDF term) -> xsd:boolean<br> IRIs: stardog:any<br> Evaluates a predicate over all edges in a path and returns true if the predicate is true for any edge.

  • append(arrayLiteral: RDF term,...args: RDF term) -> RDF term<br> IRIs: array:append<br> Appends the given arguments to the given array literal and returns the resulting array literal.

  • appendIfMissing(string: xsd:string, suffix: xsd:string,...suffixes: xsd:string) -> xsd:string<br> IRIs: string:appendIfMissing<br> Appends a suffix to a string if it does not already end with that suffix.

  • appendIfMissingIgnoreCase(string: xsd:string, suffix: xsd:string,...suffixes: xsd:string) -> xsd:string<br> IRIs: string:appendIfMissingIgnoreCase<br> Appends the given suffix to the string if it does not already end with any of the given suffixes, ignoring case.

  • area<br> IRIs: geof:area<br>

  • arg1 IN (args: RDF term...) -> xsd:boolean<br> IRIs: In<br> The IN function form returns true if the first operand matches any of the values in the list of values.

  • asec(arg: xsd:double) -> xsd:double<br> IRIs: math:asec, leviathan:sec-1<br> Returns the arcsecant of the input value.

  • asin(arg: xsd:double) -> xsd:double<br> IRIs: math:asin, xpathm:asin, leviathan:sin-1<br> Returns the arc sine of a number.

  • atan(arg: xsd:double) -> xsd:double<br> IRIs: math:atan, xpathm:atan<br> Returns the arc tangent of a number.

  • BNODE([arg: xsd:string]) -> RDF term<br> IRIs: BNODE<br> Generates a blank node with an optional identifier.

  • boolean(arg: RDF term) -> xsd:boolean<br> IRIs: xsd:boolean<br> Converts a value to a boolean. If the value is a string, it is compared to the string 'true' or '1'. If the value is a literal with a numeric datatype, it is converted to a boolean by checking if it is equal to 1. If the value is a literal with a boolean datatype, it is returned as-is.

  • BOUND(var: RDF term) -> xsd:boolean<br> IRIs: BOUND<br> Returns true if the variable var is bound to a value in the solution mapping.

  • capitalize(string: xsd:string) -> xsd:string<br> IRIs: string:capitalize<br> Capitalizes the first letter of a string.

  • cartesian(x1: xsd:double, y1: xsd:double, [z1: xsd:double], x2: xsd:double, y2: xsd:double, [z2: xsd:double]) -> xsd:double<br> IRIs: math:cartesian, leviathan:cartesian<br> Calculates the Euclidean distance between two points in 2D or 3D space.

  • cartesianProduct(arg1: ArrayLiteral, arg2: ArrayLiteral) -> ArrayLiteral<br> IRIs: array:cartesianProduct<br> This function calculates the cartesian product of two array literals and returns the result as a new array literal.

  • carverphone2(string: xsd:string) -> xsd:string<br> IRIs: phonetic:carverphone2<br> Encodes a string using the Caverphone 2 algorithm.

  • caseFormat(string: xsd:string, fromFormat: xsd:string, toFormat: xsd:string) -> xsd:string<br> IRIs: string:caseFormat<br> Converts a string from one case format to another (e.g., camelCase to snake_case). The from case format be one of fromFormat, FromFormat, from-format, from_format, FROM_FORMAT. The to case format can be one of toFormat, ToFormat, to-format, to_format, TO_FORMAT.

  • CEIL(arg: xsd:decimal) -> xsd:decimal<br> IRIs: CEIL, xpath:numeric-ceil, swrlb:ceiling<br> Returns the smallest integer that is greater than or equal to the input value.

  • center(string: xsd:string, size: xsd:integer, [padChar: xsd:string]) -> xsd:string<br> IRIs: string:center<br> Returns a string of a specified length, centered within a field of a specified size, padded with a specified character.

  • charactersOf(arg: xsd:string) -> ArrayLiteral<br> IRIs: string:charactersOf<br> Returns an array of characters in the input string.

  • chomp(string: xsd:string) -> xsd:string<br> IRIs: string:chomp<br> Removes the last character from a string.

  • chop(string: xsd:string) -> xsd:string<br> IRIs: string:chop<br> Removes trailing whitespace from a string.

  • COALESCE(arg1: RDF term,...args: RDF term) -> RDF term<br> IRIs: COALESCE<br> Returns the first RDF term in the list of arguments that does not result in an error when evaluated.

  • colognePhonetic(string: xsd:string) -> xsd:string<br> IRIs: phonetic:colognePhonetic<br> Encodes a string using the Cologne phonetic algorithm.

  • commonPrefix(str1: xsd:string, str2: xsd:string) -> xsd:string<br> IRIs: string:commonPrefix<br> Returns the common prefix of two strings.

  • commonSuffix(str1: xsd:string, str2: xsd:string) -> xsd:string<br> IRIs: string:commonSuffix<br> Returns the common suffix of two input strings.

  • compare(string1: xsd:string, string2: xsd:string) -> xsd:string<br> IRIs: string:compare<br> Compares two string literals and returns a string indicating their relationship.

  • compareIgnoreCase(str1: xsd:string, str2: xsd:string) -> xsd:integer<br> IRIs: string:compareIgnoreCase<br> Compares two strings in a case-insensitive manner and returns an integer indicating their relationship.

  • CONCAT(arg1: xsd:string,...args: xsd:string) -> xsd:string<br> IRIs: CONCAT, xpath:concat, swrlb:stringConcat<br> Concatenates a variable number of string literals into a single string literal.

  • CONTAINS(arg1: xsd:string, arg2: xsd:string) -> xsd:boolean<br> IRIs: CONTAINS, xpath:contains, swrlb:contains, string:contains<br> Checks if the first string contains the second string.

  • contains(arrayLiteral: RDF term, literal: Literal) -> xsd:boolean<br> IRIs: array:contains<br> Checks if a given literal is contained in an array literal.

  • containsAny(string: xsd:string, searchChars: xsd:string) -> xsd:boolean<br> IRIs: string:containsAny<br> Checks if a string contains any of the characters in a given set of characters.

  • containsIgnoreCase(arg1: xsd:string, arg2: xsd:string) -> xsd:boolean<br> IRIs: swrlb:containsIgnoreCase, string:containsIgnoreCase<br> Checks if the first string contains the second string, ignoring case.

  • containsNone(string: xsd:string, invalidChars: xsd:string) -> xsd:boolean<br> IRIs: string:containsNone<br> Checks if a given string contains none of the characters in a specified string of invalid characters.

  • containsOnly(string: xsd:string, validChars: xsd:string) -> xsd:boolean<br> IRIs: string:containsOnly<br> Checks if a string contains only characters from a specified set of valid characters.

  • containsWhitespace(string: xsd:string) -> xsd:boolean<br> IRIs: string:containsWhitespace<br> Checks if a given string contains any whitespace characters.

  • cos(arg: xsd:double) -> xsd:double<br> IRIs: math:cos, xpathm:cos, swrlb:cos, leviathan:cos<br> Returns the cosine of the input value.

  • cosec(arg: xsd:double) -> xsd:double<br> IRIs: math:cosec, leviathan:cosec<br> Returns the cosecant of the input value.

  • cosh(arg: xsd:double) -> xsd:double<br> IRIs: math:cosh, stardog:cosh<br> Returns the hyperbolic cosine of a number.

  • cosineDistance(string1: xsd:string, string2: xsd:string, [n: xsd:integer]) -> xsd:double<br> IRIs: metric:cosineDistance<br> Calculates the cosine distance between two strings.

  • cosineSimilarity(string1: xsd:string, string2: xsd:string, [n: xsd:integer]) -> xsd:double<br> IRIs: metric:cosineSimilarity<br> Calculates the cosine similarity between two strings.

  • cotan(arg: xsd:double) -> xsd:double<br> IRIs: math:cotan, leviathan:cotan<br> Returns the cotangent of the input value.

  • countMatches(string: xsd:string, sequence: xsd:string) -> xsd:integer<br> IRIs: string:countMatches<br> Counts the number of occurrences of a given sequence within a string.

  • csv(string: xsd:string) -> xsd:string<br> IRIs: escape:csv<br> This function takes a string literal as input and returns a new string with CSV escape sequences applied.

  • csv(string: xsd:string) -> xsd:string<br> IRIs: unescape:csv<br> This function takes a string literal as input, unescapes any CSV characters in the string, and returns the resulting string.

  • daitchMokotoffSoundex(string: xsd:string) -> xsd:string<br> IRIs: phonetic:daitchMokotoffSoundex<br> Encodes a string using the Daitch-Mokotoff Soundex algorithm.

  • damerauDistance(string1: xsd:string, string2: xsd:string) -> xsd:double<br> IRIs: metric:damerauDistance<br> Calculates the Damerau-Levenshtein distance between two strings.

  • datatype(arg: RDF term) -> IRI<br> IRIs: Datatype<br> Returns the datatype IRI of a given RDF term.

  • date(arg: Literal) -> Literal<br> IRIs: xsd:date<br> This function takes a Literal value as input and returns a Literal value of type xsd:date. It attempts to parse the input value as a date and returns an error if the parsing fails or if the input value is not a string or a date/time value.

  • date(year: xsd:integer, month: xsd:integer, day: xsd:integer, [tz: xsd:string]) -> xsd:date<br> IRIs: swrlb:date<br> Creates a date value from the given year, month, and day, with an optional timezone offset.

  • dateTime(arg: RDF term) -> xsd:dateTime<br> IRIs: xsd:dateTime<br> Converts a literal value to an xsd:dateTime value. If the input is a string literal, it is parsed as a date/time string. If the input is an integer literal, it is interpreted as a Unix timestamp. If the input is already an xsd:dateTime, xsd:date, or xsd:dateTimeStamp, it is returned unchanged. Otherwise, an error is returned.

  • dateTime(year: xsd:integer, month: xsd:integer, day: xsd:integer, hour: xsd:integer, minute: xsd:integer, second: xsd:decimal, [tz: xsd:string]) -> xsd:dateTime<br> IRIs: swrlb:dateTime<br> Creates a dateTime value from the given year, month, day, hour, minute, second, and optional timezone.

  • dateTimeStamp(arg: Literal) -> Literal<br> IRIs: xsd:dateTimeStamp<br> Converts a Literal value to a dateTimeStamp. If the Literal is a string, it is parsed as a date/time string. If the Literal is an integer, it is treated as a Unix timestamp. If the Literal is already a date/time value, it is converted to a dateTimeStamp.

  • DAY(arg: xsd:string) -> xsd:integer<br> IRIs: DAY, xpath:day-from-dateTime, xpath:day-from-date, xpath:days-from-duration<br> Returns the day of the month from a date or datetime literal, or the number of days from a duration literal.

  • dayTimeDuration(days: xsd:integer, hours: xsd:integer, minutes: xsd:integer, seconds: xsd:decimal, [isPositive: xsd:boolean]) -> xsd:dayTimeDuration<br> IRIs: swrlb:dayTimeDuration<br> Creates a duration of days, hours, minutes and seconds. If the fifth argument is provided, it indicates whether the duration is positive or negative.

  • decimal(arg: RDF term) -> xsd:decimal<br> IRIs: xsd:decimal<br> Converts the given RDF term to a decimal value.

  • defaultIfBlank(string1: xsd:string, string2: xsd:string) -> xsd:string<br> IRIs: string:defaultIfBlank<br> Returns the first string if it is not blank, otherwise returns the second string.

  • defaultIfEmpty(string1: xsd:string, string2: xsd:string) -> xsd:string<br> IRIs: string:defaultIfEmpty<br> Returns the first string if it is not empty, otherwise returns the second string.

  • degrees(arg: xsd:double) -> xsd:double<br> IRIs: math:degrees, stardog:toDegrees, leviathan:radians-to-degrees<br> Converts radians to degrees.

  • deleteWhitespace(string: xsd:string) -> xsd:string<br> IRIs: string:deleteWhitespace<br> Deletes whitespace from a given string literal.

  • difference(string1: xsd:string, string2: xsd:string) -> xsd:string<br> IRIs: string:difference<br> This function returns the difference between two input strings.

  • digits(string: xsd:string) -> xsd:string<br> IRIs: string:digits<br> Returns a string containing only the digits from the input string.

  • distance<br> IRIs: geof:distance<br>

  • distinct(values: RDF term...) -> RDF term<br> IRIs: array:distinct<br> Removes duplicate values from an array literal and returns the resulting array.

  • divideDayTimeDuration(arg1: xsd:dayTimeDuration, arg2: xsd:numeric) -> xsd:dayTimeDuration<br> IRIs: swrlb:divideDayTimeDuration, /<br> Divides a day-time duration by a number.

  • divideYearMonthDuration(duration: xsd:yearMonthDuration, divisor: xsd:numeric) -> xsd:yearMonthDuration<br> IRIs: swrlb:divideYearMonthDuration, /<br> Divides a year-month duration by a number.

  • double(arg: RDF term) -> xsd:double<br> IRIs: xsd:double<br> Converts a value to a double.

  • doubleMetaphone(string: xsd:string) -> xsd:string<br> IRIs: phonetic:doubleMetaphone<br> This function generates a phonetic code for a given string using the Double Metaphone algorithm.

  • e([arg: xsd:double]) -> xsd:double<br> IRIs: math:e, leviathan:e, xpathm:exp, afn:e<br> Returns the value of the mathematical constant e raised to the power of the input value or e itself if no input is provided.

  • ecmaScript(string: xsd:string) -> xsd:string<br> IRIs: escape:ecmaScript<br> This function takes a string literal as input and returns the string with special characters escaped according to the ECMAScript standard.

  • ecmaScript(string: xsd:string) -> xsd:string<br> IRIs: unescape:ecmaScript<br> This function takes a string literal as input and returns the unescaped ECMA script string.

  • ENCODE_FOR_URI(arg: xsd:string) -> xsd:string<br> IRIs: ENCODE_FOR_URI, xpath:encode-for-uri<br> Encodes a string literal for use in a URI.

  • endsWithIgnoreCase(string1: xsd:string, string2: xsd:string) -> xsd:boolean<br> IRIs: string:endsWithIgnoreCase<br> Checks if the first string ends with the second string, ignoring case.

  • equals(string1: xsd:string, string2: xsd:string) -> xsd:boolean<br> IRIs: string:equals<br> Checks if two string literals are equal.

  • equals(values: RDF term...) -> xsd:boolean<br> IRIs: array:equals<br> Compares two array literals and returns true if they are equal, false otherwise.

  • equalsAny(string: xsd:string,...searchStrings: xsd:string) -> xsd:boolean<br> IRIs: string:equalsAny<br> Checks if a given string matches any of the provided search strings.

  • escape(source: xsd:string, [charsToEscape: xsd:string]) -> RDF term<br> IRIs: stardog:escape<br> Escapes reserved characters in a string literal.

  • factorial(arg: xsd:integer) -> xsd:integer<br> IRIs: math:factorial, leviathan:factorial<br> Calculates the factorial of a given integer.

  • fill(arg1: xsd:numeric, arg2: xsd:integer) -> ArrayLiteral<br> IRIs: array:fill<br> Fills an array with a specified value a specified number of times.

  • flatten(arg1: RDF term) -> RDF term<br> IRIs: array:flatten<br> Flattens an array literal into a single array literal, recursively flattening any nested array literals.

  • float(arg: RDF term) -> xsd:float<br> IRIs: xsd:float<br> Converts a value to a float.

  • FLOOR(arg: xsd:numeric) -> xsd:numeric<br> IRIs: FLOOR, xpath:numeric-floor, swrlb:floor<br> Returns the largest integer less than or equal to the input value.

  • getStatement(subject: RDF term, predicate: IRI, object: RDF term, [context: RDF term]) -> RDF statement<br> IRIs: stardog:GetStatement<br> Returns a statement with the given subject, predicate, object, and optional context.

  • graph(statement: RDF statement) -> RDF term<br> IRIs: stardog:graph<br> Returns the graph of a given statement.

  • hammingDistance(string1: xsd:string, string2: xsd:string) -> xsd:double<br> IRIs: metric:hammingDistance<br> Calculates the Hamming distance between two strings of equal length.

  • HOURS(arg: Literal) -> xsd:integer<br> IRIs: HOURS, xpath:hours-from-dateTime, xpath:hours-from-time, xpath:hours-from-duration<br> Returns the hour of a given time or converts a duration literal into number of hours.

  • html3(string: xsd:string) -> xsd:string<br> IRIs: unescape:html3<br> This function takes a string literal as input and returns the unescaped HTML3 string.

  • html3(string: xsd:string) -> xsd:string<br> IRIs: escape:html3<br> This function takes a string as input and returns the string with HTML entities escaped.

  • html4(string: xsd:string) -> xsd:string<br> IRIs: unescape:html4<br> This function takes a string literal as input and returns the unescaped HTML4 string.

  • html4(string: xsd:string) -> xsd:string<br> IRIs: escape:html4<br> Escapes a string to HTML 4.

  • id(arg: RDF term) -> xsd:integer<br> IRIs: stardog:Id<br> Returns the dictionary encoding of the given RDF value in Stardog storage layer.

  • identifier(subj: RDF term, pred: RDF term, obj: RDF term, [graph: RDF term]) -> IRI<br> IRIs: stardog:identifier<br> This function generates an IRI based on the input RDF terms. It takes three required arguments and one optional argument, and returns an IRI created by hashing the input terms.

  • IF(condition: xsd:boolean, then: RDF term, [else: RDF term]) -> RDF term<br> IRIs: IF<br> Evaluates to the value of the second argument if the first argument is true, otherwise evaluates to the value of the third argument.

  • index(arrayLiteral: RDF term, index: xsd:integer) -> RDF term<br> IRIs: stardog:index, array:index<br> Returns the value at the specified index in the given array literal.

  • indexOf(arrayLiteral: RDF term, value: RDF term) -> RDF term<br> IRIs: array:indexOf<br> Returns an array of indices of the specified value in the given array literal.

  • indexOf(sequence: xsd:string, searchSequence: xsd:string, [startPosition: xsd:integer]) -> xsd:integer<br> IRIs: string:indexOf<br> Returns the index of the first occurrence of the searchSequence in the sequence, starting from the startPosition if provided.

  • indexOfAny(string: xsd:string, searchChars: xsd:string) -> xsd:integer<br> IRIs: string:indexOfAny<br> Returns the index of the first occurrence of any character in the searchChars string within the string.

  • indexOfAnyBut(string: xsd:string, searchChars: xsd:string) -> xsd:integer<br> IRIs: string:indexOfAnyBut<br> Returns the index of the first character in the string that is not in the searchChars string.

  • indexOfDifference(string1: xsd:string, string2: xsd:string) -> xsd:integer<br> IRIs: string:indexOfDifference<br> Returns the index of the first character at which the two input strings differ.

  • indexOfFirst(arrayLiteral: RDF term, element: RDF term) -> xsd:integer<br> IRIs: array:indexOfFirst<br> Returns the index of the first occurrence of the specified element in the array literal, or an error if the element is not found.

  • indexOfIgnoreCase(string: xsd:string, searchChars: xsd:string) -> xsd:integer<br> IRIs: string:indexOfIgnoreCase<br> Returns the index of the first occurrence of the specified searchChars in the given string, ignoring case.

  • indexOfLast(arrayLiteral: RDF term, element: RDF term) -> xsd:integer<br> IRIs: array:indexOfLast<br> Returns the index of the last occurrence of the specified element in the given array literal.

  • initials(string: xsd:string, [delimiters: xsd:string]) -> xsd:string<br> IRIs: string:initials<br> This function returns the initials of a given string. It can take an optional second argument which specifies the delimiters to use when splitting the string into words.

  • integer(arg: RDF term) -> xsd:integer<br> IRIs: xsd:integer<br> Converts a value to an integer.

  • iri(base: RDF term, value: RDF term,...args: RDF term...) -> IRI<br> IRIs: IRI, URI<br> The IRI function takes a base IRI and a value, and returns a new IRI by appending the value to the base IRI. If the value is not a valid IRI, it is appended to the base IRI. If the resulting IRI is still not valid, an error is returned.

  • isAllBlank(strings: xsd:string...) -> xsd:boolean<br> IRIs: string:isAllBlank<br> Checks if all input strings are blank.

  • isAllEmpty(stringLiteral..., stringLiteral) -> xsd:boolean<br> IRIs: string:isAllEmpty<br> Checks if all input strings are empty.

  • isAllLowerCase(string: xsd:string) -> xsd:boolean<br> IRIs: string:isAllLowerCase<br> Checks if a given string is all in lower case.

  • isAllUpperCase(string: xsd:string) -> xsd:boolean<br> IRIs: string:isAllUpperCase<br> Checks if a given string is all uppercase.

  • isAlpha(string: xsd:string) -> xsd:boolean<br> IRIs: string:isAlpha<br> Checks if a given string contains only alphabetic characters.

  • isAlphanumeric(string: xsd:string) -> xsd:boolean<br> IRIs: string:isAlphanumeric<br> Checks if a given string is alphanumeric.

  • isAlphanumericSpace(string: xsd:string) -> xsd:boolean<br> IRIs: string:isAlphanumericSpace<br> Checks if a given string contains only alphanumeric characters and spaces.

  • isAlphaSpace(string: xsd:string) -> xsd:boolean<br> IRIs: string:isAlphaSpace<br> Checks if a given string contains only alphabetic characters and spaces.

  • isAnyBlank(strings: xsd:string...) -> xsd:boolean<br> IRIs: string:isAnyBlank<br> Checks if any of the input strings are blank.

  • isAnyEmpty(stringLiteral1: xsd:string,...stringLiteralN: xsd:string) -> xsd:boolean<br> IRIs: string:isAnyEmpty<br> Checks if any of the input string literals is empty.

  • isAsciiPrintable(string: xsd:string) -> xsd:boolean<br> IRIs: string:isAsciiPrintable<br> Checks if a given string contains only ASCII printable characters.

  • isBlank(arg: RDF term) -> xsd:boolean<br> IRIs: isBlank, IsBNode<br> Returns true if the given RDF term is a blank node.

  • isBlank(string: xsd:string) -> xsd:boolean<br> IRIs: string:isBlank<br> Checks if a given string is blank.

  • isEmpty(string: xsd:string) -> xsd:boolean<br> IRIs: string:isEmpty<br> Checks if a given string is empty.

  • isEmpty(values: RDF term) -> xsd:boolean<br> IRIs: array:isEmpty<br> Checks if the input array literal is empty.

  • isIRI(arg: RDF term) -> xsd:boolean<br> IRIs: isIRI, IsURI<br> Returns true if the input RDF term is an IRI.

  • isLiteral(arg: RDF term) -> xsd:boolean<br> IRIs: isLiteral<br> Returns true if the given RDF term is a Literal, false otherwise.

  • isMixedCase(string: xsd:string) -> xsd:boolean<br> IRIs: string:isMixedCase<br> Checks if a given string is in mixed case.

  • isNoneBlank(values: Literal... ) -> xsd:boolean<br> IRIs: string:isNoneBlank<br> Checks if none of the input strings are blank.

  • isNoneEmpty(strings: xsd:string...) -> xsd:boolean<br> IRIs: string:isNoneEmpty<br> Checks if none of the input strings are empty.

  • isNotBlank(string: xsd:string) -> xsd:boolean<br> IRIs: string:isNotBlank<br> Checks if a given string is not blank.

  • isNotEmpty(string: xsd:string) -> xsd:boolean<br> IRIs: string:isNotEmpty<br> Checks if a given string is not empty.

  • isNumeric(arg: RDF term) -> xsd:boolean<br> IRIs: isNumeric<br> Checks if the input RDF term is a numeric literal with a valid number value.

  • isNumericSpace(string: xsd:string) -> xsd:boolean<br> IRIs: string:isNumericSpace<br> Checks if a given string contains only numeric characters and spaces.

  • IsResource(arg: RDF term) -> xsd:boolean<br> IRIs: IsResource<br> Returns true if the input RDF term is a resource.

  • IsStatement(arg: RDF term) -> xsd:boolean<br> IRIs: stardog:IsStatement<br> Checks if the given RDF term is a statement.

  • isUniformLiteral(arg1: RDF term) -> xsd:boolean<br> IRIs: array:isUniformLiteral<br> Checks if all elements in an array literal have the same datatype.

  • isUniformType(arg1: RDF term) -> xsd:boolean<br> IRIs: array:isUniformType<br> Checks if all elements in an array literal have the same type.

  • isValid(arg: RDF term) -> xsd:boolean<br> IRIs: stardog:isValid<br> Checks if the given RDF term is valid. For literals, it checks if the supplied lexical value is valid for the given datatype. For language literals, it checks if the language tag conforms to the RFC3066 spec. For IRIs, it checks if the IRI contains any invalid characters.

  • isWhitespace(string: xsd:string) -> xsd:boolean<br> IRIs: string:isWhitespace<br> Checks if a given string consists entirely of whitespace characters.

  • jaroWinklerDistance(str1: xsd:string, str2: xsd:string, [boostThreshold: xsd:float], [prefixScale: xsd:float], [maxPrefixLength: xsd:integer]) -> xsd:float<br> IRIs: metric:jaroWinklerDistance<br> Calculates the Jaro-Winkler distance between two strings.

  • jaroWinklerSimilarity(str1: xsd:string, str2: xsd:string, [boostThreshold: xsd:float], [prefixScale: xsd:float], [maxPrefixLength: xsd:integer]) -> xsd:float<br> IRIs: metric:jaroWinklerSimilarity<br> Calculates the Jaro-Winkler similarity between two strings.

  • java(string: xsd:string) -> xsd:string<br> IRIs: escape:java<br> This function takes a string literal as input and returns a new string with special characters escaped according to Java syntax.

  • java(string: xsd:string) -> xsd:string<br> IRIs: unescape:java<br> This function takes a string literal as input and returns the unescaped Java string.

  • join(arg1: RDF term,...args: RDF term) -> xsd:string<br> IRIs: string:join<br> The join function concatenates the string values of its arguments into a single string.

  • joinWith(separator: xsd:string,...args: RDF term) -> xsd:string<br> IRIs: string:joinWith<br> Joins a list of strings with a specified separator.

  • json(string: xsd:string) -> xsd:string<br> IRIs: escape:json<br> This function takes a string literal as input and returns a new string with special characters escaped for use in JSON.

  • json(string: xsd:string) -> xsd:string<br> IRIs: unescape:json<br> This function takes a JSON string as input, unescapes it and returns the resulting string.

  • Lang(lang: RDF term) -> xsd:string<br> IRIs: Lang<br> Returns the language tag of a literal RDF term.

  • langMatches(lang: xsd:string, range: xsd:string) -> xsd:boolean<br> IRIs: langMatches<br> Checks if a language tag matches a language range.

  • lastIndexOf(sequence: xsd:string, searchSequence: xsd:string, [startPos: xsd:integer]) -> xsd:integer<br> IRIs: string:lastIndexOf<br> Returns the last index of the specified search sequence within the given sequence, starting from the specified start position.

  • lastIndexOfAny(string: xsd:string, searchStrings: xsd:string... ) -> xsd:integer<br> IRIs: string:lastIndexOfAny<br> Returns the index of the last occurrence of any of the specified search strings within the given string.

  • lastIndexOfIgnoreCase(string: xsd:string, searchString: xsd:string, [startPos: xsd:integer]) -> xsd:integer<br> IRIs: string:lastIndexOfIgnoreCase<br> Returns the index of the last occurrence of a specified value within a string, ignoring case. If the start position is provided, the search starts from that position.

  • lastOrdinalIndexOf(string: xsd:string, searchString: xsd:string, ordinal: xsd:integer) -> xsd:string<br> IRIs: string:lastOrdinalIndexOf<br> Returns the index within a string of the last occurrence of the specified substring, starting the search at the end of the string and searching backwards.

  • LCASE(arg: xsd:string) -> xsd:string<br> IRIs: LCASE, xpath:lower-case, swrlb:lowerCase, string:lowerCase<br> Converts a string to lowercase.

  • left(string: xsd:string, length: xsd:integer) -> xsd:string<br> IRIs: string:left<br> Returns the specified number of characters from the start of a string.

  • leftPad(string: xsd:string, size: xsd:integer, [padStr: xsd:string]) -> xsd:string<br> IRIs: string:leftPad<br> Pads the input string with a specified character or string to a specified length.

  • length(arg: RDF term) -> xsd:integer<br> IRIs: length, stardog:length, array:size<br> Returns the length of the given RDF term, which can be a string literal, a path literal, or an array literal.

  • levenshteinDistance(string1: xsd:string, string2: xsd:string) -> xsd:double<br> IRIs: metric:levenshteinDistance<br> Calculates the Levenshtein distance between two strings.

  • localname(arg: IRI) -> xsd:string<br> IRIs: stardog:localname, afn:localname<br> Returns the local name of the given IRI.

  • log10(arg1: xsd:double, [arg2: xsd:double]) -> xsd:double<br> IRIs: math:log10, xpathm:log10, leviathan:log, swrlb:log10<br> Computes the base-10 logarithm of a number. If two arguments are provided, it computes the logarithm of the first argument with the second argument as the base.

  • log(arg1: xsd:double, [arg2: xsd:double]) -> xsd:double<br> IRIs: math:log, xpathm:log, leviathan:ln<br> Computes the natural logarithm of a number. If a second argument is provided, it computes the logarithm of the first argument with the second argument as the base.

  • long(arg: RDF term) -> xsd:long<br> IRIs: xsd:long<br> Converts a value to a long integer.

  • longestCommonSubsequence(str1: xsd:string, str2: xsd:string) -> xsd:float<br> IRIs: metric:longestCommonSubsequence<br> This function calculates the length of the longest common subsequence between two input strings.

  • longestCommonSubstring(string1: xsd:string, string2: xsd:string) -> xsd:float<br> IRIs: metric:longestCommonSubstring<br> This function compares two input strings and returns the length of their longest common substring.

  • max(arg1: xsd:double, arg2: xsd:double) -> xsd:double<br> IRIs: math:max, xpath:max, afn:max<br> Returns the maximum of two numeric literals.

  • MD5() -> xsd:string<br> IRIs: MD5, leviathan:md5hash<br> Returns the MD5 hash of a string.

  • metaphone(string: xsd:string) -> xsd:string<br> IRIs: phonetic:metaphone<br> This function generates the metaphone of a given string literal.

  • metricLongestCommonSubsequence(string1: xsd:string, string2: xsd:string) -> xsd:double<br> IRIs: metric:metricLongestCommonSubsequence<br> This function calculates the Longest Common Subsequence (LCS) distance between two input strings.

  • mid(string: xsd:string, position: xsd:integer, length: xsd:integer) -> xsd:string<br> IRIs: string:mid<br> Returns a substring of the input string, starting at the specified position and having the specified length.

  • min(arg1: xsd:double, arg2: xsd:double,...args: xsd:double) -> xsd:double<br> IRIs: math:min, xpath:min, afn:min<br> Returns the smallest of two or more numeric values.

  • MINUTES(arg: xsd:time | xsd:dateTime | xsd:duration) -> xsd:integer<br> IRIs: MINUTES, xpath:minutes-from-dateTime, xpath:minutes-from-time, xpath:minutes-from-duration<br> Returns the minute part of a given time or dateTime value, or converts a duration literal into number of minutes.

  • mod(left: xsd:integer, right: xsd:integer) -> xsd:integer<br> IRIs: swrlb:mod<br> This function calculates the remainder of the division of two numbers.

  • MONTH(arg: Literal) -> xsd:integer<br> IRIs: MONTH, xpath:month-from-dateTime, xpath:month-from-date, xpath:months-from-duration<br> Returns the month of a date or datetime as an integer or converts a duration literal into number of months.

  • multiplyDayTimeDuration(duration: xsd:dayTimeDuration, multiplier: xsd:numeric) -> xsd:dayTimeDuration<br> IRIs: swrlb:multiplyDayTimeDuration, *<br> This function multiplies a daytime duration by a numeric value.

  • multiplyYearMonthDuration(duration: xsd:yearMonthDuration, multiplier: xsd:numeric) -> xsd:yearMonthDuration<br> IRIs: swrlb:multiplyYearMonthDuration, *<br> This function multiplies a year-month duration by a numeric value.

  • MURMUR3() -> IRI<br> IRIs: MURMUR3<br> A hash function that generates a MURMUR3 hash.

  • namespace(arg: IRI) -> RDF term<br> IRIs: stardog:namespace, afn:namespace<br> Returns the namespace of the given IRI.

  • nDims(arrayLiteral: RDF term) -> xsd:integer<br> IRIs: array:nDims<br> This function calculates the number of dimensions in a given array literal. It recursively traverses the array until it finds a non-array value and returns the depth of the array.

  • needlemanWunch(str1: xsd:string, str2: xsd:string, [gapValue: xsd:float, subPenaltyA: xsd:float, subPenaltyB: xsd:float]) -> xsd:float<br> IRIs: metric:needlemanWunch<br> This function calculates the similarity between two strings using the Needleman-Wunsch algorithm. It takes two mandatory string arguments and three optional float arguments for gap value and substitution penalties.

  • ngram(n: xsd:integer, arrayLiteral: RDF term, [leftPadToken: RDF term], [rightPadToken: RDF term]) -> RDF term<br> IRIs: array:ngram<br> This function generates n-grams from an array literal. It takes an integer n, an array literal, and optional left and right padding tokens. It returns an array of n-grams, where each n-gram is an array of tokens.

  • ngram(n: xsd:integer, str: xsd:string, [leftPad: xsd:string], [rightPad: xsd:string]) -> ArrayLiteral<br> IRIs: string:ngram<br> This function generates n-grams from a given string. It takes an integer n, a string str, and optional left and right padding strings. It returns an array of n-grams, where each n-gram is a substring of the input string with the specified padding.

  • ngram(string1: xsd:string, string2: xsd:string, [n: xsd:integer]) -> xsd:double<br> IRIs: metric:ngram<br> Calculates the n-gram distance between two strings.

  • nodes(pathLiteral: PathLiteral) -> ArrayLiteral<br> IRIs: stardog:nodes<br> This function takes a PathLiteral as input and returns an ArrayLiteral containing the nodes in the path.

  • normalize-space(arg: xsd:string) -> xsd:string<br> IRIs: xpath:normalize-space, swrlb:normalizeSpace, string:normalizeSpace<br> Removes leading and trailing whitespace from a string and replaces sequences of whitespace characters with a single space.

  • normalizedLevenshteinDistance(string1: xsd:string, string2: xsd:string) -> xsd:double<br> IRIs: metric:normalizedLevenshteinDistance<br> Calculates the normalized Levenshtein distance between two strings.

  • normalizedLevenshteinSimilarity(str1: xsd:string, str2: xsd:string) -> xsd:double<br> IRIs: metric:normalizedLevenshteinSimarity<br> Calculates the normalized Levenshtein similarity between two strings.

  • NOW() -> xsd:dateTime<br> IRIs: NOW<br> Returns the current date and time.

  • numeric-add(arg1: xsd:numeric, arg2: xsd:numeric) -> xsd:numeric<br> IRIs: xpath:numeric-add, swrlb:add<br> This function adds two numeric values or a date/time value and a duration value, returning the result as a numeric value or a date/time value.

  • numeric-divide(left: xsd:numeric, right: xsd:numeric) -> xsd:numeric<br> IRIs: xpath:numeric-divide, swrlb:divide<br> This function performs numeric division on two input values. It supports division of numeric literals, including integers, decimals, floats, and durations. If the inputs are not numeric, the function returns an error.

  • numeric-integer-divide(left: xsd:integer, right: xsd:integer) -> xsd:integer<br> IRIs: xpath:numeric-integer-divide, swrlb:integerDivide<br> This function performs integer division of two numeric values and returns the result as an integer.

  • numeric-multiply(left: xsd:numeric, right: xsd:numeric) -> xsd:numeric<br> IRIs: xpath:numeric-multiply, swrlb:multiply<br> This function multiplies two numeric values and returns the result. It supports various numeric datatypes including integers, decimals, floats, and durations.

  • numeric-round-half-to-even(aLeft: xsd:numericLiteral, [aRight: xsd:integer]) -> xsd:numericLiteral<br> IRIs: xpath:numeric-round-half-to-even, swrlb:roundHalfToEven<br> Rounds a numeric literal to the nearest integer or to a given number of decimal places using the half to even rounding mode.

  • numeric-subtract(arg1: xsd:numeric, arg2: xsd:numeric) -> xsd:numeric<br> IRIs: xpath:numeric-subtract, swrlb:subtract<br> Subtracts the second argument from the first argument. The arguments can be of type xsd:integer, xsd:double, xsd:decimal, or xsd:float. If the arguments are of type xsd:date, xsd:time, xsd:datetime, or xsd:datetimestamp, the function subtracts the second argument from the first argument as a duration. If the arguments are of type xsd:duration, the function subtracts the second argument from the first argument as a duration.

  • numeric-unary-minus(arg: xsd:numeric) -> xsd:numeric<br> IRIs: xpath:numeric-unary-minus, swrlb:unaryMinus<br> This function takes a single numeric argument and returns its negation.

  • numeric-unary-plus(arg: xsd:numeric) -> xsd:numeric<br> IRIs: xpath:numeric-unary-plus, swrlb:unaryPlus<br> Returns the input numeric value unchanged.

  • nysiis(string: xsd:string) -> xsd:string<br> IRIs: phonetic:nysiis<br> Encodes a string using the New York State Identification and Intelligence System (NYSIIS) phonetic algorithm.

  • object(statement: RDF statement) -> RDF term<br> IRIs: stardog:object<br> Returns the object of a statement.

  • of(...arg: RDF term) -> RDF term<br> IRIs: array:of<br> Evaluates a list of arguments and returns an array literal containing the IDs of the values in the dictionary.

  • offset(value: xsd:integer) -> xsd:string<br> IRIs: array:offset<br> Returns the offset of a given numeric literal as a string.

  • ordinal(value: xsd:integer) -> xsd:string<br> IRIs: array:ordinal<br> Returns the ordinal representation of a given integer value.

  • ordinalIndexOf(string: xsd:string, searchStr: xsd:string, ordinal: xsd:integer) -> xsd:integer<br> IRIs: string:ordinalIndexOf<br> Returns the index of the nth occurrence of a substring within a string.

  • overlapCoefficient(str1: xsd:string, str2: xsd:string) -> xsd:float<br> IRIs: metric:overlapCoefficient<br> Calculates the overlap coefficient between two strings.

  • overlay(string: xsd:string, overlay: xsd:string, start: xsd:integer, end: xsd:integer) -> xsd:string<br> IRIs: string:overlay<br> This function overlays a given string with another string at a specified start and end position.

  • padEnd(string: xsd:string, minLength: xsd:integer, padChar: xsd:string) -> xsd:string<br> IRIs: string:padEnd<br> Pads the end of a string with a specified character until it reaches a minimum length.

  • padStart(string: xsd:string, minLength: xsd:integer, padChar: xsd:string) -> xsd:string<br> IRIs: string:padStart<br> Pads the input string with a specified character to a minimum length.

  • partition(arrayLiteral: xsd:integer[], size: xsd:integer) -> xsd:integer[]<br> IRIs: array:partition<br> Partitions an array of integers into sub-arrays of a specified size and returns the resulting array of sub-arrays.

  • pi() -> xsd:double<br> IRIs: math:pi, xpathm:pi, afn:pi<br> Returns the mathematical constant pi.

  • point(arg1: xsd:double, arg2: xsd:double) -> RDF term<br> IRIs: geof:point<br> Creates a point shape from two double values.

  • pow2(arg: xsd:double) -> xsd:double<br> IRIs: math:pow2, leviathan:sq<br> Raises the input number to the power of 2.

  • pow3(arg: xsd:numeric) -> xsd:numeric<br> IRIs: math:pow3, leviathan:cube<br> Raises the input number to the power of 3.

  • pow10(arg: xsd:double) -> xsd:double<br> IRIs: math:pow10, leviathan:ten<br> Raises 10 to the power of the given argument.

  • pow(aLeft: xsd:double, aRight: xsd:double) -> xsd:double<br> IRIs: math:pow, xpathm:pow, swrlb:pow, leviathan:pow<br> Raises the first argument to the power of the second argument.

  • predicate(statement: RDF statement) -> IRI<br> IRIs: stardog:predicate<br> Returns the predicate of a given statement.

  • prependIfMissing(string: xsd:string, prefix: xsd:string,...prefixes: xsd:string) -> xsd:string<br> IRIs: string:prependIfMissing<br> Prepends a prefix to a string if it does not already start with that prefix.

  • prependIfMissingIgnoreCase(string: xsd:string, suffix: xsd:string,...suffixes: xsd:string) -> xsd:string<br> IRIs: string:prependIfMissingIgnoreCase<br> Prepends the given suffixes to the string if they are not already present, ignoring case.

  • pythagoras(sideA: xsd:double, sideB: xsd:double) -> xsd:double<br> IRIs: math:pythagoras, leviathan:pythagoras<br> Calculates the length of the hypotenuse of a right triangle given the lengths of the other two sides.

  • qgram(s1: xsd:string, s2: xsd:string, [n: xsd:integer]) -> xsd:double<br> IRIs: metric:qgram<br> Calculates the q-gram distance between two strings.

  • radians(arg: xsd:double) -> xsd:double<br> IRIs: math:radians, stardog:toRadians, leviathan:degrees-to-radians<br> Converts degrees to radians.

  • RAND([min: xsd:double], [max: xsd:double]) -> xsd:double<br> IRIs: RAND, leviathan:rnd<br> Generates a random number. If no arguments are provided, it generates a random number between 0 and 1. If one argument is provided, it generates a random number between 0 and the provided maximum value. If two arguments are provided, it generates a random number between the provided minimum and maximum values.

  • reciprocal(arg: xsd:double) -> xsd:double<br> IRIs: math:reciprocal, leviathan:reciprocal<br> Returns the reciprocal of a given number.

  • reduce(pathVar: RDF term, initialValue: RDF term, accumulator: RDF term) -> RDF term<br> IRIs: stardog:reduce<br> The reduce function applies an accumulator function to all items in an array, going from left to right, so as to reduce it to a single output value.

  • refinedSoundex(string: xsd:string) -> xsd:string<br> IRIs: phonetic:refinedSoundex<br> This function calculates the refined soundex of a given string literal.

  • regex(string: xsd:string, pattern: xsd:string, [flags: xsd:string]) -> xsd:boolean<br> IRIs: Regex, xpath:matches, swrlb:matches<br> The regex function tests if a string matches a regular expression pattern.

  • relate<br> IRIs: geof:relate<br>

  • remove(string: xsd:string, remove: xsd:string) -> xsd:string<br> IRIs: string:remove<br> Removes the specified substring from the input string.

  • removeAll(arrayLiteral: RDF term, element: xsd:numeric,...): RDF term<br> IRIs: array:removeAll<br> Removes all occurrences of a given element from an array literal.

  • removeAll(string: xsd:string, regex: xsd:string) -> xsd:string<br> IRIs: string:removeAll<br> Removes all occurrences of a regular expression from a string.

  • removeEnd(string: xsd:string, remove: xsd:string) -> xsd:string<br> IRIs: string:removeEnd<br> Removes the specified string from the end of another string.

  • removeEndIgnoreCase(string: xsd:string, remove: xsd:string) -> xsd:string<br> IRIs: string:removeEndIgnoreCase<br> Removes the specified string from the end of the input string, ignoring case.

  • removeFirst(arg1: RDF term) -> RDF term<br> IRIs: array:removeFirst<br> Removes the first element from an array literal.

  • removeFirst(string: xsd:string, regex: xsd:string) -> xsd:string<br> IRIs: string:removeFirst<br> Removes the first occurrence of the specified regular expression from the input string.

  • removeIgnoreCase(string: xsd:string, remove: xsd:string) -> xsd:string<br> IRIs: string:removeIgnoreCase<br> Removes all occurrences of a substring from a string, ignoring case.

  • removeLast(arg: RDF term) -> RDF term<br> IRIs: array:removeLast<br> Removes the last element from an array literal.

  • removePattern(string: xsd:string, pattern: xsd:string) -> xsd:string<br> IRIs: string:removePattern<br> Removes a pattern from a given string.

  • removeStart(string: xsd:string, remove: xsd:string) -> xsd:string<br> IRIs: string:removeStart<br> Removes the specified string from the start of another string.

  • removeStartIgnoreCase(string: xsd:string, remove: xsd:string) -> xsd:string<br> IRIs: string:removeStartIgnoreCase<br> Removes the specified string from the start of the input string, ignoring case.

  • repeat(string: xsd:string, count: xsd:integer) -> xsd:string<br> IRIs: string:repeat<br> Repeats a given string a specified number of times.

  • REPLACE(arg: xsd:string, pattern: xsd:string, replace: xsd:string, [flags: xsd:string]) -> xsd:string<br> IRIs: REPLACE, xpath:replace, swrlb:replace, string:replace<br> Replaces occurrences of a pattern in a string with a replacement string, with optional flags to modify the replacement behavior.

  • replaceAll(string: xsd:string, searchString: xsd:string, replacement: xsd:string) -> xsd:string<br> IRIs: string:replaceAll<br> Replaces all occurrences of a search string with a replacement string in a given string.

  • replaceChars(string: xsd:string, searchString: xsd:string, replacement: xsd:string) -> xsd:string<br> IRIs: string:replaceChars<br> Replaces occurrences of a search string with a replacement string in a given string.

  • replaceEach(string: xsd:string, searchList: xsd:string, replacementList: xsd:string) -> xsd:string<br> IRIs: string:replaceEach<br> Replaces each occurrence of the strings in the search list with the corresponding string in the replacement list in the input string.

  • replaceEachRepeatedly(string: xsd:string, searchList: xsd:string, replacementList: xsd:string) -> xsd:string<br> IRIs: string:replaceEachRepeatedly<br> Replaces each occurrence of the strings in the search list with the corresponding string in the replacement list in the input string.

  • replaceFirst(string: xsd:string, searchString: xsd:string, replacement: xsd:string) -> xsd:string<br> IRIs: string:replaceFirst<br> Replaces the first occurrence of a specified string with another string in a given string.

  • replaceIgnoreCase(string: xsd:string, searchString: xsd:string, replacement: xsd:string) -> xsd:string<br> IRIs: string:replaceIgnoreCase<br> Replaces occurrences of a substring in a string, ignoring case.

  • replaceOnce(string: xsd:string, searchString: xsd:string, replacement: xsd:string) -> xsd:string<br> IRIs: string:replaceOnce<br> Replaces the first occurrence of a specified string with another string in a given string.

  • replaceOnceIgnoreCase(string: xsd:string, searchString: xsd:string, replacement: xsd:string) -> xsd:string<br> IRIs: string:replaceOnceIgnoreCase<br> Replaces the first occurrence of a substring in a string with a replacement string, ignoring case.

  • replacePattern(string: xsd:string, regex: xsd:string, replacement: xsd:string) -> xsd:string<br> IRIs: string:replacePattern<br> Replaces occurrences of a pattern in a string with a replacement string.

  • reverse(string: xsd:string) -> xsd:string<br> IRIs: string:reverse<br> Reverses the input string.

  • reverse(values: RDF term...) -> RDF term<br> IRIs: array:reverse<br> Reverses the order of elements in an array literal.

  • reverseDelimited(string: xsd:string, separatorChar: xsd:string) -> xsd:string<br> IRIs: string:reverseDelimited<br> Reverses a string that is delimited by a specified character.

  • right(string: xsd:string, length: xsd:integer) -> xsd:string<br> IRIs: string:right<br> Returns the specified number of characters from the right side of a string.

  • rightPad(string: xsd:string, size: xsd:integer) -> xsd:string<br> IRIs: string:rightPad<br> Pads the input string with spaces on the right to the specified size.

  • root(aVal: xsd:double, aRoot: xsd:double) -> xsd:double<br> IRIs: math:root, leviathan:root<br> Calculates the nth root of a value.

  • rotate(string: xsd:string, shift: xsd:integer) -> xsd:string<br> IRIs: string:rotate<br> Rotates a string by a specified shift value.

  • ROUND(arg1: xsd:numericLiteral, [arg2: xsd:integer]) -> xsd:numericLiteral<br> IRIs: ROUND, xpath:numeric-round, swrlb:round<br> Rounds a numeric literal to the nearest integer or to a specified number of decimal places.

  • sameTerm(left: RDF term, right: RDF term) -> xsd:boolean<br> IRIs: sameTerm<br> This function checks if two terms are the same by comparing their IDs in the solution dictionary.

  • sec(arg: xsd:double) -> xsd:double<br> IRIs: math:sec, leviathan:sec<br> Returns the secant of the input value.

  • SECONDS(arg: xsd:time | xsd:dateTime | xsd:dateTimeStamp | xsd:duration) -> xsd:decimal<br> IRIs: SECONDS, xpath:seconds-from-dateTime, xpath:seconds-from-time, xpath:seconds-from-duration<br> Returns the seconds part of a given time, datetime, datetimeStamp or converts a duration literal into number of seconds.

  • SHA1() -> xsd:string<br> IRIs: SHA1<br> Returns a SHA1 hash of the input string.

  • SHA256(hash: xsd:string) -> xsd:string<br> IRIs: SHA256, leviathan:sha256hash<br> Computes the SHA-256 hash of a given string.

  • SHA384() -> xsd:string<br> IRIs: SHA384<br> Computes the SHA-384 hash of a string.

  • SHA512(hash: xsd:string) -> xsd:string<br> IRIs: SHA512<br> Computes the SHA-512 hash of a given string.

  • shape(arg1: Literal, [arg2: Literal,...]) -> Literal<br> IRIs: geof:shape<br> Creates a shape literal from a WKT string or a list of points.

  • shift(values: RDF term, offset: xsd:integer) -> RDF term<br> IRIs: array:shift<br> Shifts the elements of an array literal by a specified offset.

  • shuffle(arrayLiteral: RDF term) -> RDF term<br> IRIs: array:shuffle<br> Shuffles the elements of an array literal.

  • sift4(string1: xsd:string, string2: xsd:string, [maxOffset: xsd:integer]) -> xsd:double<br> IRIs: metric:sift4<br> Calculates the sift4 distance between two strings, with an optional maximum offset.

  • sin(arg: xsd:double) -> xsd:double<br> IRIs: math:sin, xpathm:sin, swrlb:sin, leviathan:sin<br> Returns the sine of the input value.

  • sinh(arg: xsd:double) -> xsd:double<br> IRIs: math:sinh, stardog:sinh<br> Returns the hyperbolic sine of a number.

  • smithWaterman(str1: xsd:string, str2: xsd:string, [gapA: xsd:float, gapB: xsd:float, subPenaltyA: xsd:float, subPenaltyB: xsd:float, windowSize: xsd:integer]) -> xsd:float<br> IRIs: metric:smithWaterman<br> This function calculates the similarity between two strings using the Smith-Waterman algorithm. It takes two mandatory string arguments and up to five optional arguments for gap penalties and window size.

  • smithWatermanGotoh(str1: xsd:string, str2: xsd:string, [gapValue: xsd:float, matchPenalty: xsd:float, mismatchPenalty: xsd:float]) -> xsd:float<br> IRIs: metric:smithWatermanGotoh<br> This function calculates the similarity between two strings using the Smith-Waterman-Gotoh algorithm. It takes two mandatory string arguments and three optional float arguments for gap value, match penalty, and mismatch penalty. If the optional arguments are not provided, default values are used.

  • sorensenDiceDistance(str1: xsd:string, str2: xsd:string, [n: xsd:integer]) -> xsd:double<br> IRIs: metric:sorensenDiceDistance<br> Calculates the Sorensen-Dice distance between two strings.

  • sorensenDiceSimilarity(str1: xsd:string, str2: xsd:string, [n: xsd:integer]) -> xsd:double<br> IRIs: metric:sorensenDiceSimilarity<br> Calculates the Sorensen-Dice similarity between two strings.

  • soundex(arg: xsd:string) -> xsd:string<br> IRIs: phonetic:soundex<br> This function generates the Soundex code for a given string.

  • split(string: xsd:string, separator: xsd:string, [limit: xsd:integer]) -> RDF term<br> IRIs: stardog:split, string:split<br> Splits a string into an array of substrings based on a specified separator and returns the array as an RDF term.

  • splitByCharacterType(arg: xsd:string) -> ArrayLiteral<br> IRIs: string:splitByCharacterType<br> Splits a string into an array of substrings based on character type.

  • splitByCharacterTypeCamelCase(arg: xsd:string) -> ArrayLiteral<br> IRIs: string:splitByCharacterTypeCamelCase<br> Splits a string into an array of substrings based on camel case character type.

  • splitByWholeSeparator(string: xsd:string, separator: xsd:string, [max: xsd:integer]) -> RDF term<br> IRIs: string:splitByWholeSeparator<br> Splits a string into an array of substrings separated by a specified separator, with an optional maximum number of splits.

  • splitByWholeSeparatorPreserveAllTokens(string: xsd:string, separator: xsd:string, [max: xsd:integer]) -> RDF term<br> IRIs: string:splitByWholeSeparatorPreserveAllTokens<br> Splits a string into an array of substrings based on a separator, preserving all tokens.

  • splitPreserveAllTokens(string: xsd:string, separator: xsd:string, [max: xsd:integer]) -> RDF term<br> IRIs: string:splitPreserveAllTokens<br> Splits a string into an array of substrings based on a separator, preserving all tokens.

  • splitStatement(statement: RDF term) -> RDF term<br> IRIs: stardog:SplitStatement<br> Splits a statement into its subject, predicate, object, and graph.

  • sqrt(arg: xsd:double) -> xsd:double<br> IRIs: math:sqrt, xpathm:sqrt, afn:sqrt, leviathan:sqrt<br> Returns the square root of a given number.

  • startsWithAny(string: xsd:string,...prefix: xsd:string) -> xsd:boolean<br> IRIs: string:startsWithAny<br> Checks if a given string starts with any of the provided prefixes.

  • startsWithIgnoreCase(string1: xsd:string, string2: xsd:string) -> xsd:boolean<br> IRIs: string:startsWithIgnoreCase<br> Checks if the first string starts with the second string, ignoring case.

  • str(arg: RDF term, [separator: xsd:string]) -> xsd:string<br> IRIs: Str<br> The str function returns a string representation of the input RDF term. If the input is an array, it returns a comma-separated list of the array elements. An optional separator can be provided to customize the separator used in the list.

  • STRAFTER(arg1: xsd:string, arg2: xsd:string) -> xsd:string<br> IRIs: STRAFTER, xpath:substring-after, swrlb:substringAfter, string:substringAfter<br> Returns the substring of arg1 that follows the first occurrence of arg2.

  • STRBEFORE(arg1: xsd:string, arg2: xsd:string) -> xsd:string<br> IRIs: STRBEFORE, xpath:substring-before, swrlb:substringBefore, string:substringBefore<br> Returns the substring of arg1 that precedes the first occurrence of arg2.

  • STRDT(literal: xsd:string, type: IRI) -> RDF term<br> IRIs: STRDT<br> Returns a new literal with the given lexical form and type IRI.

  • STRENDS(string: xsd:string, string: xsd:string) -> xsd:boolean<br> IRIs: STRENDS, xpath:ends-with, swrlb:endsWith, string:endsWith<br> Checks if the first string ends with the second string.

  • string(arg: RDF term) -> xsd:string<br> IRIs: xsd:string<br> Converts the input RDF term to a string literal.

  • stringEqualIgnoreCase(arg1: xsd:string, arg2: xsd:string) -> xsd:boolean<br> IRIs: swrlb:stringEqualIgnoreCase, string:equalsIgnoreCase<br> Compares two string literals in a case-insensitive manner and returns true if they are equal, false otherwise.

  • strip(string: xsd:string) -> xsd:string<br> IRIs: string:strip<br> Removes leading and trailing whitespace from a string.

  • stripAccents(string: xsd:string) -> xsd:string<br> IRIs: string:stripAccents<br> Removes accents from a given string literal.

  • stripAll(stringLiteral1: xsd:string,...stringLiteralN: xsd:string) -> xsd:string<br> IRIs: string:stripAll<br> Removes leading and trailing whitespace from all input strings and joins them into a single string separated by a special character.

  • stripEnd(string: xsd:string, stripChars: xsd:string) -> xsd:string<br> IRIs: string:stripEnd<br> Removes trailing characters from a string.

  • stripStart(string: xsd:string, stripChars: xsd:string) -> xsd:string<br> IRIs: string:stripStart<br> Removes leading characters from a string.

  • STRLANG(base: Literal, lang: Literal) -> Literal<br> IRIs: STRLANG<br> Returns a new literal with the same lexical form as base but with the language tag set to lang.

  • STRLEN(arg: xsd:string) -> xsd:integer<br> IRIs: STRLEN, xpath:string-length, swrlb:stringLength, string:length<br> Returns the length of the given string literal.

  • STRSTARTS(arg1: xsd:string, arg2: xsd:string) -> xsd:boolean<br> IRIs: STRSTARTS, xpath:starts-with, swrlb:startsWith, string:startsWith<br> Checks if the first string starts with the second string.

  • STRUUID() -> xsd:string<br> IRIs: STRUUID<br> Returns a random UUID as a string.

  • sub(array: RDF term, start: xsd:integer, end: xsd:integer) -> RDF term<br> IRIs: array:sub<br> Returns a subarray of the input array, starting from the specified start index (inclusive) and ending at the specified end index (exclusive).

  • subject(statement: RDF statement) -> RDF term<br> IRIs: stardog:subject<br> Returns the subject of a statement.

  • SUBSTR(string: xsd:string, start: xsd:integer, [length: xsd:integer]) -> xsd:string<br> IRIs: SUBSTR, xpath:substring, swrlb:substring, string:substring<br> Returns a substring of the input string, starting at the specified position and having the specified length.

  • substringAfterLast(string: xsd:string, separator: xsd:string) -> xsd:string<br> IRIs: string:substringAfterLast<br> Returns the substring of the given string after the last occurrence of the specified separator.

  • substringBeforeLast(string: xsd:string, separator: xsd:string) -> xsd:string<br> IRIs: string:substringBeforeLast<br> Returns the substring of the given string before the last occurrence of the specified separator.

  • substringBetween(string: xsd:string, separator: xsd:string) -> xsd:string<br> IRIs: string:substringBetween<br> Returns the substring between the first occurrence of the separator in the string.

  • subtractDates<br> IRIs: swrlb:subtractDates, -<br>

  • subtractDayTimeDurationFromDate(date: xsd:date, duration: xsd:dayTimeDuration) -> xsd:date<br> IRIs: swrlb:subtractDayTimeDurationFromDate, -<br> Subtracts a day-time duration from a date.

  • subtractDayTimeDurationFromDateTime(arg1: xsd:dateTime, arg2: xsd:dayTimeDuration) -> xsd:dateTime<br> IRIs: swrlb:subtractDayTimeDurationFromDateTime, -<br> Subtracts a day-time duration from a date-time.

  • subtractDayTimeDurationFromTime(time: xsd:time, duration: xsd:dayTimeDuration) -> xsd:time<br> IRIs: swrlb:subtractDayTimeDurationFromTime, -<br> Subtracts a day-time duration from a time.

  • subtractDayTimeDurations(arg1: xsd:dayTimeDuration, arg2: xsd:dayTimeDuration) -> xsd:dayTimeDuration<br> IRIs: swrlb:subtractDayTimeDurations, -<br> Subtracts one day-time duration from another.

  • subtractTimes(arg1: xsd:time, arg2: xsd:time) -> xsd:time<br> IRIs: swrlb:subtractTimes, -<br> Subtracts two time values and returns the result as a time value.

  • subtractYearMonthDurationFromDate(date: xsd:date, duration: xsd:yearMonthDuration) -> xsd:date<br> IRIs: swrlb:subtractYearMonthDurationFromDate, -<br> Subtracts a year-month duration from a date.

  • subtractYearMonthDurationFromDateTime(arg1: xsd:dateTime, arg2: xsd:yearMonthDuration) -> xsd:dateTime<br> IRIs: swrlb:subtractYearMonthDurationFromDateTime, -<br> Subtracts a year-month duration from a date-time value.

  • subtractYearMonthDurations(arg1: xsd:duration, arg2: xsd:duration) -> xsd:duration<br> IRIs: swrlb:subtractYearMonthDurations, -<br> Subtracts one year-month duration from another.

  • swap(arrayLiteral: RDF term, firstIndex: xsd:integer, secondIndex: xsd:integer) -> RDF term<br> IRIs: array:swap<br> Swaps the elements at the specified indices in the given array literal.

  • swapCase(string: xsd:string) -> xsd:string<br> IRIs: string:swapCase<br> This function swaps the case of a given string literal.

  • tan(arg: xsd:double) -> xsd:double<br> IRIs: math:tan, xpathm:tan, swrlb:tan<br> Returns the tangent of the input value.

  • tanh(arg: xsd:double) -> xsd:double<br> IRIs: math:tanh, stardog:tanh<br> Returns the hyperbolic tangent of a number.

  • time(arg: xsd:string | xsd:dateTime | xsd:time | xsd:dateTimeStamp) -> xsd:time<br> IRIs: xsd:time<br> This function takes a value of type string, dateTime, time, or dateTimeStamp and returns a value of type time. It attempts to parse the input value as a time and returns an error if the parsing fails or if the input value is not in the correct format.

  • time(hour: xsd:integer, minute: xsd:integer, second: xsd:decimal, [tz: xsd:string]) -> xsd:dateTime<br> IRIs: swrlb:time<br> Creates a dateTime value from the given hour, minute, second, and optional timezone.

  • TIMEZONE(arg: xsd:dateTime) -> xsd:dayTimeDuration<br> IRIs: TIMEZONE, xpath:timezone-from-dateTime, xpath:timezone-from-date, xpath:timezone-from-time<br> Returns the timezone offset of a given date/time value as a duration.

  • toString(arg1: RDF term) -> xsd:string<br> IRIs: array:toString<br> Converts an RDF term to a string representation.

  • translate(source: xsd:string, pattern: xsd:string, replacement: xsd:string) -> xsd:string<br> IRIs: xpath:translate, swrlb:translate<br> Translates a string by replacing characters in the pattern with corresponding characters in the replacement string.

  • trim(string: xsd:string) -> xsd:string<br> IRIs: string:trim<br> Removes whitespace from the beginning and end of a string literal.

  • truncate(string: xsd:string, maxWidth: xsd:integer) -> xsd:string<br> IRIs: string:truncate<br> Truncates a given string to a specified maximum width.

  • TZ(arg: xsd:dateTime) -> xsd:string<br> IRIs: TZ<br> Returns the timezone of a given date/time value as a string in the format +HHMM or -HHMM, or Z if the timezone is UTC.

  • UCASE(arg: xsd:string) -> xsd:string<br> IRIs: UCASE, xpath:upper-case, swrlb:upperCase, string:upperCase<br> Converts a string to uppercase.

  • uncapitalize(string: xsd:string) -> xsd:string<br> IRIs: string:uncapitalize<br> Converts the first character of a string to lowercase.

  • unescapeXSI(string: xsd:string) -> xsd:string<br> IRIs: unescape:xsi<br> This function takes a string literal as input and returns the unescaped string.

  • uniformDatatype(arg1: RDF term) -> IRI<br> IRIs: array:uniformDatatype<br> This function takes an array literal as input and returns the datatype IRI of the literals in the array if they are all of the same datatype, otherwise it returns an error.

  • unwrap(string: xsd:string, wrapToken: xsd:string) -> xsd:string<br> IRIs: string:unwrap<br> Removes the specified wrap token from the input string.

  • UUID() -> IRI<br> IRIs: UUID<br> Generates a random UUID and returns it as an IRI.

  • weightedLevenshteinDistance(string1: xsd:string, string2: xsd:string, substitution1: xsd:string, substitution2: xsd:string, weight: xsd:double,... ) -> xsd:double<br> IRIs: metric:weightedLevenshteinDistance<br> Calculates the weighted Levenshtein distance between two strings based on a set of custom substitution weights.

  • within(...args: RDF term) -> RDF term<br> IRIs: geof:within<br> This function is not implemented and always returns an error.

  • wrap(string: xsd:string, wrapWith: xsd:string) -> xsd:string<br> IRIs: string:wrap<br> Wraps a string with a specified character.

  • wrapIfMissing(string: xsd:string, wrapWith: xsd:string) -> xsd:string<br> IRIs: string:wrapIfMissing<br> Wraps a string with a specified character if it is not already wrapped with that character.

  • xml10(string: xsd:string) -> xsd:string<br> IRIs: escape:xml10<br> This function takes a string literal as input and returns the string with XML 1.0 special characters escaped.

  • xml10(stringLiteral: xsd:string) -> xsd:string<br> IRIs: unescape:xml10, unescape:xml11, unescape:xml<br> This function takes a string literal as input and returns the unescaped XML string.

  • xml11(string: xsd:string) -> xsd:string<br> IRIs: escape:xml11<br> This function takes a string literal as input and returns the XML 1.1 escaped version of the string.

  • xsi(string: xsd:string) -> xsd:string<br> IRIs: escape:xsi<br> Escapes special characters in a string according to the XML Schema Instance (XSI) rules.

  • XX() -> RDF term<br> IRIs: XX<br> A hash function that extends OpenHftHashFunction.

  • YEAR(arg: Literal) -> xsd:integer<br> IRIs: YEAR, xpath:year-from-dateTime, xpath:year-from-date, xpath:years-from-duration<br> Returns the year of a date or datetime value, or converts a duration literal into number of years.

  • yearMonthDuration(year: xsd:integer, month: xsd:integer, [isPositive: xsd:boolean]) -> xsd:duration<br> IRIs: swrlb:yearMonthDuration<br> Creates a yearMonthDuration from the given year and month values, with an optional isPositive flag to indicate whether the duration is positive or negative.

  • zip(arg1: RDF term, arg2: RDF term) -> RDF term<br> IRIs: array:zip<br> This function takes two array literals as input and returns a new array literal where each element is a pair of corresponding elements from the input arrays. If the input arrays are not of the same length, the function returns an error.

  • zipWithIndex(arg: RDF term) -> RDF term<br> IRIs: array:zipWithIndex<br> This function takes an array literal as input and returns a new array literal where each element is a pair of the index and the original element.

Aggregation Functions

  • accuracy<br> IRIs: analytics:accuracy<br> Computes percentage of times two variables have different values. Used with machine learning. Example: accuracy(?original, ?inferred). In SPARQL: sum(if(?a = ?b, 1, 0)) / count(*)

  • array<br> IRIs: stardog:array<br> Constructs an array of elements in the order they are seen.

  • gmean<br> IRIs: stardog:gmean<br> Computes the geometric mean

  • mae<br> IRIs: analytics:mae<br> Computes mean absolute error, i.e., on average, how different are the numeric values of two variables. In SPARQL: sum(abs(?a - ?b)) / count(*).

  • mse<br> IRIs: analytics:mse<br> Computes mean square error, i.e, on average, how much is the squared difference between the numeric values of two variables. In SPARQL: sum((?a - ?b) * (?a - ?b)) / count(*).

  • rmse<br> IRIs: analytics:rmse<br> Computes the square root of the mean square error. In SPARQL: sqrt(sum((?a - ?b) * (?a - ?b)) / count(*)).

  • set<br> IRIs: stardog:set, analytics:set<br> Constructs a sorted array without duplicates from accumulated bindings. Example: set(?element)

  • stddev<br> IRIs: stardog:stddev<br> Computes the standard deviation

  • variance<br> IRIs: stardog:variance<br> Computes the variance

Property Functions

In addition to functions defined in SPARQL, Stardog also supports property functions, represented as special predicates.

FunctionDescription
tag:stardog:api:list:lengthComputes length of RDF list
tag:stardog:api:list:memberPerforms membership operations on RDF lists
tag:stardog:api:property:textMatch or http://jena.hpl.hp.com/ARQ/property#textMatchPerforms full text match against search index
tag:stardog:frequency:predicateComputes frequency of predicates
tag:stardog:frequency:classComputes frequency of classes
tag:stardog:frequency:graphComputes frequency of graphs