Skip to content

Commit a6312e8

Browse files
committed
change Readme
1 parent 9570270 commit a6312e8

File tree

1 file changed

+73
-20
lines changed

1 file changed

+73
-20
lines changed

Readme.md

Lines changed: 73 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const TerminusClient = require('@terminusdb/terminus-client');
4343
const client = new TerminusClient.WOQLClient();
4444

4545
//Connect to a Terminus server at the given URI with an API key
46-
client.connect("http://localhost/", 'secret').
46+
client.connect("http://localhost:6363/", 'secret').
4747
.then(function (response) {
4848
// handle success
4949
console.log(response);
@@ -60,7 +60,7 @@ client.connect("http://localhost/", 'secret').
6060
//use async/await.
6161
async function getCapabilities() {
6262
try {
63-
const response = await client.connect("http://localhost/", 'secret');
63+
const response = await client.connect("http://localhost:6363/", 'secret');
6464
console.log(response);
6565
} catch (err) {
6666
console.error(err);
@@ -89,30 +89,35 @@ const client = new TerminusClient.WOQLClient({
8989

9090
## API
9191

92-
### `createDatabase([dburl:String, details:Object, key:String]):Object`
92+
##### `createDatabase([dburl:String, details:Object, key:String]):Object`
9393
Create a new terminusDB database in the current terminusDB server
9494

9595
```js
9696
var currentTerminusServerUrl=client.connectionConfig.dbURL();
9797

98-
var details={
99-
"@context":{
98+
var details={
99+
"@context":{
100100
"rdfs":"http://www.w3.org/2000/01/rdf-schema#",
101-
"terminus":"https://datachemist.net/ontology/terminus#"
101+
"terminus":"http://terminusdb.com/schema/terminus#",
102+
"_":"http://localhost:6363/test_new_db/"
102103
},
103-
"@type":"terminus:Database",
104-
"rdfs:label":{
105-
"@language":"en",
106-
"@value":"test 01"
104+
"terminus:document":{
105+
"@type":"terminus:Database",
106+
"rdfs:label":{
107+
"@language":"en",
108+
"@value":"new db tests"
109+
},
110+
"rdfs:comment":{
111+
"@language":"en",
112+
"@value":"new db description"
113+
},
114+
"terminus:allow_origin":{
115+
"@type":"xsd:string",
116+
"@value":"*"
117+
},
118+
"@id":"http://localhost:6363/test_new_db"
107119
},
108-
"rdfs:comment":{
109-
"@language":"en",
110-
"@value":"description"
111-
},
112-
"terminus:allow_origin":{
113-
"@type":"xsd:string",
114-
"@value":"*"
115-
}
120+
"@type":"terminus:APIUpdate"
116121
}
117122

118123

@@ -122,12 +127,12 @@ client.createDatabase("newD",details,'root');
122127

123128
```
124129

125-
### `deleteDatabase():{[dbUrl:string]}`
130+
##### `deleteDatabase():{[dbUrl:string]}`
126131
For delete a terminusDB
127132

128133
```js
129134
//if authorized you can delete a terminusDB in the server myTerminusServer
130-
client.deleteDatabase("http://myTerminusServer/dbID");
135+
client.deleteDatabase("http://localhost:6363/dbID");
131136

132137
or
133138

@@ -137,6 +142,54 @@ client.deleteDatabase("dbID");
137142

138143
```
139144

145+
##### `getSchema():{[schurl:String, opts:Object]}`
146+
For get a terminusDB schema
147+
148+
```js
149+
150+
//Retrieves the schema of the specified database by Full Url
151+
client.getSchema("http://localhost:6363/dbID");
152+
153+
or
154+
155+
//you can get a database schema in the current seleted server
156+
client.getSchema("dbID").then((response)=>{
157+
console.log("response")
158+
}).catch((err)=>{
159+
console.log(err);
160+
});
161+
...
162+
163+
```
164+
165+
//https://github.com/terminusdb/terminus-schema
166+
const opts={terminus:encoding: "terminus:turtle"}
167+
168+
169+
##### `updateSchema():{[schurl:String, doc:String, opts:Object])`
170+
For Update a terminusDB schema
171+
schurl TerminusDB server URL or a valid TerminusDB Id or omitted
172+
doc is OWL schema String
173+
Some example[TerminusDB OWL Schema] (https://github.com/terminusdb/terminus-schema)
174+
175+
```js
176+
177+
const doc="@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.........."
178+
179+
const opts={terminus:encoding: "terminus:turtle"}
180+
181+
client.updateSchema(false,doc,opts).then((response)=>{
182+
console.log(response)
183+
}).catch((err)=>{
184+
console.log(err)
185+
});
186+
187+
...
188+
189+
```
190+
191+
192+
140193

141194
## Testing
142195
* Clone this repository

0 commit comments

Comments
 (0)