npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@innotrade/enapso-graphdb-client

v1.9.3

Published

ENAPSO Graph Database Client for Node.js

Downloads

437

Readme

ENAPSO

ENAPSO Graph Database client is an easy-to-use tool to perform SPARQL query and update statements against your knowledge graphs or ontologies stored in your graph database. It can be used with any Node.js application.

As of now, ENAPSO Graph Database Client supports the following graph databases:

More graph databases will be supported added in the future.

In addition to authentication (Basic and JWT), the client handles prefixes, handles errors, and transforms SPARQL result bindings into CSV and TSV files as well as JSON result sets that can be easily processed in JavaScript.

The following tools you also might find useful:

  • ENAPSO Graph Database Admin: Enables you to perform administrative and monitoring operations against your graph databases, such as importing and exporting ontologies or knowledge graphs and utilizing the graph database's special features.
  • ENAPSO Command Line Interface for Graph Databases: Enables you to perform numerous scriptable operations on graph databases, e.g. for monitoring and testing, CI/CD pipelines or backup and restore.

🛠️ Installation

npm i @innotrade/enapso-graphdb-client --save

Create the connection with graph database

const { EnapsoGraphDBClient } = require('@innotrade/enapso-graphdb-client');

let graphDBEndpoint = new EnapsoGraphDBClient.Endpoint({
    baseURL: 'http://localhost:7200',
    repository: 'Test',
    triplestore: 'graphdb', // 'graphdb' or 'fuseki' or 'stardog'
    prefixes: [
        {
            prefix: 'entest',
            iri: 'http://ont.enapso.com/test#'
        }
    ],
    transform: 'toCSV'
});

Parameters

| Parameter | Type | Description | Values | | --------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | | baseURL(required) | String | Pass the URL in which graph database is running. | | | repository(required) | String | Pass the name of the repository or database of the graph databases with which you want to create a connection. | | | prefixes(required) | Array of objects | Pass the prefix and its IRI as an object which will be used in the SPARQL query to perform crud operations. | | | triplestore(optional) | String | Pass the name of the graph database with which you want to create a connection by default it creates a connection with Ontotext GraphDB. | ('graphdb' , 'stardog' , 'fuseki') | | transform(optional) | String | Pass the type in which you want to show the result of SPARQL query by default it shows the result in JSON format. | ('toJSON', 'toCSV' , 'toTSV') |

📋 Features

| Feature | Description | Ontotext GraphDB | Apache Jena Fuseki | Stardog | | ----------------- | ------------------------------------------------------------------ | ---------------- | ------------------ | ------- | | Login | Authenticate user against the graph database | ✔ | ✘ | ✔ | | Query | To retrieve the information from graph database using SPARQL query | ✔ | ✔ | ✔ | | Update | To update the triples in the graph database | ✔ | ✔ | ✔ |

Authentication

graphDBEndpoint.login('admin','root').then((result) => {
        console.log(result);
    })
    .catch((err) => {
        console.log(err);
    });

Query

Query the graph database:

graphDBEndpoint
    .query(
        'select *
where {
    ?class rdf:type owl:Class
    filter(regex(str(?class), "http://ont.enapso.com/test#TestClass", "i")) .
}',
        { transform: 'toJSON' }
    )
    .then((result) => {
        console.log(
            'Read the classes name:\n' + JSON.stringify(result, null, 2)
        );
    })
    .catch((err) => {
        console.log(err);
    });

Update

Update the graph database:

graphDBEndpoint
    .update(
        `insert data {
	   graph <http://ont.enapso.com/test> {
             entest:TestClass rdf:type owl:Class}
           }`
    )
    .then((result) => {
        console.log('inserted a class :\n' + JSON.stringify(result, null, 2));
    })
    .catch((err) => {
        `console.log(err);
    });

📖 Documentation

View the documentation for further usage examples.

🧪 Testing

Tutorial to run the Test suite against the graph database.

😎 Contributing

Contributing is more than just coding. You can support the project in many ways. We will be happy to collaborate with you and we are looking forward to commonly making semantics and knowledge graph technologies available for your projects.

Details of how you can help the project are described in the CONTRIBUTING.md document.

🧑‍🏫 Contributors

💬 Bugs and Feature Requests

Do you have a bug report or a feature request?

Please feel free to add a new issue or write to us in discussion: Any questions and suggestions are welcome.

🧾 License

This project is licensed under the Apache 2.0 License. See the LICENSE file for more details.