Metreeca Wire
    Preparing search index...

    Builders for SPARQL queries and updates.

    Provides composable combinators that assemble SPARQL request strings from typed fragments: update operations, graph patterns, property paths, expressions, aggregates, solution modifiers, and the serialisers that render RDF terms into their SPARQL lexical forms. Every combinator takes and returns SPARQL fragments, so clauses nest by ordinary function composition into a complete query or update.

    Term content is escaped wherever the grammar defines an escape and validated wherever it does not, so no value rendered through the serialisers can break out of the token carrying it.

    Warning

    Blank-node labels are the exception: BLANK_NODE_LABEL defines no escape and blank performs no check, so a malformed label breaks the fragment carrying it rather than rendering as data.

    Types

    • Mixed — the spread-or-array argument shape accepted by the variadic combinators

    Updates

    Queries

    Graph patterns

    Property paths

    Expressions

    Built-in functions

    Aggregates

    Serialisers

    Usage

    Combinators nest as plain expressions, so a whole request is written as one composition:

    const product = variable("product"); // ?product, minted by the package entry module
    const name = variable("name"); // ?name

    const query = select([name],
    where(
    edge(product, reference("https://schema.org/name"), name),
    filter(langMatches(lang(name), "en"))
    ),
    orderBy(asc(name)),
    limit(10)
    );

    Type Aliases

    Mixed

    A variadic parameter mixing bare values and arrays of values in a single argument list.

    Functions

    update

    Combines SPARQL update operations into a single request.

    deleet

    Generates a SPARQL DELETE update removing triples from the graph store.

    insert

    Generates a SPARQL INSERT update adding triples to the graph store.

    witt

    Generates a SPARQL WITH update scoping an operation to a named graph.

    using

    Generates SPARQL USING clauses declaring an update's default-graph dataset.

    usingNamed

    Generates SPARQL USING NAMED clauses adding named graphs to an update dataset.

    ask

    Generates a SPARQL ASK query.

    select

    Generates a SPARQL SELECT query.

    distinct

    Generates a SPARQL distinct modifier over a projection or aggregate argument.

    reduced

    Generates a SPARQL reduced modifier over a projection.

    all

    Generates the SPARQL * projection wildcard.

    as

    Generates a SPARQL projection alias, naming a computed expression as a result variable.

    from

    Generates SPARQL FROM clauses declaring a query's default-graph dataset.

    fromNamed

    Generates SPARQL FROM NAMED clauses adding named graphs to a query dataset.

    groupBy

    Generates a SPARQL GROUP BY clause.

    having

    Generates a SPARQL HAVING clause.

    orderBy

    Generates a SPARQL ORDER BY clause.

    asc

    Generates a SPARQL asc() ascending order condition.

    desc

    Generates a SPARQL desc() descending order condition.

    limit

    Generates a SPARQL LIMIT clause.

    offset

    Generates a SPARQL OFFSET clause.

    where

    Generates a SPARQL WHERE clause.

    union

    Generates a SPARQL UNION pattern.

    optional

    Generates a SPARQL OPTIONAL group pattern.

    group

    Generates a SPARQL group graph pattern.

    minus

    Generates a SPARQL MINUS pattern.

    graph

    Generates a SPARQL GRAPH block scoping patterns to a named graph.

    service

    Generates a SPARQL SERVICE block delegating patterns to a federated endpoint.

    values

    Generates a SPARQL VALUES inline-data block.

    fragment

    Generates a single SPARQL fragment by joining clauses.

    edge

    Assembles a SPARQL subject predicate object . statement from pre-rendered terms.

    filter

    Generates a SPARQL FILTER constraint.

    bind

    Generates a SPARQL bind clause, assigning a computed expression to a variable in the WHERE body.

    nil

    Generates an empty SPARQL fragment.

    seq

    Generates a SPARQL sequence property path.

    alt

    Generates a SPARQL alternative property path.

    inv

    Generates a SPARQL inverse property path.

    star

    Generates a SPARQL zero-or-more (*) property path.

    plus

    Generates a SPARQL one-or-more (+) property path.

    opt

    Generates a SPARQL zero-or-one (?) property path.

    none

    Generates a SPARQL none property set.

    not

    Generates a SPARQL logical negation (!) of a boolean expression.

    and

    Generates a SPARQL logical conjunction (&&) of boolean expressions.

    or

    Generates a SPARQL logical disjunction (||) of boolean expressions.

    eq

    Generates a SPARQL equality (=) comparison.

    ne

    Generates a SPARQL inequality (!=) comparison.

    gt

    Generates a SPARQL greater-than (>) comparison.

    lt

    Generates a SPARQL less-than (<) comparison.

    gte

    Generates a SPARQL greater-than-or-equal (>=) comparison.

    lte

    Generates a SPARQL less-than-or-equal (<=) comparison.

    add

    Generates a SPARQL addition (+) of two numeric expressions.

    sub

    Generates a SPARQL subtraction (-) of two numeric expressions.

    mul

    Generates a SPARQL multiplication (*) of two numeric expressions.

    div

    Generates a SPARQL division (/) of two numeric expressions.

    iif

    Generates a SPARQL if() conditional expression.

    coalesce

    Generates a SPARQL coalesce() call returning the first argument that evaluates without error.

    isBound

    Generates a SPARQL bound() variable-binding test.

    isIn

    Generates a SPARQL set-membership (IN) test.

    isNotIn

    Generates a SPARQL set-non-membership (NOT IN) test.

    exists

    Generates a SPARQL exists graph-pattern test.

    nexists

    Generates a SPARQL not exists graph-pattern test.

    call

    Generates a SPARQL function call from a function name and argument expressions.

    str

    Generates a SPARQL str() call rendering a term's lexical form as a plain literal.

    lang

    Generates a SPARQL lang() call extracting a literal's language tag.

    datatype

    Generates a SPARQL datatype() call extracting a literal's datatype IRI.

    isBlank

    Generates a SPARQL isblank() term-kind test.

    isIRI

    Generates a SPARQL isiri() term-kind test.

    isLiteral

    Generates a SPARQL isliteral() term-kind test.

    isNumeric

    Generates a SPARQL isnumeric() term-kind test.

    sameTerm

    Generates a SPARQL sameterm() identity test.

    iri

    Generates a SPARQL iri() call constructing an IRI from a string expression.

    bnode

    Generates a SPARQL bnode() call minting a blank node.

    strdt

    Generates a SPARQL strdt() call constructing a datatype-annotated literal.

    strlang

    Generates a SPARQL strlang() call constructing a language-tagged literal.

    uuid

    Generates a SPARQL uuid() call minting a fresh UUID IRI.

    struuid

    Generates a SPARQL struuid() call minting a fresh UUID string.

    strlen

    Generates a SPARQL strlen() call returning a string's length.

    substr

    Generates a SPARQL substr() call extracting a substring.

    ucase

    Generates a SPARQL ucase() call upper-casing a string.

    lcase

    Generates a SPARQL lcase() call lower-casing a string.

    strstarts

    Generates a SPARQL strstarts() call testing a string prefix.

    strends

    Generates a SPARQL strends() call testing a string suffix.

    contains

    Generates a SPARQL contains() call testing for a substring.

    strbefore

    Generates a SPARQL strbefore() call returning the portion before a substring.

    strafter

    Generates a SPARQL strafter() call returning the portion after a substring.

    encodeForUri

    Generates a SPARQL encode_for_uri() call percent-encoding a string.

    concat

    Generates a SPARQL concat() call joining string expressions.

    langMatches

    Generates a SPARQL langmatches() call testing a language tag against a range.

    regex

    Generates a SPARQL regex() call testing a string against a pattern.

    replace

    Generates a SPARQL replace() call substituting pattern matches.

    abs

    Generates a SPARQL abs() call returning a number's absolute value.

    round

    Generates a SPARQL round() call rounding a number to the nearest integer.

    ceil

    Generates a SPARQL ceil() call rounding a number up to an integer.

    floor

    Generates a SPARQL floor() call rounding a number down to an integer.

    rand

    Generates a SPARQL rand() call returning a random number.

    now

    Generates a SPARQL now() call returning the query execution timestamp.

    year

    Generates a SPARQL year() call extracting a dateTime's year.

    month

    Generates a SPARQL month() call extracting a dateTime's month.

    day

    Generates a SPARQL day() call extracting a dateTime's day.

    hours

    Generates a SPARQL hours() call extracting a dateTime's hours.

    minutes

    Generates a SPARQL minutes() call extracting a dateTime's minutes.

    seconds

    Generates a SPARQL seconds() call extracting a dateTime's seconds.

    timezone

    Generates a SPARQL timezone() call extracting a dateTime's timezone as a duration.

    tz

    Generates a SPARQL tz() call extracting a dateTime's timezone as a string.

    md5

    Generates a SPARQL md5() call returning a string's MD5 digest.

    sha1

    Generates a SPARQL sha1() call returning a string's SHA-1 digest.

    sha256

    Generates a SPARQL sha256() call returning a string's SHA-256 digest.

    sha384

    Generates a SPARQL sha384() call returning a string's SHA-384 digest.

    sha512

    Generates a SPARQL sha512() call returning a string's SHA-512 digest.

    count

    Generates a SPARQL count() aggregate.

    sum

    Generates a SPARQL sum() aggregate.

    min

    Generates a SPARQL min() aggregate.

    max

    Generates a SPARQL max() aggregate.

    avg

    Generates a SPARQL avg() aggregate.

    sample

    Generates a SPARQL sample() aggregate.

    groupConcat

    Generates a SPARQL group_concat() aggregate.

    patterns

    Generates SPARQL triple patterns from a Pattern sequence.

    pattern

    Generates a SPARQL triple pattern.

    triples

    Generates SPARQL triple data from a Triple sequence.

    triple

    Generates the SPARQL representation of a single Triple.

    anchor

    Generates the SPARQL representation of a Variable or Term.

    variable

    Generates the SPARQL representation of a Variable.

    term

    Generates the SPARQL representation of a Term.

    blank

    Generates the SPARQL representation of a blank node.

    reference

    Generates the SPARQL IRIREF for an IRI.

    boolean

    Generates the SPARQL representation of a boolean value.

    number

    Generates the SPARQL representation of a numeric value.

    string

    Generates the SPARQL representation of a string value.

    tagged

    Generates a language-tagged RDF literal.

    typed

    Generates a datatype-annotated RDF literal.