@@ -105,12 +105,11 @@ Create a new terminusDB database
105
105
106
106
107
107
var details= {
108
- " @context" : {
108
+ " @context" : {
109
109
" rdfs" : " http://www.w3.org/2000/01/rdf-schema#" ,
110
110
" terminus" : " http://terminusdb.com/schema/terminus#" ,
111
111
" _" : " http://localhost:6363/myFirstTerminusDB/"
112
- },
113
- " terminus:document" : {
112
+ },
114
113
" @type" : " terminus:Database" ,
115
114
" rdfs:label" : {
116
115
" @language" : " en" ,
@@ -125,9 +124,7 @@ var details={
125
124
" @value" : " *"
126
125
},
127
126
" @id" : " http://localhost:6363/myFirstTerminusDB"
128
- },
129
- " @type" : " terminus:APIUpdate"
130
- }
127
+ }
131
128
132
129
// Create a new Database in the current terminusDB server using the terminusDB server Api key
133
130
// dburl is the new Database Id
@@ -236,7 +233,7 @@ client.updateSchema('myFirstTerminusDB',doc,opts).then((response)=>{
236
233
##### ` createDocument(docurl:String, doc:Object, opts:Object):Promise `
237
234
Creates a new document in the specified TerminusDB database
238
235
239
- docurl TerminusDB document full URL or a valid TerminusDB document Id or omitted
236
+ docurl TerminusDB document full URL or a valid TerminusDB document Id
240
237
241
238
doc is a document Object
242
239
307
304
const opts = {terminus: encoding: " jsonld" ,
308
305
terminus: user_key: " mykey" }
309
306
310
- client .createDocument (" http://localhost:6363/myFirstTerminusDB/document/chess/ " ,doc,opts).then ((response )=> {
307
+ client .createDocument (" http://localhost:6363/myFirstTerminusDB/document/chess" ,doc,opts).then ((response )=> {
311
308
console .log (response)
312
309
}).catch ((err )=> {
313
310
console .log (err)
@@ -321,7 +318,7 @@ client.createDocument("http://localhost:6363/myFirstTerminusDB/document/chess/",
321
318
##### ` getDocument(docurl:String, opts:Object):Promise `
322
319
Retrieves a document from the specified TerminusDb
323
320
324
- docurl TerminusDB document full URL or a valid TerminusDB document Id or omitted
321
+ docurl TerminusDB document full URL or a valid TerminusDB document Id
325
322
326
323
``` js
327
324
@@ -349,14 +346,100 @@ client.getDocument("doc:chess",opts).then((response)=>{
349
346
});
350
347
351
348
349
+ ...
350
+
351
+ ```
352
+
353
+
354
+ ##### ` updateDocument(docurl:String, doc:Object, opts:Object):Promise `
355
+ Update the document data in the specified TerminusDB database
356
+
357
+ docurl TerminusDB document full URL or a valid TerminusDB document Id
358
+
359
+ doc is a document Object
360
+
361
+ ``` js
362
+
363
+ // Object
364
+ const doc = {
365
+ " rdfs:label" : [
366
+ {
367
+ " @value" : " Chess Group" ,
368
+ " @type" : " xsd:string"
369
+ }
370
+ ],
371
+ " rdfs:comment" : [
372
+ {
373
+ " @value" : " this is a group for chess players" ,
374
+ " @type" : " xsd:string"
375
+ }
376
+ ],
377
+ " tcs:identity" : [
378
+ {
379
+ " tcs:website" : [
380
+ {
381
+ " @value" : " www.chessPlayer.com" ,
382
+ " @type" : " xdd:url"
383
+ }
384
+ ],
385
+ " @type" : " tcs:Identifier" ,
386
+ " @id" : " _:f89plh1570198207869"
387
+ }
388
+ ],
389
+ " @type" : " http://terminusdb.com/schema/tcs#Group" ,
390
+ " @context" : {
391
+ " s" : " http://localhost:6363/myFirstTerminusDB/schema#" ,
392
+ " dg" : " http://localhost:6363/myFirstTerminusDB/schema" ,
393
+ " doc" : " http://localhost:6363/myFirstTerminusDB/document/" ,
394
+ " db" : " http://localhost:6363/myFirstTerminusDB/" ,
395
+ " g" : " http://localhost:6363/" ,
396
+ " rdf" : " http://www.w3.org/1999/02/22-rdf-syntax-ns#" ,
397
+ " rdfs" : " http://www.w3.org/2000/01/rdf-schema#" ,
398
+ " xsd" : " http://www.w3.org/2001/XMLSchema#" ,
399
+ " owl" : " http://www.w3.org/2002/07/owl#" ,
400
+ " tcs" : " http://terminusdb.com/schema/tcs#" ,
401
+ " tbs" : " http://terminusdb.com/schema/tbs#" ,
402
+ " xdd" : " http://terminusdb.com/schema/xdd#" ,
403
+ " terminus" : " http://terminusdb.com/schema/terminus#" ,
404
+ " vio" : " http://terminusdb.com/schema/vio#" ,
405
+ " docs" : " http://terminusdb.com/schema/documentation#" ,
406
+ " scm" : " http://localhost:6363/myFirstTerminusDB/schema#" ,
407
+ " _" : " http://localhost:6363/myFirstTerminusDB/document/chess/"
408
+ }
409
+ }
410
+ /
411
+ // opts.terminus:encoding defines which format is requested (jsonld/frame)
412
+ const opts = {terminus: encoding: " jsonld" }
413
+
414
+ client .updateDocument (" doc:chess" ,doc,opts).then ((response )=> {
415
+ console .log (response)
416
+ }).catch ((err )=> {
417
+ console .log (err)
418
+ });
419
+
420
+
421
+ or
422
+
423
+ // opts.key is an API key
424
+
425
+ const opts = {terminus: encoding: " jsonld" ,
426
+ terminus: user_key: " mykey" }
427
+
428
+ client .updateDocument (" http://localhost:6363/myFirstTerminusDB/document/chess" ,doc,opts).then ((response )=> {
429
+ console .log (response)
430
+ }).catch ((err )=> {
431
+ console .log (err)
432
+ });
433
+
434
+
352
435
...
353
436
354
437
```
355
438
356
439
##### ` deleteDocument(docurl:String, opts:Object):Promise `
357
440
Delete a document from the specified TerminusDb
358
441
359
- docurl TerminusDB document full URL or a valid TerminusDB document Id or omitted
442
+ docurl TerminusDB document full URL or a valid TerminusDB document Id
360
443
361
444
``` js
362
445
client .deleteDocument (" doc:chess" ,opts).then ((response )=> {
0 commit comments