@@ -13,9 +13,37 @@ describe('woql queries', function () {
13
13
expect ( woqlObject . vocab . type ) . to . equal ( 'rdf:type' ) ;
14
14
} )
15
15
16
+ it ( 'check the insert method' , function ( ) {
17
+
18
+ const woqlObject = WOQL . insert ( "v:Bike_URL" , "Bicycle" ) ;
19
+ const woqlObjectDB = WOQL . insert ( "v:Bike_URL" , "Bicycle" , "myDB" ) ;
20
+ const jsonObj = { "add_triple" : [ 'v:Bike_URL' , 'rdf:type' , 'scm:Bicycle' ] } ;
21
+ const jsonObjDB = { "add_quad" : [ 'v:Bike_URL' , 'rdf:type' , 'scm:Bicycle' , 'db:myDB' ] } ;
22
+ expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
23
+ expect ( woqlObjectDB . json ( ) ) . to . eql ( jsonObjDB ) ;
24
+ } )
25
+
26
+ it ( 'check the doctype method' , function ( ) {
27
+
28
+ const woqlObject = WOQL . doctype ( "Station" ) ;
29
+
30
+ const jsonObj = { "and" : [
31
+ { "add_quad" : [ "scm:Station" ,
32
+ "rdf:type" ,
33
+ "owl:Class" ,
34
+ "db:schema" ] } ,
35
+ { "add_quad" : [ "scm:Station" ,
36
+ "rdfs:subClassOf" ,
37
+ "tcs:Document" ,
38
+ "db:schema" ] }
39
+ ] }
40
+
41
+ expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
42
+
43
+ } )
16
44
17
45
it ( 'check the limit method' , function ( ) {
18
- const woqlObject = WOQL . limit ( 10 ) ;
46
+ const woqlObject = WOQL . limit ( 10 ) ;
19
47
20
48
expect ( woqlObject . json ( ) . limit [ 0 ] ) . to . equal ( 10 ) ;
21
49
@@ -70,14 +98,10 @@ describe('woql queries', function () {
70
98
71
99
it ( 'check the when method' , function ( ) {
72
100
73
- < << << << HEAD
74
- const woqlObject = WOQL . when ( true , WOQL . addClass ( "id" ) ) ;
75
- = === ===
76
101
const Update = WOQL . add_class ( "id" ) ;
77
102
const Condition = WOQL . or ( WOQL . triple ( "a" , "b" , "c" ) , WOQL . triple ( "1" , "2" , "3" ) ) ;
78
103
79
104
const woqlObject = WOQL . when ( true , WOQL . add_class ( "id" ) ) ;
80
- > >>> >>> 37 c8029e275df396c6d0a0dc5c6f76309dd398fd
81
105
82
106
const woqlObjectChain = WOQL . when ( true ) . add_class ( "id" )
83
107
@@ -115,7 +139,7 @@ describe('woql queries', function () {
115
139
116
140
const woqlObjectChain = WOQL . from ( "http://dburl" ) . limit ( 10 ) ;
117
141
118
- const jsonObj = { from : [ 'http://dburl' , { limit : [ 10 , { } ] } ] }
142
+ const jsonObj = { " from" : [ 'http://dburl' , { " limit" : [ 10 , { } ] } ] }
119
143
120
144
//expect(woqlObject.json()).to.eql(jsonObj);
121
145
expect ( woqlObjectChain . json ( ) ) . to . eql ( jsonObj ) ;
@@ -126,7 +150,7 @@ describe('woql queries', function () {
126
150
127
151
const woqlObject = WOQL . limit ( 10 ) . star ( ) ;
128
152
129
- const jsonObj = { limit : [ 10 , { "triple" : [
153
+ const jsonObj = { " limit" : [ 10 , { "triple" : [
130
154
"v:Subject" ,
131
155
"v:Predicate" ,
132
156
"v:Object"
@@ -287,6 +311,17 @@ describe('woql queries', function () {
287
311
288
312
} )
289
313
314
+ it ( 'check the cast method' , function ( ) {
315
+
316
+ const woqlObject = WOQL . cast ( "v:Duration" , "xsd:integer" , "v:Duration_Cast" ) ;
317
+
318
+ const jsonObj = { "typecast" : [ "v:Duration" , "xsd:integer" , "v:Duration_Cast" ] }
319
+
320
+ expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
321
+
322
+ } )
323
+
324
+
290
325
it ( 'check the list method' , function ( ) {
291
326
292
327
const woqlObject = WOQL . list ( [ "V1" , "V2" ] ) ;
@@ -686,13 +721,13 @@ describe('triple builder chaining methods', function () {
686
721
{ add_triple : [ "v:Node_ID" , "rdfs:subClassOf" , "tcs:Entity" ] } ,
687
722
{ add_triple : [ "v:Node_ID" , "rdfs:subClassOf" , "scm:hello" ] }
688
723
] } ;
689
- expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
724
+ expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
690
725
} )
691
726
it ( 'check the chained doctype method' , function ( ) {
692
727
const woqlObject = WOQL . doctype ( "MyDoc" )
693
728
. property ( "prop" , "dateTime" )
694
729
. property ( "prop2" , "integer" )
695
-
730
+
696
731
const jsonObj = { and : [
697
732
{ add_quad : [ "scm:prop2" , "rdf:type" , "owl:DatatypeProperty" , "db:schema" ] } ,
698
733
{ add_quad : [ "scm:prop2" , "rdfs:range" , "xsd:integer" , "db:schema" ] } ,
@@ -706,10 +741,9 @@ describe('triple builder chaining methods', function () {
706
741
{ add_quad : [ "scm:MyDoc" , "rdf:type" , "owl:Class" , "db:schema" ] } ,
707
742
{ add_quad : [ "scm:MyDoc" , "rdfs:subClassOf" , "tcs:Document" , "db:schema" ] }
708
743
] }
709
- ] } ,
744
+ ] } ,
710
745
] } ;
711
- expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
746
+ expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
712
747
} )
713
748
714
749
} )
715
-
0 commit comments