@@ -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
@@ -86,7 +114,7 @@ describe('woql queries', function () {
86
114
]
87
115
} ;
88
116
89
- // expect(woqlObject.json()).to.eql(jsonObj);
117
+ expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
90
118
expect ( woqlObjectChain . json ( ) ) . to . eql ( jsonObj ) ;
91
119
92
120
} )
@@ -111,7 +139,7 @@ describe('woql queries', function () {
111
139
112
140
const woqlObjectChain = WOQL . from ( "http://dburl" ) . limit ( 10 ) ;
113
141
114
- const jsonObj = { from : [ 'http://dburl' , { limit : [ 10 , { } ] } ] }
142
+ const jsonObj = { " from" : [ 'http://dburl' , { " limit" : [ 10 , { } ] } ] }
115
143
116
144
//expect(woqlObject.json()).to.eql(jsonObj);
117
145
expect ( woqlObjectChain . json ( ) ) . to . eql ( jsonObj ) ;
@@ -122,7 +150,7 @@ describe('woql queries', function () {
122
150
123
151
const woqlObject = WOQL . limit ( 10 ) . star ( ) ;
124
152
125
- const jsonObj = { limit : [ 10 , { "triple" : [
153
+ const jsonObj = { " limit" : [ 10 , { "triple" : [
126
154
"v:Subject" ,
127
155
"v:Predicate" ,
128
156
"v:Object"
@@ -283,6 +311,17 @@ describe('woql queries', function () {
283
311
284
312
} )
285
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
+
286
325
it ( 'check the list method' , function ( ) {
287
326
288
327
const woqlObject = WOQL . list ( [ "V1" , "V2" ] ) ;
@@ -682,13 +721,13 @@ describe('triple builder chaining methods', function () {
682
721
{ add_triple : [ "v:Node_ID" , "rdfs:subClassOf" , "tcs:Entity" ] } ,
683
722
{ add_triple : [ "v:Node_ID" , "rdfs:subClassOf" , "scm:hello" ] }
684
723
] } ;
685
- expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
724
+ expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
686
725
} )
687
726
it ( 'check the chained doctype method' , function ( ) {
688
727
const woqlObject = WOQL . doctype ( "MyDoc" )
689
728
. property ( "prop" , "dateTime" )
690
729
. property ( "prop2" , "integer" )
691
-
730
+
692
731
const jsonObj = { and : [
693
732
{ add_quad : [ "scm:prop2" , "rdf:type" , "owl:DatatypeProperty" , "db:schema" ] } ,
694
733
{ add_quad : [ "scm:prop2" , "rdfs:range" , "xsd:integer" , "db:schema" ] } ,
@@ -702,10 +741,9 @@ describe('triple builder chaining methods', function () {
702
741
{ add_quad : [ "scm:MyDoc" , "rdf:type" , "owl:Class" , "db:schema" ] } ,
703
742
{ add_quad : [ "scm:MyDoc" , "rdfs:subClassOf" , "tcs:Document" , "db:schema" ] }
704
743
] }
705
- ] } ,
744
+ ] } ,
706
745
] } ;
707
- expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
746
+ expect ( woqlObject . json ( ) ) . to . eql ( jsonObj ) ;
708
747
} )
709
748
710
749
} )
711
-
0 commit comments