woql-clients
[![code helpers]
Promise based woql client for the browser and node.js
Requirements
Installation
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js. Node.js 0.10 or higher is required.
Installation is done using the npm install command:
Using npm:
$ npm install --save @terminusdb/woql-client
Using cdn:
<script src="https://unpkg.com/@terminusdb/woql-client/dist/woql-client.min.js"></script>
Usage
const TerminusDB = require('@terminusdb/woql-client');
const client = new TerminusDB.WOQLClient();
client.connect("http://localhost:6363/", 'root').
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
})
.finally(function () {
});
async function getCapabilities() {
try {
const response = await client.connect("http://localhost:6363/", 'root');
console.log(response);
} catch (err) {
console.error(err);
}
}
Options
connections options.
To initialize TerminusDB woql-client
with custom options use
const TerminusDB = require('@terminusdb/woql-client')
const client = new TerminusDB.WOQLClient({
server:"http://localhost:6363/",
dbid:"test_db",
include_key:true
});
API
createDatabase([dburl:String, details:Object, key:String]):Object
Create a new terminusDB database in the current terminusDB server
var currentTerminusServerUrl=client.connectionConfig.dbURL();
var details={
"@context":{
"rdfs":"http://www.w3.org/2000/01/rdf-schema#",
"terminus":"https://datachemist.net/ontology/terminus#"
},
"@type":"terminus:Database",
"rdfs:label":{
"@language":"en",
"@value":"test 01"
},
"rdfs:comment":{
"@language":"en",
"@value":"description"
},
"terminus:allow_origin":{
"@type":"xsd:string",
"@value":"*"
}
}
client.createDatabase("newD",details,'root');
...
deleteDatabase():{[dbUrl:string]}
For delete a terminusDB
client.deleteDatabase("http://myTerminusServer/dbID");
or
client.deleteDatabase("dbID");
...
Testing
$ npm install
$ npm run test
Contribute
It will be nice, if you open an issue first so that we can know what is going on, then, fork this repo and push in your ideas. Do not forget to add a bit of test(s) of what value you adding.
Licence
The APACHE 2.0 License
Copyright (c) 2019 ........