@comunica/actor-query-operation-contextify-version
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Comunica Contextify Version Query Operation Actor

npm version Build Status Coverage Status

A Query Operation actor that detects graph-based version operations and rewrites them to operations with a version context.

This module is part of the Comunica framework, and should only be used by developers that want to build their own query engine.

Click here if you just want to query with Comunica.

Install

$ yarn add @comunica/actor-query-operation-contextify-version

Configure

After installing, this package can be added to your engine's configuration as follows:

{
  "@context": [
    ...
    "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-operation-contextify-version/^1.0.0/components/context.jsonld"  
  ],
  "actors": [
    ...
    {
      "@id": "config-sets:contextify-version.json#myContextifyVersionQueryOperator",
      "@type": "ActorQueryOperationContextifyVersion",
      "cbqo:mediatorQueryOperation": { "@id": "config-sets:sparql-queryoperators.json#mediatorQueryOperation" },
      "caqocv:Actor/QueryOperation/ContextifyVersion/baseGraphUri": "http://graph.version.",
      "caqocv:Actor/QueryOperation/ContextifyVersion/numericalVersions": true
    }
  ]
}

Config Parameters

  • caqocv:Actor/QueryOperation/ContextifyVersion/baseGraphUri: The base URI of the graph to contextify. If this is not provided, then graphs will be converted to version identifiers as-is.
  • caqocv:Actor/QueryOperation/ContextifyVersion/numericalVersions: If versions should be parsed as integers.

Examples

Assuming a base graph URI http://ex/g/.

Version Materialization

Input query:

SELECT * WHERE {
  GRAPH <http://ex/g/1> {
    ?s ?p ?o
  }
}

Output context:

{
  "version": {
    "type": "version-materialization",
    "version": 1
  }
}

Output query:

SELECT * WHERE {
  ?s ?p ?o
}

Delta Materialization

Input query:

SELECT * WHERE {
  GRAPH <http://ex/g/4> {
    ?s ?p ?o
  } .
  FILTER (NOT EXISTS {
    GRAPH <http://ex/g/2> {
      ?s ?p ?o
    }
  }) 
}

Output context:

{
  "version": {
    "queryAdditions": true,
    "type": "delta-materialization",
    "versionEnd": 4,
    "versionStart": 2
  }
}

Output query:

SELECT * WHERE {
  ?s ?p ?o
}

Note: Flipping the versions would make this a deletions query instead of an additions query, i.e., queryAdditions would be set to false.

/@comunica/actor-query-operation-contextify-version/

    Package Sidebar

    Install

    npm i @comunica/actor-query-operation-contextify-version

    Weekly Downloads

    25

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    22.6 kB

    Total Files

    11

    Last publish

    Collaborators

    • jeswr
    • joachimvh
    • rubensworks
    • rubenverborgh
    • dexagod