Skip to content

Commit fa6d07d

Browse files
committed
merge dev with master
1 parent 4ff721e commit fa6d07d

File tree

3 files changed

+88
-83
lines changed

3 files changed

+88
-83
lines changed

Readme.md

Lines changed: 83 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,11 @@ For get a terminusDB schema
166166

167167
```js
168168

169-
//opts.terminus:encoding defines which format is requested
170-
//(*terminus:jsonld / terminus:turtle)
171-
//opts.terminus:user_key is an optional API key
169+
//opts.terminus:encoding defines which format is requested (*terminus:jsonld / terminus:turtle)
170+
//opts.terminus:user_key is the server API key
172171

173172
const opts={terminus:encoding: "terminus:turtle",
174-
terminus:user_key: "root"}
173+
terminus:user_key: "mykey"}
175174

176175
//Retrieves the schema of the specified TerminusDB database by full Url
177176
client.getSchema("http://localhost:6363/myFirstTerminusDB/schema",opts);
@@ -194,8 +193,9 @@ client.getSchema("myFirstTerminusDB",opts).then((response)=>{
194193

195194
##### `updateSchema(schurl:String, doc:String, opts:Object):Promise`
196195
For Update a terminusDB schema
197-
schurl TerminusDB full URL or a valid TerminusDB Id or omitted
198-
doc is OWL schema String
196+
197+
1) schurl TerminusDB full URL or a valid TerminusDB Id or omitted
198+
2) doc is OWL schema String
199199

200200
For stating with an OWL schema go to [https://terminusdb.com/docs/](https://terminusdb.com/docs/)
201201

@@ -207,6 +207,7 @@ Go to Quick Start > My First Knowledge Graph
207207
//OWL Schema
208208
const doc="@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.........."
209209

210+
//update a schema from the current server
210211
const opts={terminus:encoding: "terminus:turtle"}
211212

212213
client.updateSchema('myFirstTerminusDB',doc,opts).then((response)=>{
@@ -215,6 +216,19 @@ client.updateSchema('myFirstTerminusDB',doc,opts).then((response)=>{
215216
console.log(err)
216217
});
217218

219+
220+
or
221+
222+
//update a schema from a full TerminusDB Url
223+
const opts={terminus:encoding: "terminus:turtle",
224+
terminus:key:"mykey"}
225+
226+
client.updateSchema('myFirstTerminusDB',doc,opts).then((response)=>{
227+
console.log(response)
228+
}).catch((err)=>{
229+
console.log(err)
230+
});
231+
218232
...
219233

220234
```
@@ -229,85 +243,71 @@ doc is a document Object
229243
```js
230244

231245
//Object
232-
const doc={
233-
"@context":{
246+
const doc={
247+
"rdfs:label":[
248+
{
249+
"@value":"Chess Group",
250+
"@type":"xsd:string"
251+
}
252+
],
253+
"rdfs:comment":[
254+
{
255+
"@value":"this is a group for chess players",
256+
"@type":"xsd:string"
257+
}
258+
],
259+
"tcs:identity":[
260+
{
261+
"tcs:website":[
262+
{
263+
"@value":"www.chessPlayer.com",
264+
"@type":"xdd:url"
265+
}
266+
],
267+
"@type":"tcs:Identifier",
268+
"@id":"_:f89plh1570198207869"
269+
}
270+
],
271+
"@type":"http://terminusdb.com/schema/tcs#Group",
272+
"@context":{
273+
"s":"http://localhost:6363/myFirstTerminusDB/schema#",
274+
"dg":"http://localhost:6363/myFirstTerminusDB/schema",
234275
"doc":"http://localhost:6363/myFirstTerminusDB/document/",
235-
"owl":"http://www.w3.org/2002/07/owl#",
276+
"db":"http://localhost:6363/myFirstTerminusDB/",
277+
"g":"http://localhost:6363/",
236278
"rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
237279
"rdfs":"http://www.w3.org/2000/01/rdf-schema#",
238-
"scm":"http://localhost:6363/myFirstTerminusDB/schema#",
239-
"tbs":"http://terminusdb.com/schema/tbs#",
280+
"xsd":"http://www.w3.org/2001/XMLSchema#",
281+
"owl":"http://www.w3.org/2002/07/owl#",
240282
"tcs":"http://terminusdb.com/schema/tcs#",
283+
"tbs":"http://terminusdb.com/schema/tbs#",
284+
"xdd":"http://terminusdb.com/schema/xdd#",
241285
"terminus":"http://terminusdb.com/schema/terminus#",
242286
"vio":"http://terminusdb.com/schema/vio#",
243-
"xdd":"http://terminusdb.com/schema/xdd#",
244-
"xsd":"http://www.w3.org/2001/XMLSchema#",
245-
"_":"http://localhost:6363/myFirstTerminusDB/document/Rose/"
246-
},
247-
"terminus:document":{
248-
"tcs:member_of":[
249-
{
250-
"@id":"doc:yoga"
251-
}
252-
],
253-
"tcs:friend":[
254-
{
255-
"@id":"doc:Jane"
256-
}
257-
],
258-
"tcs:date_of_birth":[
259-
{
260-
"@value":"1976-05-12",
261-
"@type":"xsd:date"
262-
}
263-
],
264-
"rdfs:label":[
265-
{
266-
"@value":"Rose",
267-
"@type":"xsd:string"
268-
}
269-
],
270-
"rdfs:comment":[
271-
{
272-
"@value":"Steve is a person who is a member of Yoga group and are friends with Jane\n",
273-
"@type":"xsd:string"
274-
}
275-
],
276-
"tcs:identity":[
277-
{
278-
"tcs:website":[
279-
{
280-
"@value":"www.myWEBSite.com",
281-
"@type":"xdd:url"
282-
}
283-
],
284-
"tcs:twitter_handle":[
285-
{
286-
"@value":"https://twitter.com/Rose",
287-
"@type":"xsd:string"
288-
}
289-
],
290-
"tcs:email_address":[
291-
{
292-
"@value":"rose@gmail.com",
293-
"@type":"xdd:email"
294-
}
295-
],
296-
"@type":"tcs:Identifier",
297-
"@id":"_:x0ciuq1570113866176"
298-
}
299-
],
300-
"@type":"http://terminusdb.com/schema/tcs#Person",
301-
"@id":"http://localhost:6363/myFirstTerminusDB/document/Rose"
302-
},
303-
"@type":"terminus:APIUpdate"
287+
"docs":"http://terminusdb.com/schema/documentation#",
288+
"scm":"http://localhost:6363/myFirstTerminusDB/schema#",
289+
"_":"http://localhost:6363/myFirstTerminusDB/document/chess/"
290+
}
304291
}
292+
/
293+
// opts.terminus:encoding defines which format is requested (jsonld/frame)
294+
const opts={terminus:encoding: "jsonld"}
305295

306-
//opts.key is an optional API key
296+
client.createDocument("doc:chess",doc,opts).then((response)=>{
297+
console.log(response)
298+
}).catch((err)=>{
299+
console.log(err)
300+
});
301+
302+
303+
or
304+
305+
//opts.key is an API key
307306

308-
const opts={terminus:user_key: "root"}
307+
const opts={terminus:encoding: "jsonld",
308+
terminus:user_key: "mykey"}
309309

310-
client.updateSchema("myFirstTerminusDB",doc,opts).then((response)=>{
310+
client.createDocument("http://localhost:6363/myFirstTerminusDB/document/chess/",doc,opts).then((response)=>{
311311
console.log(response)
312312
}).catch((err)=>{
313313
console.log(err)
@@ -330,7 +330,7 @@ docurl TerminusDB document full URL or a valid TerminusDB document Id or omitted
330330
const opts={terminus:encoding: "terminus:frame",
331331
terminus:user_key: "mykey"}
332332

333-
client.getDocument(http://localhost:6363/myFirstTerminusDB/document/Rose,opts).then((response)=>{
333+
client.getDocument("http://localhost:6363/myFirstTerminusDB/document/Rose",opts).then((response)=>{
334334
console.log(response)
335335
}).catch((err)=>{
336336
console.log(err)
@@ -346,11 +346,16 @@ Delete a document from the specified TerminusDb
346346
docurl TerminusDB document full URL or a valid TerminusDB document Id or omitted
347347

348348
```js
349+
client.deleteDocument("doc:chess",opts).then((response)=>{
350+
console.log(response)
351+
}).catch((err)=>{
352+
console.log(err)
353+
});
349354

350355
//(opts) opts.key is an optional API key
351-
const opts={terminus:user_key: "root"}
356+
const opts={terminus:user_key: "mykey"}
352357

353-
client.deleteDocument(http://localhost:6363/myFirstTerminusDB/document/Rose,opts).then((response)=>{
358+
client.deleteDocument("http://localhost:6363/myFirstTerminusDB/document/chess",opts).then((response)=>{
354359
console.log(response)
355360
}).catch((err)=>{
356361
console.log(err)

0 commit comments

Comments
 (0)