@@ -57,8 +57,8 @@ WOQLQuery.prototype.literal = function(s, t) {
57
57
58
58
WOQLQuery . prototype . iri = function ( s ) {
59
59
return {
60
- '@type' : 'woql:Node ' ,
61
- 'woql: node' : s ,
60
+ '@type' : 'NodeValue ' ,
61
+ 'node' : s ,
62
62
}
63
63
}
64
64
@@ -130,7 +130,7 @@ WOQLQuery.prototype.property = function(proId, type_or_value) {
130
130
let part = this . findLastSubject ( this . cursor )
131
131
let g = false
132
132
let gpart
133
- if ( part ) gpart = part [ 'woql: graph_filter' ] || part [ 'woql: graph' ]
133
+ if ( part ) gpart = part [ 'graph_filter' ] || part [ 'graph' ]
134
134
if ( gpart ) g = gpart [ '@value' ]
135
135
let nprop = new WOQLQuery ( )
136
136
. add_property ( proId , type_or_value , g )
@@ -144,31 +144,29 @@ WOQLQuery.prototype.property = function(proId, type_or_value) {
144
144
145
145
WOQLQuery . prototype . node = function ( node , type ) {
146
146
type = type || false
147
- if ( type == 'add_quad' ) type = 'AddQuad '
148
- else if ( type == 'delete_quad' ) type = 'DeleteQuad '
147
+ if ( type == 'add_quad' ) type = 'AddTriple '
148
+ else if ( type == 'delete_quad' ) type = 'DeleteTriple '
149
149
else if ( type == 'add_triple' ) type = 'AddTriple'
150
150
else if ( type == 'delete_triple' ) type = 'DeleteTriple'
151
- else if ( type == 'quad' ) type = 'Quad '
151
+ else if ( type == 'quad' ) type = 'Triple '
152
152
else if ( type == 'triple' ) type = 'Triple'
153
- if ( type && type . indexOf ( ':' ) == - 1 ) type = 'woql:' + type
153
+ if ( type && type . indexOf ( ':' ) == - 1 ) type = type
154
154
let ctxt = { subject : node }
155
155
if ( type ) ctxt . action = type
156
156
this . _set_context ( ctxt )
157
157
return this
158
158
}
159
159
160
160
WOQLQuery . prototype . insert = function ( id , type , refGraph ) {
161
- type = this . cleanType ( type , true )
162
161
refGraph = refGraph || ( this . triple_builder_context ? this . triple_builder_context . graph : false )
163
162
if ( refGraph ) {
164
- return this . add_quad ( id , 'type' , type , refGraph )
163
+ return this . add_quad ( id , 'rdf: type' , '@schema:' + type , refGraph )
165
164
}
166
- return this . add_triple ( id , 'type' , type )
165
+ return this . add_triple ( id , 'rdf: type' , '@schema:' + type )
167
166
}
168
167
169
168
WOQLQuery . prototype . insert_data = function ( data , refGraph ) {
170
169
if ( data . type && data . id ) {
171
- type = this . cleanType ( data . type , true )
172
170
this . insert ( data . id , type , refGraph )
173
171
if ( data . label ) {
174
172
this . label ( data . label )
@@ -224,7 +222,6 @@ WOQLQuery.prototype.graph = function(g) {
224
222
}
225
223
226
224
WOQLQuery . prototype . domain = function ( d ) {
227
- d = this . cleanClass ( d )
228
225
return this . _add_partial ( false , 'rdfs:domain' , d )
229
226
}
230
227
/**
@@ -258,7 +255,7 @@ WOQLQuery.prototype.description = function(c, lang) {
258
255
*/
259
256
WOQLQuery . prototype . parent = function ( ...parentList ) {
260
257
for ( var i = 0 ; i < parentList . length ; i ++ ) {
261
- var pn = this . cleanClass ( parentList [ i ] )
258
+ var pn = parentList [ i ]
262
259
this . _add_partial ( false , 'rdfs:subClassOf' , pn )
263
260
}
264
261
return this
@@ -290,24 +287,24 @@ WOQLQuery.prototype._add_partial = function(s, p, o, g) {
290
287
//if the last subject is a cardinality restriction quad
291
288
//I'm looking for the last property
292
289
if (
293
- lastsubj [ 'woql: predicate' ] &&
294
- lastsubj [ 'woql: predicate' ] [ 'woql: node' ] &&
295
- lastsubj [ 'woql: predicate' ] [ 'woql: node' ] . indexOf ( 'Cardinality' ) > - 1
290
+ lastsubj [ 'predicate' ] &&
291
+ lastsubj [ 'predicate' ] [ 'node' ] &&
292
+ lastsubj [ 'predicate' ] [ 'node' ] . indexOf ( 'Cardinality' ) > - 1
296
293
) {
297
294
lastsubj = this . findLastProperty ( this . cursor )
298
295
}
299
- if ( lastsubj && ! s ) s = lastsubj [ 'woql: subject' ]
296
+ if ( lastsubj && ! s ) s = lastsubj [ 'subject' ]
300
297
let t = ctxt . action || lastsubj [ '@type' ]
301
298
if ( ! g ) {
302
- const gobj = lastsubj [ 'woql: graph_filter' ] || lastsubj [ 'woql: graph' ]
303
- g = gobj ? gobj [ '@value' ] : 'schema/main '
299
+ const gobj = lastsubj [ 'graph_filter' ] || lastsubj [ 'graph' ]
300
+ g = gobj ? gobj [ '@value' ] : 'schema'
304
301
}
305
- if ( t == 'woql: AddTriple' ) this . and ( new WOQLQuery ( ) . add_triple ( s , p , o ) )
306
- else if ( t == 'woql: DeleteTriple' ) this . and ( new WOQLQuery ( ) . delete_triple ( s , p , o ) )
307
- else if ( t == 'woql:AddQuad ' ) this . and ( new WOQLQuery ( ) . add_quad ( s , p , o , g ) )
308
- else if ( t == 'woql:DeleteQuad ' ) this . and ( new WOQLQuery ( ) . delete_quad ( s , p , o , g ) )
309
- else if ( t == 'woql:Quad ' ) this . and ( new WOQLQuery ( ) . quad ( s , p , o , g ) )
310
- else this . and ( new WOQLQuery ( ) . triple ( s , p , o ) )
302
+ if ( t == 'AddTriple' ) this . and ( new WOQLQuery ( ) . add_quad ( s , p , o , g ) )
303
+ else if ( t == 'DeleteTriple' ) this . and ( new WOQLQuery ( ) . delete_quad ( s , p , o , g ) )
304
+ else if ( t == 'AddTriple ' ) this . and ( new WOQLQuery ( ) . add_quad ( s , p , o , g ) )
305
+ else if ( t == 'DeleteTriple ' ) this . and ( new WOQLQuery ( ) . delete_quad ( s , p , o , g ) )
306
+ else if ( t == 'Triple ' ) this . and ( new WOQLQuery ( ) . quad ( s , p , o , g ) )
307
+ else this . and ( new WOQLQuery ( ) . quad ( s , p , o , g ) )
311
308
return this
312
309
}
313
310
@@ -318,7 +315,7 @@ WOQLQuery.prototype._add_partial = function(s, p, o, g) {
318
315
WOQLQuery . prototype . _adding_class = function ( string_only ) {
319
316
if ( this . triple_builder_context ) {
320
317
let x = this . triple_builder_context [ 'adding_class' ]
321
- if ( x && string_only && typeof x == 'object' ) return x [ 'woql: node' ]
318
+ if ( x && string_only && typeof x == 'object' ) return x [ 'node' ]
322
319
return x
323
320
}
324
321
return false
@@ -346,14 +343,14 @@ WOQLQuery.prototype._set_context = function(ctxt) {
346
343
* used to find the class that a property cardinality restriction is applied to
347
344
*/
348
345
WOQLQuery . prototype . _get_object = function ( s , p ) {
349
- if ( this . cursor [ '@type' ] == 'woql: And' ) {
350
- for ( var i = 0 ; i < this . cursor [ 'woql: query_list' ] . length ; i ++ ) {
351
- let subq = this . cursor [ 'woql: query_list' ] [ i ] [ 'woql: query' ]
346
+ if ( this . cursor [ '@type' ] == 'And' ) {
347
+ for ( var i = 0 ; i < this . cursor [ 'query_list' ] . length ; i ++ ) {
348
+ let subq = this . cursor [ 'query_list' ] [ i ] [ 'query' ]
352
349
if (
353
- this . _same_entry ( subq [ 'woql: subject' ] , s ) &&
354
- this . _same_entry ( subq [ 'woql: predicate' ] , p )
350
+ this . _same_entry ( subq [ 'subject' ] , s ) &&
351
+ this . _same_entry ( subq [ 'predicate' ] , p )
355
352
)
356
- return subq [ 'woql: object' ]
353
+ return subq [ 'object' ]
357
354
}
358
355
}
359
356
return false
@@ -385,9 +382,9 @@ WOQLQuery.prototype._same_entry = function(a, b) {
385
382
* @returns {string|boolean }
386
383
*/
387
384
WOQLQuery . prototype . _string_matches_object = function ( str , node ) {
388
- if ( node [ 'woql: node' ] ) return str == node [ 'woql: node' ]
385
+ if ( node [ 'node' ] ) return str == node [ 'node' ]
389
386
if ( node [ '@value' ] ) return str == node [ '@value' ]
390
- if ( node [ 'woql: variable_name' ] ) return str == 'v:' + node [ 'woql: variable_name' ] [ '@value' ]
387
+ if ( node [ 'variable_name' ] ) return str == 'v:' + node [ 'variable_name' ] [ '@value' ]
391
388
return false
392
389
}
393
390
@@ -405,14 +402,14 @@ WOQLQuery.prototype._card = function(cardValue, which) {
405
402
let subject = ctxt . subject
406
403
let graph = ctxt . graph
407
404
let lastsubj = this . findLastProperty ( this . cursor )
408
- if ( lastsubj && ! subject ) subject = lastsubj [ 'woql: subject' ]
405
+ if ( lastsubj && ! subject ) subject = lastsubj [ 'subject' ]
409
406
if ( typeof subject === 'object' ) {
410
- if ( subject [ 'woql: node' ] ) subject = subject [ 'woql: node' ]
407
+ if ( subject [ 'node' ] ) subject = subject [ 'node' ]
411
408
else return this
412
409
}
413
410
414
411
if ( lastsubj && ! graph ) {
415
- const gobj = lastsubj [ 'woql: graph_filter' ] || lastsubj [ 'woql: graph' ]
412
+ const gobj = lastsubj [ 'graph_filter' ] || lastsubj [ 'graph' ]
416
413
graph = gobj ? gobj [ '@value' ] : false
417
414
}
418
415
let cardId = subject + '_' + which + '_' + cardValue
0 commit comments