Registry / database / trifid-handler-fetch

trifid-handler-fetch

JSON →
library3.5.1jsnpmunverified

A Trifid plugin (v3.5.1) that exposes a SPARQL query endpoint backed by a static in-memory dataset loaded from a URL (local file or remote resource) at server startup. Uses Oxigraph for RDF storage and query evaluation. Supports multiple serialization formats (Turtle, TriG, N-Triples, N-Quads, N3, RDF/XML). The dataset is not refreshed automatically after initial load. Released on npm with TypeScript type declarations.

npm install trifid-handler-fetch
INSTALL
IMPORT
SIG · TRIFID-HANDLER-FET
T
trifid-handler-fetch
databasejavascriptv3.5.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import trifidHandlerFetch from 'trifid-handler-fetch'
const { trifidHandlerFetch } = require('trifid-handler-fetch')
This is a default export, not named. CommonJS require returns the function directly.
trifidHandlerFetch
import { default as trifidHandlerFetch } from 'trifid-handler-fetch'
import { trifidHandlerFetch } from 'trifid-handler-fetch'
There is no named export 'trifidHandlerFetch' — it's the default export. Use default import.
type TrifidHandlerFetchOptions
import type { TrifidHandlerFetchOptions } from 'trifid-handler-fetch'
import { TrifidHandlerFetchOptions } from 'trifid-handler-fetch'
Options type is exported as a named type; import with 'type' keyword in TypeScript.

Configures trifid-handler-fetch in a Trifid server, loading a Turtle file into an in-memory Oxigraph store and exposing a SPARQL endpoint at /sparql.

import trifidHandlerFetch from 'trifid-handler-fetch'; import { createServer } from 'trifid-core'; const server = await createServer({ plugins: { 'handler-fetch': { module: 'trifid-handler-fetch', paths: '/sparql', config: { url: 'https://example.org/data.ttl', contentType: 'text/turtle', baseIRI: 'http://example.com/base', graphName: 'http://example.com/graph', unionDefaultGraph: false, queryLogLevel: 'info' } } } }); await server.start();
Debug
Known issues
gotchaDataset is loaded once at startup and never re-fetched; changes to the remote resource are not reflected unless the server is restarted.
fix
Implement a periodic reload mechanism or use a different handler that supports live updates.
affects: >=3.0.0
deprecatedThe 'contentType' option should match the serialization format; using an incorrect MIME type may cause parse errors.
fix
Ensure the 'contentType' matches the actual format of the resource (e.g., 'text/turtle' for .ttl files).
affects: >=3.0.0
gotchaThe 'graphName' option only applies to triple serializations; for quad formats like TriG or N-Quads, graph information in the file is preserved and 'graphName' may be ignored.
fix
Use 'unionDefaultGraph: true' with triple formats to load triples into the default graph instead of a named graph.
affects: >=3.0.0
gotchaWhen using 'unionDefaultGraph: false' and 'graphName' is set, SPARQL queries must specify the graph name in the FROM clause, otherwise no results will be returned.
fix
Include the graph name in SPARQL queries, e.g., SELECT * FROM <http://example.com/graph> WHERE { ?s ?p ?o }.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Unsupported content type: application/rdf+xml
The 'contentType' option is set to an unsupported or misspelled MIME type.
fix
Set 'contentType' to one of the supported values: text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/rdf+xml.
TypeError: trifidHandlerFetch is not a function
Using named import instead of default import.
fix
Use default import: import trifidHandlerFetch from 'trifid-handler-fetch'.
Error: Invalid IRI: undefined
The 'url' option is missing or set to an undefined value.
fix
Provide a valid URL string in the 'url' option.
Upgrade
Version history
3.5.1latest on npm
Audit
Dependencies
trifid-corerequiredPeer dependency; required to integrate as a Trifid plugin
oxigraphrequiredUsed for in-memory RDF store and SPARQL query execution; loaded at startup
Agent activity
27 hits · last 30 days
node
22
Meta
2
OpenAI (training)
1
Resources
trifid-handler-fetch — npm install trifid-handler-fetch · libregistry