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.
| Term | Kind | Description |
|---|---|---|
tt:camelCase | Function | |
tt:colognePhonetic | Function | Kölner Phonetik, as Apache Commons Codec. |
tt:cosine | Function | Cosine similarity, from -1 to 1; no value when a vector is all zeros. As Stardog's metric:cosineSimilarity. |
tt:daysBetween | Function | Whole days, months, years from the first date to the second (negative when earlier). |
tt:dot | Function | |
tt:encodeForIri | Function | R2RML'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:first | Aggregate | The first and last value in the order the rows reach the aggregate. |
tt:format | Function | The same templates, not encoded; SPIF's {?1} placeholders work too. afn:sprintf is in D.1. |
tt:formatDate | Function | Java patterns on xsd:date, xsd:dateTime and xsd:time. |
tt:iri | Function | {0}, {1} (or {} in turn) filled with the arguments, percent-encoded; {{ / }} are braces. |
tt:jaroWinkler | Function | |
tt:l2 | Function | |
tt:last | Aggregate | The first and last value in the order the rows reach the aggregate. |
tt:leftPad | Function | |
tt:levenshtein | Function | Code points; n-gram similarity is the Jaccard index of the n-gram sets (n = 2 by default). |
tt:median | Aggregate | The continuous median: the mean of the two middle values of an even count. |
tt:mode | Aggregate | The most frequent value, of any kind; of equally frequent values the first one met. |
tt:monthsBetween | Function | |
tt:ngramSimilarity | Function | |
tt:normalizeWhitespace | Function | |
tt:parseDate | Function | Java 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:percentile | Aggregate | p from 0 to 1, a constant; linear interpolation between the closest ranks, as SQL's PERCENTILE_CONT. Unbound outside 0..1. |
tt:rightPad | Function | |
tt:skolem | Function | As 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:snakeCase | Function | |
tt:stddev | Aggregate | Sample standard deviation, an xsd:double. |
tt:stddevPop | Aggregate | Population standard deviation, an xsd:double. |
tt:titleCase | Function | |
tt:topK | Aggregate | The k largest numbers, largest first, as one string separated by spaces (as GROUP_CONCAT). |
tt:trim | Function | |
tt:variance | Aggregate | Sample variance (divided by n - 1); unbound for one value. |
tt:varPop | Aggregate | Population variance (divided by n). |
tt:yearsBetween | Function | |
tt:vector | Datatype |