1.3.18 โ€ข Published 11 months ago

@innotrade/enapso-graphdb-cli v1.3.18

Weekly downloads
12
License
Apache-2.0
Repository
github
Last release
11 months ago

ENAPSO

ENAPSO Graph Databases Command Line Interface (CLI) for Node.js

ENAPSO Command Line Interface to easily perform numerous operations on the graph databases. This tool will be continuously extended by further scriptable convenience operations.

As of now, we support the connection with three major graph databases

There will be more graph databases added to this list in the future.

You may also find these tools useful

  • ENAPSO Graph Database Client: To perform SPARQL queries and update statements against your knowledge graphs or ontologies stored in your graph database.
  • ENAPSO Graph Database Admin: To perform administrative and monitoring operations against your graph databases, such as importing and exporting ontologies/knowledge graphs and utilizing the graph database's special features.

๐Ÿ› ๏ธย Installation

npm i -g @innotrade/enapso-graphdb-cli

๐Ÿ“‹ย Features

CommandDescriptionOntotext GraphDBApache Jena FusekiStardog
exportExports (download) the triples from a specific context or a repository of graph database to the local file.โœ”โœ”โœ”
importImports (upload) ontology in a specific context or default graph of graph database repository.โœ”โœ”โœ”
clearRepositoryRemove all triples from the repository of graph database.โœ”โœ”โœ”
createRepositoryCreate a new repository in the graph database.โœ”โœ”โœ”
deleteRepositoryDelete the repository from graph database.โœ”โœ”โœ”
createUserCreate a new user and assign roles in the graph database.โœ”โœ˜โœ”
updateUserUpdate the existing user roles in graph database.โœ”โœ˜โœ˜
assignRolesAssign new roles to the existing user of the graph database.โœ˜โœ˜โœ”
removeRolesRemove existing roles of the user in graph database.โœ˜โœ˜โœ”
deleteUserDelete the user of the graph database.โœ”โœ˜โœ”
garbageCollectionPerform garbage collection in the repository of graph database.โœ”โœ˜โœ˜
getResourcesGet resources used by the repository of graph database.โœ”โœ˜โœ˜
queryPerform read query against ontology imported in the repository of a graph database.โœ”โœ”โœ”
updatePerform update query against ontology imported in the repository of graph database.โœ”โœ”โœ”
importServerFileImport the file which are available on the graphdb server.โœ”โœ”โœ”

Parameters

ParameterAbbreviationParameter Description
dburldBase url in which graph database is running.
repositoryrName of the repository of the graph database with which you want to create a connection
versionVersion of the graph database, by default works with the latest version.
apiTypeApi type of graph database (workbench or RDF4J) to use for import by default it used workbench API.
contextcTo pass the context
usernameuTo pass the name of the user against you want to authenticate yourself in a graph database.
userTo pass the name of the user which you want to delete or update in the graph database.
passwordpPassword to be used for authentication in the graph database.
baseiriiBase iri of the graph e.g. http://ont.enapso.com/ .
targetfiletFile path for exports to file
sourcefilesFile path of import from file.
queryfileqFile path of the query file (SPARQL).
formatfSpecify format of the ontology file.
authoritiesfPass the user roles of the graph database

Download a repository or a specific named graph from graph database to a file:

enapsogdb export --dburl "http://localhost:7200" --repository "Test" --context "http://ont.enapso.com/test" --targetfile "exports/export.ttl" --username "admin" --password "root" --format "text/turtle"

Upload from a file to the repository of graph database:

enapsogdb import --dburl "http://localhost:7200" --repository "Test" --context "http://ont.enapso.com/test" --baseiri "http://ont.enapso.com/test#" --sourcefile "imports/dotnetpro_demo_ontology_2.owl" --username "admin" --password "root" --format "application/rdf+xml"

Upload from a file to the repository of graph database using RDF4J API:

enapsogdb import --dburl "http://localhost:7200" --apiType "RDF4J" --repository "Test" --context "http://ont.enapso.com/test" --baseiri "http://ont.enapso.com/test#" --sourcefile "imports/dotnetpro_demo_ontology_2.owl" --username "admin" --password "root" --format "application/rdf+xml"

Import file which are available on the server

enapsogdb importServerFile --dburl "http://localhost:7200" --repository "Test" --context "http://ont.enapso.com/test" --baseiri "http://ont.enapso.com/test#" --filename "dotnetpro_demo_ontology_2.owl" --username "admin" --password "root"

Clear the entire repository. Caution! Use this command with care! The operation cannot be undone!

enapsogdb clearRepository --dburl "http://localhost:7200" --repository "Test" --username "admin" --password "root"

Clear specific named graphs from a graph database repository. Caution! Use this command with care! The operation cannot be undone!

enapsogdb clearContext --dburl "http://localhost:7200" --repository "Test" --context "http://ont.enapso.com/test" --username "admin" --password "root"

Perform the garbage collection of the Graph Database.

enapsogdb gc --dburl "http://localhost:7200" --username "admin" --password "root"

Get resources of the Graph Database.

enapsogdb gc --dburl "http://localhost:7200" --username "admin" --password "root"

Create New Repository in the Graph Database.

enapsogdb createRepository --dburl "http://localhost:7200" --repository "TestRepository" --repotitle "Test Repository" --username "admin" --password "root"

Delete Repository of Graph Database.

enapsogdb deleteRepository --dburl "http://localhost:7200" --repository "TestRepository" --username "admin" --password "root"

Create a new user in the Graph Database.

enapsogdb createUser --dburl "http://localhost:7200" --repository "Test" --username "admin" --password "root" --newusername "TestUser" --newpassword "TestUser" -a "ROLE_USER WRITE_REPO_Test READ_REPO_Test READ_REPO_EnapsoDotNetProDemo"

Update existing users of the Graph Database.

enapsogdb updateUser --dburl "http://localhost:7200" --repository "Test" --username "admin" --password "root" --user "TestUser" --newpassword "TestUser" -a "ROLE_USER WRITE_REPO_Test READ_REPO_Test WRITE_REPO_EnapsoDotNetProDemo READ_REPO_EnapsoDotNetProDemo"

Assign a role to an existing user of the Graph Database.

enapsogdb assignRoles --dburl "http://localhost:5820" --repository "Test" --username "admin" --password "admin" --user "TestUser" --newpassword "TestUser" -a '[{"action":"READ","resource_type":"db","resource":["Test"]},{"action":"WRITE","resource_type":"db","resource":["Test"]}]' --triplestore "stardog"

Remove roles of the existing user of graph database.

enapsogdb removeRoles --dburl "http://localhost:5820" --repository "Test" --username "admin" --password "admin" --user "TestUser" --newpassword "TestUser" -a '[{"action":"READ","resource_type":"db","resource":["Test"]},{"action":"WRITE","resource_type":"db","resource":["Test"]}]' --triplestore "stardog"

Delete existing users of the graph database.

enapsogdb deleteUser --dburl "http://localhost:7200" --repository "Test" --username "admin" --password "root" --user "TestUser"

Read the data from graph database

enapsogdb query --dburl "http://localhost:7200" --repository "Test" --username "admin" --password "root" --queryfile "queries/all.sparql" --prefixfile "queries/prefixes.prf" --targetfile "results/countries.csv"

Update the data of the graph database

enapsogdb update --dburl "http://localhost:7200" --repository "Test" --username "admin" --password "root" --queryfile "queries/createClass.sparql" --prefixfile "queries/prefixes.prf"

enapso-graphdb-cli project contain the shell script, which check the memory used by graph database if it is more than 4 GB then it perform the garbage collection.

Prerequisites

  1. Install and run GraphDB 10.x (https://graphdb.ontotext.com/)
  2. Set the following variables in shell script file (../shell-script/auto-perform-garbage-collection.sh)
    1. repo name of the repository of Graph database by default, it's value is "Test".
    2. baseURL URL on which graph database is running by default, it' value is "http://localhost:7200".
    3. user name of the user of the graph database by default, it' value is "admin".
    4. password password of the user of the graph database by default, it' value is "root".
    5. reprtFile path of result output by default, it's value is "../Report/resource-report.txt".

How to run shell script

To run the shell script available at ../shell-scripts/auto-perform-garbage-collection.sh access permission needs to be granted to the shell script and enapso-graphdb-cli executable (../enapso-graphdb-cli-exe/) which is corresponding to your operating system to run it successfully.

The following file types are supported:

name: "JSON",
type: "application/rdf+json",
extension: ".json"

name: "JSON-LD",
type: "application/ld+json",
extension: ".jsonld"

name: "RDF-XML",
type: "application/rdf+xml",
extension: ".rdf"

name: "N3",
type: "text/rdf+n3",
extension: ".n3"

name: "N-Triples",
type: "text/plain",
extension: ".nt"

name: "N-Quads",
type: "text/x-nquads",
extension: ".nq"

name: "Turtle",
type: "text/turtle",
extension: ".ttl"

name: "TriX",
type: "application/trix",
extension: ".trix"

name: "TriG",
type: "application/x-trig",
extension: ".trig"

name: "Binary RDF",
type: "application/x-binary-rdf",
extension: ".brf"

๐Ÿงชย Testing

Tutorial to run the Test suite against the graph database.

๐Ÿ˜Žย Contributing

Contributing is more than just coding. You can help the project in many ways, and we will be very happy to accept your contribution to our project.

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.

1.3.17

11 months ago

1.3.18

11 months ago

1.3.16

11 months ago

1.3.13

1 year ago

1.3.14

1 year ago

1.3.15

1 year ago

1.3.10

1 year ago

1.3.11

1 year ago

1.3.12

1 year ago

1.3.7

2 years ago

1.3.9

2 years ago

1.3.8

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.9

2 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

0.3.0

4 years ago