trifid-handler-fetch
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

trifid-handler-fetch

This Trifid plugin exposes an endpoint where you can perform SPARQL queries against a dataset which is loaded from a URL.

The URL can be a local file or a remote resource.

At the start of the server, the dataset is loaded from the URL and stored in memory, using Oxigraph. The dataset is not updated automatically when the resource changes.

Usage

Add the trifid-handler-fetch package to your dependencies:

npm install trifid-handler-fetch

And update the Trifid configuration to something similar as shown in the example below.

Example

This example config uses The Big Bang Theory dataset:

plugins:
  # […]
  handler-fetch:
    module: "trifid-handler-fetch"
    paths: /query
    config:
      url: https://raw.githubusercontent.com/zazuko/tbbt-ld/master/dist/tbbt.nt
      contentType: application/n-triples
      baseIRI: http://example.com
      graphName: http://example.com/graph

Options

  • url: URL to the resource which contains the dataset
  • contentType: the format of the serialization. See below for the supported formats.
  • baseIRI: the base IRI to use to resolve the relative IRIs in the serialization.
  • graphName: for triple serialization formats, the name of the named graph the triple should be loaded to.
  • unionDefaultGraph: for triple serialization formats, if the triples should be loaded to the default graph or to the named graph specified in graphName. This impacts also the need or not to query a specific graph in SPARQL queries. Defaults to false.

Supported formats:

  • Turtle: text/turtle or ttl
  • TriG: application/trig or trig
  • N-Triples: application/n-triples or nt
  • N-Quads: application/n-quads or nq
  • N3: text/n3 or n3
  • RDF/XML: application/rdf+xml or rdf

Readme

Keywords

none

Package Sidebar

Install

npm i trifid-handler-fetch

Weekly Downloads

114

Version

3.0.0

License

MIT

Unpacked Size

22.9 kB

Total Files

17

Last publish

Collaborators

  • ludovicm67
  • zazuko-bot