Destination types

On this page

    Comunica SPARQL supports update queries to add, delete, or change data on both the command line and when calling Comunica from a JavaScript application.

    Update queries typically consists of two parts:

    1. Query pattern to select data from a source;
    2. Quads to add or delete based on the query pattern into a destination.

    In most cases, the source and destination are equal, such as when modifying data in an in-memory RDF/JS Store.

    Since Comunica decouples source and destination, it is possible to read data from one place, and apply changes in another place.

    Usually, destinations are passed as URLs that point to Web resources. Based on what is returned when dereferencing this URL, Comunica can apply different update algorithms.

    Instead of relying on Comunica's detection algorithms, you can enforce the use of a certain type.

    Some SPARQL endpoints may be recognised as a file instead of a SPARQL endpoint due to them not supporting SPARQL Service Description, which may produce incorrect results. For these cases, the sparql type MUST be set.
    When enabling the info logger, you can derive what type Comunica has determined for each destination.

    Setting destination type on the command line

    Destination types can optionally be enforced by prefixing the URL with <typeName>@, such as

    $ comunica-sparql \
        --to patchSparqlUpdate@ \
        "INSERT DATA { <ex:s> <ex:p> <ex:o> }"

    Setting destination type in an application

    Via a JavaScript application, the destination type can be set by using a hash containing type and value:

    await myEngine.queryVoid(`...`, {
      sources: [
        { type: 'file', value: '' },
      destination: { type: 'patchSparqlUpdate', value: '' },

    Supported destination types

    The table below summarizes the different destination types that Comunica supports by default:

    Type nameDescription
    rdfjsStoreJavaScript objects implementing the RDF/JS store interface
    sparqlSPARQL endpoint
    putLdpLinked Data Platform HTTP APIs accepting PUT requests containing an RDF document, such as Solid servers.
    patchSparqlUpdateLinked Data Platform HTTP APIs accepting PATCH requests containing SPARQL Update queries (application/sparql-update), such as Solid servers.

    The default source type is auto, which will automatically detect the proper source type. For example, if an Accept-Patch: application/sparql-update header is detected, the patchSparqlUpdate type is used.