@@ -166,12 +166,11 @@ For get a terminusDB schema
166
166
167
167
``` js
168
168
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
172
171
173
172
const opts = {terminus: encoding: " terminus:turtle" ,
174
- terminus: user_key: " root " }
173
+ terminus: user_key: " mykey " }
175
174
176
175
// Retrieves the schema of the specified TerminusDB database by full Url
177
176
client .getSchema (" http://localhost:6363/myFirstTerminusDB/schema" ,opts);
@@ -194,8 +193,9 @@ client.getSchema("myFirstTerminusDB",opts).then((response)=>{
194
193
195
194
##### ` updateSchema(schurl:String, doc:String, opts:Object):Promise `
196
195
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
199
199
200
200
For stating with an OWL schema go to [ https://terminusdb.com/docs/ ] ( https://terminusdb.com/docs/ )
201
201
@@ -207,6 +207,7 @@ Go to Quick Start > My First Knowledge Graph
207
207
// OWL Schema
208
208
const doc = " @prefix xsd: <http://www.w3.org/2001/XMLSchema#>.........."
209
209
210
+ // update a schema from the current server
210
211
const opts = {terminus: encoding: " terminus:turtle" }
211
212
212
213
client .updateSchema (' myFirstTerminusDB' ,doc,opts).then ((response )=> {
@@ -215,6 +216,19 @@ client.updateSchema('myFirstTerminusDB',doc,opts).then((response)=>{
215
216
console .log (err)
216
217
});
217
218
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
+
218
232
...
219
233
220
234
```
@@ -229,85 +243,71 @@ doc is a document Object
229
243
``` js
230
244
231
245
// 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" ,
234
275
" 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/" ,
236
278
" rdf" : " http://www.w3.org/1999/02/22-rdf-syntax-ns#" ,
237
279
" 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 #" ,
240
282
" tcs" : " http://terminusdb.com/schema/tcs#" ,
283
+ " tbs" : " http://terminusdb.com/schema/tbs#" ,
284
+ " xdd" : " http://terminusdb.com/schema/xdd#" ,
241
285
" terminus" : " http://terminusdb.com/schema/terminus#" ,
242
286
" 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
+ }
304
291
}
292
+ /
293
+ // opts.terminus:encoding defines which format is requested (jsonld/frame)
294
+ const opts = {terminus: encoding: " jsonld" }
305
295
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
307
306
308
- const opts = {terminus: user_key: " root" }
307
+ const opts = {terminus: encoding: " jsonld" ,
308
+ terminus: user_key: " mykey" }
309
309
310
- client .updateSchema ( " myFirstTerminusDB" ,doc,opts).then ((response )=> {
310
+ client .createDocument ( " http://localhost:6363/ myFirstTerminusDB/document/chess/ " ,doc,opts).then ((response )=> {
311
311
console .log (response)
312
312
}).catch ((err )=> {
313
313
console .log (err)
@@ -330,7 +330,7 @@ docurl TerminusDB document full URL or a valid TerminusDB document Id or omitted
330
330
const opts = {terminus: encoding: " terminus:frame" ,
331
331
terminus: user_key: " mykey" }
332
332
333
- client .getDocument (http: // localhost:6363/myFirstTerminusDB/document/Rose,opts).then((response)=>{
333
+ client .getDocument (" http://localhost:6363/myFirstTerminusDB/document/Rose" ,opts).then ((response )=> {
334
334
console .log (response)
335
335
}).catch ((err )=> {
336
336
console .log (err)
@@ -346,11 +346,16 @@ Delete a document from the specified TerminusDb
346
346
docurl TerminusDB document full URL or a valid TerminusDB document Id or omitted
347
347
348
348
``` js
349
+ client .deleteDocument (" doc:chess" ,opts).then ((response )=> {
350
+ console .log (response)
351
+ }).catch ((err )=> {
352
+ console .log (err)
353
+ });
349
354
350
355
// (opts) opts.key is an optional API key
351
- const opts = {terminus: user_key: " root " }
356
+ const opts = {terminus: user_key: " mykey " }
352
357
353
- client .deleteDocument (http: // localhost:6363/myFirstTerminusDB/document/Rose ,opts).then((response)=>{
358
+ client .deleteDocument (" http://localhost:6363/myFirstTerminusDB/document/chess " ,opts).then ((response )=> {
354
359
console .log (response)
355
360
}).catch ((err )=> {
356
361
console .log (err)
0 commit comments