Vocabularies

Functions

PREFIX tt: <http://w3id.org/tripletrail/fn#>

TripleTrail's own SPARQL functions and aggregates: building IRIs and keys, strings, dates, lists, statistics, full-text search and vectors.

Turtle: fn.ttl. Reference: Function matrix · Full-text search · Vector search.

TermKindDescription
tt:camelCaseFunction
tt:colognePhoneticFunctionKölner Phonetik, as Apache Commons Codec.
tt:cosineFunctionCosine similarity, from -1 to 1; no value when a vector is all zeros. As Stardog's metric:cosineSimilarity.
tt:daysBetweenFunctionWhole days, months, years from the first date to the second (negative when earlier).
tt:dotFunction
tt:encodeForIriFunctionR2RML's IRI-safe form of a value: every character but the iunreserved ones (ASCII letters, digits, -._~ and letters outside ASCII) percent-encoded; ENCODE_FOR_URI encodes letters outside ASCII too. Used by tripletrail lift --as-sparql.
tt:firstAggregateThe first and last value in the order the rows reach the aggregate.
tt:formatFunctionThe same templates, not encoded; SPIF's {?1} placeholders work too. afn:sprintf is in D.1.
tt:formatDateFunctionJava patterns on xsd:date, xsd:dateTime and xsd:time.
tt:iriFunction{0}, {1} (or {} in turn) filled with the arguments, percent-encoded; {{ / }} are braces.
tt:jaroWinklerFunction
tt:l2Function
tt:lastAggregateThe first and last value in the order the rows reach the aggregate.
tt:leftPadFunction
tt:levenshteinFunctionCode points; n-gram similarity is the Jaccard index of the n-gram sets (n = 2 by default).
tt:medianAggregateThe continuous median: the mean of the two middle values of an even count.
tt:modeAggregateThe most frequent value, of any kind; of equally frequent values the first one met.
tt:monthsBetweenFunction
tt:ngramSimilarityFunction
tt:normalizeWhitespaceFunction
tt:parseDateFunctionJava patterns (dd.MM.yyyy, yyyy-MM-dd HH:mm, d MMM yyyy h:mm a, yyyyMMdd'T'HHmmssX). xsd:date without time fields, xsd:dateTime with them. English month and day names; the timezone is an offset (+01:00, Z, UTC).
tt:percentileAggregatep from 0 to 1, a constant; linear interpolation between the closest ranks, as SQL's PERCENTILE_CONT. Unbound outside 0..1.
tt:rightPadFunction
tt:skolemFunctionAs RDFox SKOLEM: the prefix followed by 32 hex digits of the SHA-256 of the arguments' terms (kind, lexical form, datatype or language), so the same values always give the same IRI and 3 differs from "3". A relative prefix is resolved against the query's base.
tt:snakeCaseFunction
tt:stddevAggregateSample standard deviation, an xsd:double.
tt:stddevPopAggregatePopulation standard deviation, an xsd:double.
tt:titleCaseFunction
tt:topKAggregateThe k largest numbers, largest first, as one string separated by spaces (as GROUP_CONCAT).
tt:trimFunction
tt:varianceAggregateSample variance (divided by n - 1); unbound for one value.
tt:varPopAggregatePopulation variance (divided by n).
tt:yearsBetweenFunction
tt:vectorDatatype