Skip to main content

TripleStore

This service allows you to interface with a Jena Fuseki triple store.

Features​

  • Basic triplestore operations (Query, Update, Insert, Delete)
  • Dataset management

Sub-services​

Dependencies​

  • None

Install​

$ yarn add @semapps/triplestore

Usage​

const { TripleStoreService } = require('@semapps/triplestore');

module.exports = {
mixins: [TripleStoreService],
settings: {
url: 'http://localhost:3030/',
user: 'admin',
password: 'admin',
mainDataset: 'myDataSet',
}
};

Settings​

PropertyTypeDefaultDescription
urlStringrequiredJena Fuseki's root URL
userStringrequiredJena Fuseki's admin login
passwordStringrequiredJena Fuseki's admin password
mainDatasetStringrequiredDefault dataset

Actions​

The following service actions are available:

countTripleOfSubject​

  • Count all triples associated with a subject
Parameters​
PropertyTypeDefaultDescription
uriStringrequiredSubject
webIdStringLogged user's webIdUser doing the action
datasetStringMain datasetDataset where to execute the operation
graphNameStringDefault graphGraph where to execute the operation
Return​

Integer - Number of triples associated with the given subject

deleteOrphanBlankNodes​

  • Delete all orphan blank nodes in a given dataset and graph
Parameters​
PropertyTypeDefaultDescription
datasetStringMain datasetDataset where to execute the operation
graphNameStringDefault graphGraph where to execute the operation
Return​

None

dropAll​

  • Delete all triples on the given dataset
Parameters​
PropertyTypeDefaultDescription
webIdStringLogged user's webIdUser doing the action
datasetStringMain datasetDataset where to execute the operation
Return​

None

insert​

  • Insert a list of triples
  • Accept triples, turtle or JSON-LD (see @semapps/mime-types package)
Parameters​
PropertyTypeDefaultDescription
resourceObject, StringrequiredTriples to insert
contentTypeStringtext/turtleType of data provided (application/ld+json, text/turtle or application/n-triples)
webIdStringLogged user's webIdUser doing the action
datasetStringMain datasetDataset where to insert the data
graphNameStringDefault graphGraph where to insert the data
Return​

None

query​

  • Execute a SPARQL Query and return result in accept type provided
  • SELECT, CONSTRUCT, ASK queries are supported
  • Accept triples, turtle or JSON-LD (see @semapps/mime-types package)
Parameters​
PropertyTypeDefaultDescription
queryString or ObjectrequiredSPARQL query to execute (as a string or SPARQL.js object)
acceptStringrequiredType to return (application/ld+json, text/turtle or application/n-triples)
webIdStringLogged user's webIdUser doing the action
datasetStringMain datasetDataset where to execute the query
Return​

String or Object depending on accept

update​

  • Execute a SPARQL update query
  • DELETE, INSERT queries supported (see specifications)
Parameters​
PropertyTypeDefaultDescription
queryString or ObjectrequiredSPARQL Update to execute (as a string or SPARQL.js object)
webIdstringLogged user's webIdUser doing the action
datasetStringMain datasetDataset where to execute the operation
Return​

None