Skip to content

Commit aa96274

Browse files
committed
fix up the tests for woql.js
1 parent 1f5a2c6 commit aa96274

File tree

1 file changed

+62
-15
lines changed

1 file changed

+62
-15
lines changed

test/woql.spec.js

Lines changed: 62 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ describe('woql queries', function () {
8686

8787
const jsonObj={
8888
when: [
89-
true,
89+
{
90+
"true":[]
91+
},
9092
{ add_quad: [ 'scm:id', 'rdf:type', 'owl:Class', 'db:schema' ] }
9193
]
9294
};
@@ -224,7 +226,13 @@ describe('woql queries', function () {
224226

225227
const woqlObject=WOQL.get("Map", "Target");
226228

227-
const jsonObj={ get: [ 'Map' , 'Target' ] };
229+
const jsonObj={ get: [
230+
[ { "as": [ {"@value": "T"}, "M" ] },
231+
{ "as": [ {"@value": "a"}, "a" ] },
232+
{ "as": [ { "@value": "r"}, "p" ] }
233+
],
234+
{}
235+
] };
228236

229237
expect(woqlObject.json()).to.eql(jsonObj);
230238

@@ -308,7 +316,10 @@ describe('triple builder', function () {
308316

309317
const woqlObject=WOQL.deleteClass("id");
310318

311-
const jsonObj= { and: [ { delete_quad: [ 'scm:id', 'v:All', 'v:Al2', 'db:schema' ] }, { delete_quad: [ 'v:Al3', 'v:Al4', 'scm:id', 'db:schema' ] } ] };
319+
const jsonObj= { and: [
320+
{ delete_quad: [ 'scm:id', 'v:All', 'v:Al2', 'db:schema' ] },
321+
{ "opt": [ { delete_quad: [ 'v:Al3', 'v:Al4', 'scm:id', 'db:schema' ] } ] }
322+
] };
312323

313324
expect(woqlObject.json()).to.eql(jsonObj);
314325

@@ -507,13 +518,25 @@ describe('triple builder chanier', function () {
507518

508519
const woqlObject=WOQL.addProperty("P", "string").max(4);
509520

510-
const jsonObj={ and: [ { add_quad: ["scm:P",
521+
const jsonObj={ "and": [ { "add_quad": ["scm:P",
511522
"rdf:type",
512523
"owl:DatatypeProperty",
513524
"db:schema"] },
514-
{ add_quad: ["scm:P",
525+
{ "add_quad": ["scm:P",
515526
"rdfs:range",
516527
"xsd:string",
528+
"db:schema"] },
529+
{ "add_quad": ["scm:P_max",
530+
"rdf:type",
531+
"owl:Restriction",
532+
"db:schema"] },
533+
{ "add_quad": [ "scm:P_max",
534+
"owl:onProperty",
535+
"scm:P",
536+
"db:schema"] },
537+
{ "add_quad": [ "scm:P_max",
538+
"owl:maxCardinality",
539+
4,
517540
"db:schema"] } ] };
518541

519542
expect(woqlObject.json()).to.eql(jsonObj);
@@ -524,13 +547,25 @@ describe('triple builder chanier', function () {
524547

525548
const woqlObject=WOQL.addProperty("P", "string").min(2);
526549

527-
const jsonObj={ and: [ { add_quad: ["scm:P",
550+
const jsonObj={ "and": [ { "add_quad": ["scm:P",
528551
"rdf:type",
529552
"owl:DatatypeProperty",
530553
"db:schema"] },
531-
{ add_quad: ["scm:P",
554+
{ "add_quad": ["scm:P",
532555
"rdfs:range",
533556
"xsd:string",
557+
"db:schema"] },
558+
{ "add_quad": ["scm:P_min",
559+
"rdf:type",
560+
"owl:Restriction",
561+
"db:schema"] },
562+
{ "add_quad": [ "scm:P_min",
563+
"owl:onProperty",
564+
"scm:P",
565+
"db:schema"] },
566+
{ "add_quad": [ "scm:P_min",
567+
"owl:minCardinality",
568+
2,
534569
"db:schema"] } ] };
535570

536571
expect(woqlObject.json()).to.eql(jsonObj);
@@ -541,14 +576,26 @@ describe('triple builder chanier', function () {
541576

542577
const woqlObject=WOQL.addProperty("P", "string").cardinality(3);
543578

544-
const jsonObj={ and: [ { add_quad: ["scm:P",
545-
"rdf:type",
546-
"owl:DatatypeProperty",
547-
"db:schema"] },
548-
{ add_quad: ["scm:P",
549-
"rdfs:range",
550-
"xsd:string",
551-
"db:schema"] } ] };
579+
const jsonObj={ "and": [ { "add_quad": ["scm:P",
580+
"rdf:type",
581+
"owl:DatatypeProperty",
582+
"db:schema"] },
583+
{ "add_quad": ["scm:P",
584+
"rdfs:range",
585+
"xsd:string",
586+
"db:schema"] },
587+
{ "add_quad": ["scm:P_cardinality",
588+
"rdf:type",
589+
"owl:Restriction",
590+
"db:schema"] },
591+
{ "add_quad": [ "scm:P_cardinality",
592+
"owl:onProperty",
593+
"scm:P",
594+
"db:schema"] },
595+
{ "add_quad": [ "scm:P_cardinality",
596+
"owl:cardinality",
597+
3,
598+
"db:schema"] } ] };
552599

553600
expect(woqlObject.json()).to.eql(jsonObj);
554601

0 commit comments

Comments
 (0)