Destination types

On this page

    Currently, only updating of in-memory RDF/JS Stores is supported. So not all examples mentioned on this page are possible yet.

    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 \
        -d file@ \
        "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:

    const result = await myEngine.query(`...`, {
      sources: [
        { type: 'file', value: '' },
      destination: { type: 'file', 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

    The default source type is auto, which will automatically detect the proper source type. For example, if a SPARQL Service Description is detected, the sparql type is used.