Registry / database / graphdb

graphdb

JSON →
library4.0.0jsnpmunverified

JavaScript client library for interacting with GraphDB and RDF4J REST API. v4.0.0 supports Node.js >=14.17.0. Provides ServerClient for RDF4J API and GraphDBServerClient for GraphDB-specific features. Includes TypeScript definitions. Key differentiator: seamless integration of RDF4J and GraphDB APIs in Node.js. Release cadence: major versions with breaking changes. Built on RDF/JS data model.

npm install graphdb
INSTALL
IMPORT
SIG · GRAPHDB
G
graphdb
databasejavascriptv4.0.0
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.

ServerClient
import { ServerClient } from 'graphdb'
const ServerClient = require('graphdb')
ESM-only import; library does not provide default export
GraphDBServerClient
import { GraphDBServerClient } from 'graphdb'
import GraphDBServerClient from 'graphdb'
Named export, not default
RDFMimeType
import { RDFMimeType } from 'graphdb'
import { RDFMimeType } from 'graphdb/lib/utils'
Re-exported from index; do not use internal paths
Repository
import { Repository } from 'graphdb'
RDF4J repository abstraction
types
import type { RepositorySettings } from 'graphdb'
import { RepositorySettings } from 'graphdb' (value import)
RepositorySettings is a type-only export

Shows how to import ServerClient, list repositories, and execute a SPARQL query.

import { ServerClient, RDFMimeType } from 'graphdb'; const endpoint = 'http://localhost:7200'; const repositoryId = 'my-repo'; const client = new ServerClient(endpoint); // List all repositories client.getRepositories() .then(repos => { console.log('Repositories:', repos); }) .catch(err => { console.error('Error:', err); }); // Query a repository async function query() { const repo = client.getRepository(repositoryId); const query = 'SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10'; const result = await repo.query(query, { mimeType: RDFMimeType.SPARQL_RESULTS_JSON }); console.log(result); } query();
Debug
Known issues
breakingv4.0.0: Removed default export; all exports are named.
fix
Use named imports (e.g., import { ServerClient } from 'graphdb').
affects: >=4.0.0
breakingv4.0.0: Dropped support for Node <14.17.0.
fix
Upgrade Node.js to >=14.17.0.
affects: >=4.0.0
deprecatedv3.x: Some methods like `getRepository()` may change signature in v4.
fix
Review v4 migration guide for method signatures.
affects: 3.x
gotchaThe library uses ESM-only distribution. Using require() returns empty object.
fix
Use ES import syntax or dynamic import().
affects: >=4.0.0
gotchaTypeScript definitions are bundled but may not cover all RDF/JS types.
fix
Install @types/rdf-js if you need full RDF/JS typings.
affects: all
Errors
Common errors & fixes
TypeError: graph_db.ServerClient is not a constructor
Using require() on ESM-only package.
fix
Use import { ServerClient } from 'graphdb' or dynamic import.
Cannot find module 'graphdb' or its corresponding type declarations.
Missing TypeScript types or incorrect import path.
fix
Ensure graphdb >=4.0.0 is installed and tsconfig.json has 'moduleResolution': 'node'.
TypeError: Cannot read properties of undefined (reading 'getRepository')
Client connection failed or repository ID is invalid.
fix
Check endpoint URL and repository existence.
Upgrade
Version history
4.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Resources
graphdb — npm install graphdb · libregistry