@@ -75,19 +75,63 @@ describe('woql queries', function () {
75
75
76
76
} )
77
77
78
+ it ( 'check the when method' , function ( ) {
79
+
80
+ const Update = WOQL . addClass ( "id" ) ;
81
+ const Condition = WOQL . or ( WOQL . triple ( "a" , "b" , "c" ) , WOQL . triple ( "1" , "2" , "3" ) ) ;
82
+
83
+ const woqlObject = WOQL . when ( Condition , Update ) ;
84
+
85
+ const woqlObjectChain = WOQL . when ( Condition ) . addClass ( "id" )
86
+ //console.log(woqlObject.json()['when'][0][]);
87
+ console . log ( woqlObjectChain . json ( ) ) ;
88
+ /*
89
+ const jsonObj={
90
+ when: [
91
+ WOQLQuery {
92
+ query: [Object],
93
+ cursor: [Object],
94
+ chain_ended: false,
95
+ contains_update: false,
96
+ paging_transitive_properties: [Array],
97
+ vocab: [Object]
98
+ },
99
+ {}
100
+ ]
101
+ };
102
+ */
103
+ //expect(woqlObject.json()).to.eql(jsonObj);
104
+ //expect(woqlObjectChain.json()).to.eql(jsonObj);
105
+
106
+ } )
107
+
78
108
it ( 'check the opt method' , function ( ) {
79
109
80
110
const woqlObject = WOQL . opt ( WOQL . triple ( "a" , "b" , "c" ) ) ;
81
111
82
- // const woqlObjectChain=WOQL.opt().triple("a", "b", "c");
112
+ const woqlObjectChain = WOQL . opt ( ) . triple ( "a" , "b" , "c" ) ;
83
113
84
114
const jsonObj = { opt : [ { triple : [ "doc:a" , "scm:b" , { "@language" : "en" , "@value" : "c" } ] } ] }
85
115
86
116
expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
87
- // expect(woqlObjectChain.json()).to.eql(jsonObj);
117
+ expect ( woqlObjectChain . json ( ) ) . to . eql ( jsonObj ) ;
88
118
89
119
} )
90
120
121
+ it ( 'check the from method' , function ( ) {
122
+
123
+ const Query = WOQL . limit ( 10 ) ;
124
+ //const woqlObject=WOQL.from("http://dburl", Query);
125
+
126
+ const woqlObjectChain = WOQL . from ( "http://dburl" ) . limit ( 10 ) ;
127
+
128
+ const jsonObj = { from : [ 'http://dburl' , { limit : [ 10 , { } ] } ] }
129
+
130
+ //expect(woqlObject.json()).to.eql(jsonObj);
131
+ expect ( woqlObjectChain . json ( ) ) . to . eql ( jsonObj ) ;
132
+
133
+ } )
134
+
91
135
it ( 'check the select method' , function ( ) {
92
136
93
137
const woqlObject = WOQL . select ( "V1" , WOQL . triple ( "a" , "b" , "c" ) ) ;
@@ -185,6 +229,16 @@ describe('woql queries', function () {
185
229
186
230
} )
187
231
232
+ it ( 'check the get method' , function ( ) {
233
+
234
+ const woqlObject = WOQL . as ( "Map" , "Target" ) ;
235
+
236
+ const jsonObj = { as : [ { '@value' : 'Map' } , 'v:Target' ] } ;
237
+
238
+ expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
239
+
240
+ } )
241
+
188
242
it ( 'check the as method' , function ( ) {
189
243
190
244
const woqlObject = WOQL . as ( "Source" , "Target" ) ;
@@ -195,6 +249,16 @@ describe('woql queries', function () {
195
249
196
250
} )
197
251
252
+ it ( 'check the remote method' , function ( ) {
253
+
254
+ const woqlObject = WOQL . remote ( { url : "http://url" } ) ;
255
+ console . log ( woqlObject . json ( ) ) ;
256
+ //const jsonObj={ as: [ { '@value ': 'Prefix' }, 'v:V1,V2' ] };
257
+
258
+ //expect(woqlObject.json()).to.eql(jsonObj);
259
+
260
+ } )
261
+
198
262
it ( 'check the unique method' , function ( ) {
199
263
200
264
const woqlObject = WOQL . as ( "Prefix" , [ "V1" , "V2" ] ) ;
@@ -205,6 +269,16 @@ describe('woql queries', function () {
205
269
206
270
} )
207
271
272
+ it ( 'check the list method' , function ( ) {
273
+
274
+ const woqlObject = WOQL . list ( [ "V1" , "V2" ] ) ;
275
+ console . log ( woqlObject . json ( ) ) ;
276
+ //const jsonObj={ as: [ { '@value ': 'Prefix' }, 'v:V1,V2' ] };
277
+
278
+ //expect(woqlObject.json()).to.eql(jsonObj);
279
+
280
+ } )
281
+
208
282
} )
209
283
210
284
describe ( 'triple builder' , function ( ) {
0 commit comments