@prefix math: . @prefix list: . @prefix str: . @prefix time: . @prefix log: . @prefix xsd: . @prefix rdf: . @prefix med: . @prefix e: . @prefix prolog: . @prefix : . ### test data :a :b :c, :d. :s :p :o1, :o2. {?S :b ?O} => {?O :p ?S}. :Socrates a :Male, :Mortal. :Xanthippe a :Female, :Human. ### plugins {?RADIUS :circleArea ?AREA} <= {((?RADIUS 2)!prolog:power ()!prolog:pi) prolog:product ?AREA}. {?X :whenGreater ?Y} <= {({((?X ?Y)) prolog:ground true} {?X prolog:arithmetic_greater_than ?Y}) prolog:when true }. ### unit tests for plugins {3 :circleArea ?X. ?X math:greaterThan 28.27. ?X math:lessThan 28.28} => {:ca1 :result true}. {5 :whenGreater ?Y. ?Y log:equalTo 3} => {:wg1 :result true}. ### unit tests for e: builtins {?SCOPE e:findall (?O {:s :p ?O} (:o1 :o2))} => {:ef1 :result true}. {?SCOPE e:findall (?S {?S a :Male} (:Socrates :Xanthippe :Xanthippe :Dan :Tim) ?U), (?S {?S a :Female} ?U ?V), (?S {?S a :Human} ?V (:Dan :Tim))} => {:ef3 :result true}. {("This is a ~w with number ~w and with an escaped linefeed \n" "test" 5) e:format "This is a test with number 5 and with an escaped linefeed \n"} => {:ef4 :result true}. {({:a :b :c. :d :e :f} {}) e:graphDifference {:a :b :c. :d :e :f}} => {:egd1 :result true}. {({} {:d :e :f}) e:graphDifference {}} => {:egd2 :result true}. {({:a :b :c. :d :e :f} {:d :e :f}) e:graphDifference {:a :b :c}} => {:egd3 :result true}. {({:a :b :c. :d :e :f. :g :h :i} {?d :e :f}) e:graphDifference {:a :b :c. :g :h :i}} => {:egd4 :result true}. {({:a :b :c} {:a :b :c. :u :v :w. :x :y :z}) e:graphDifference {}} => {:egd5 :result true}. {({}) e:graphIntersection {}} => {:egi1 :result true}. {({} {:d :e :f}) e:graphIntersection {}} => {:egi2 :result true}. {({:a :b :c. :d :e :f. :g :h :i} {}) e:graphIntersection {}} => {:egi3 :result true}. {({:a :b :c. :d :e :f} {:d :e :f}) e:graphIntersection {:d :e :f}} => {:egi4 :result true}. {({:a :b :c. :d :e :f. :g :h :i} {:g :h :i. ?d :e :f} {?d :e :f. :g :h :i}) e:graphIntersection {?d :e :f. :g :h :i}} => {:egi5 :result true}. {((8 :d) (5 :a) (6 :b) (7 :a) (9 :d) (4 :d)) e:length 6} => {:el1 :result true}. {(8 5 6 7 9 4) e:max 9} => {:em1 :result true}. {(8 5 6 7 9 4) e:min 4} => {:em2 :result true}. {:a :b :d. ?SCOPE e:optional {:g :h :i}} => {:eo1 :result true}. {(10000000) e:random 5524830} => {:era1 :result true}. {((4 :d) (5 :a) (6 :b) (7 :a) (8 :d) (9 :d)) e:reverse ((9 :d) (8 :d) (7 :a) (6 :b) (5 :a) (4 :d))} => {:er1 :result true}. {((8 :d) (5 :a) (6 :b) (7 :a) (9 :d) (4 :d)) e:sort ((4 :d) (5 :a) (6 :b) (7 :a) (8 :d) (9 :d))} => {:es1 :result true}. {(9 3 8 3 5 7 7 9 9 2) e:sort (2 3 3 5 7 7 8 9 9 9)} => {:es2 :result true}. {"\"test\n" e:stringEscape "\\\"test\\n"} => {:ese1 :result true}. {("a-b/c-d/e" "-/") e:stringSplit ("a" "b" "c" "d" "e")} => {:ess1 :result true}. {_:c e:whenGround {:a :b :d}. :a :b _:c} => {:ewg1 :result true}. {"http://www.agfa.com/w3c/euler" e:wwwFormEncode "http%3a%2f%2fwww.agfa.com%2fw3c%2feuler"} => {:ew1 :result true}. {"Hello World!" e:wwwFormEncode "Hello+World%21"} => {:ew2 :result true}. ### unit tests for prolog: builtins {(-4) prolog:abs 4} => {:prologa2 :result true}. {((:a :b :c) (:d :e) (:a :b :c :d :e)) prolog:append true} => {:prologa1 :result true}. {(6 8) prolog:arithmetic_less_than_or_equal true} => {:prologaltoe1 :result true}. {({:s :q :o}) prolog:assertz true. :s :q :o} => {:prologaz1 :result true}. {("HOME"^^prolog:atom (72 79 77 69)) prolog:atom_codes true} => {:prologac1 :result true}. {("123"^^prolog:atom 123) prolog:atom_number true} => {:prologan1 :result true}. {(("Hello "^^prolog:atom "World :-)"^^prolog:atom) "Hello World :-)"^^prolog:atom) prolog:atomic_list_concat true} => {:prologalc1 :result true}. {({:prologaltoe1 :result true}) prolog:call true} => {:prologc1 :result true}. {({:prologaltoe3 :result true}) prolog:call false} => {:prologc2 :result true}. {() prolog:cut true} => {:prologc3 :result true}. {(("date"^^prolog:atom 1970 1 1 0 0 0.0 0 "UTC"^^prolog:atom "-"^^prolog:atom)^prolog:univ 0^math:equalTo) prolog:date_time_stamp true} => {:prologdts1 :result true}. {() prolog:fail false} => {:prologf1 :result true}. {(9 4) prolog:integer_quotient 2} => {:prologiq1 :result true}. {(8 4) prolog:max 8} => {:prologm1 :result true}. {(8 4) prolog:min 4} => {:prologm2 :result true}. {(1) prolog:minus -1} => {:prologm3 :result true}. {(:a :b) prolog:not_unifiable true} => {:prolognu1 :result true}. {(1) prolog:plus 1} => {:prologp1 :result true}. {(1 1) prolog:plus 2} => {:prologp2 :result true}. {(9 4) prolog:product 36} => {:prologp3 :result true}. {({:s :q :o}) prolog:retract true. ({:s :q :o}) prolog:call false} => {:prologr1 :result true}. {((9 3 8 3 5 7 7 9 9 2) (2 3 5 7 8 9)) prolog:sort true} => {:prologs1 :result true}. {(0.0 ("date"^^prolog:atom 1970 1 1 0 0 0.0 0 "UTC"^^prolog:atom "-"^^prolog:atom)^prolog:univ "UTC"^^prolog:atom) prolog:stamp_date_time true} => {:prologsdt1 :result true}. {("uv" 55) prolog:term_greater_than true} => {:prologtgt1 :result true}. {:a :b :d. () prolog:true true} => {:prologt1 :result true}. {(:b :b) prolog:unify true} => {:prologu1 :result true}. {({:s :p :o} (:p :s :o)) prolog:univ true} => {:prologu2 :result true}. ### unit tests for list: builtins {((:a :b :c) (:d :e)) list:append (:a :b :c :d :e)} => {:lista1 :result true}. {(:a :b :c) list:first :a} => {:listf1 :result true}. {:c list:in (:a :b :c)} => {:listi1 :result true}. {(:a :b :c) list:last :c} => {:listl1 :result true}. {(:a :b :c :d) list:member :b} => {:listm1 :result true}. {(:a :b :c) list:rest (:b :c)} => {:listr1 :result true}. ### unit tests for log: builtins {({}) log:conjunction {}} => {:logc1 :result true}. {({} {:u :v :w} {:x :y :z. :j :k :l}) log:conjunction {:u :v :w. :x :y :z. :j :k :l}} => {:logc2 :result true}. {({} {:u :v :w} {} {}) log:conjunction {:u :v :w}} => {:logc3 :result true}. {(:a ?A) log:equalTo (?B :b)} => {:loge1 :result true}. {($ :u :v :u $) log:equalTo ($ :v :u $)} => {:loge2 :result true}. {{:a :b :c} log:equalTo {:a :b :c}} => {:loged0 :result true}. {{:a :b :_c} log:equalTo {:a :b _:c}} => {:loged3 :result true}. { log:semantics ?X. ?X log:equalTo {:a :b :c}} => {:loges0 :result true}. { log:semantics ?X. ?X log:equalTo {:a :b _:c}} => {:loges3 :result true}. {{:b :a :c. :e :d :f. :h :g :i. :k :j :l} log:includes {:k :j :l. ?X :d ?Z}} => {:logi1 :result true}. { log:semantics ?F. ?F log:includes {med:aspirinHighDose med:excludedFor med:AllergyForAspirin}} => {:logi3 :result true}. {{:a :b :c} log:includes {:a :b :c}} => {:logid0 :result true}. {{:a :b :c} log:includes {:a :b _:c}} => {:logid1 :result true}. {{:a :b :_c} log:includes {:a :b _:c}} => {:logid3 :result true}. { log:semantics ?X. ?X log:includes {:a :b :c}} => {:logis0 :result true}. { log:semantics ?X. ?X log:includes {:a :b _:c}} => {:logis1 :result true}. { log:semantics ?X. ?X log:includes {:a :b _:c}} => {:logis3 :result true}. { log:semantics ?X. log:semantics ?Y. ?X log:includes ?Y} => {:logis4 :result true}. {:a log:notEqualTo :b} => {:logne1 :result true}. {{:a :b :c} log:notEqualTo {:a :b :_c}} => {:logned1 :result true}. {{:a :b :_c} log:notEqualTo {:a :b :c}} => {:logned2 :result true}. {{:b :a :c. :e :d :f. :h :g :i} log:notIncludes {:e :d :f. :b :e :c}} => {:logni1 :result true}. { log:semantics ?F. ?F log:notIncludes {med:aspirinLowDose med:excludedFor med:SevereAsthma}} => {:logni3 :result true}. {{:a :b :_c} log:notIncludes {:a :b :c}} => {:lognid2 :result true}. { log:semantics ?X. ?X log:notIncludes {:a :b :c}} => {:lognis2 :result true}. { log:semantics ?X. log:semantics ?Y. ?X log:notIncludes ?Y} => {:lognis3 :result true}. { log:uri "http://eulersharp.sourceforge.net/2006/02swap/med#Fever"} => {:logu1 :result true}. {:betaBlocker log:uri "http://eulersharp.sourceforge.net/2007/07test#betaBlocker"} => {:logu2 :result true}. ### unit tests for math: builtins {(1 1) math:difference 0} => {:mathd1 :result true}. {("2009-01-25T12:00:00"^^xsd:dateTime "1970-01-01T00:00:00"^^xsd:dateTime) math:difference 1232884800} => {:mathd2 :result true}. {(2 ?X) math:exponentiation 8.0. (4.0 ?X) math:product 12.0} => {:mathe1 :result true}. {2 math:greaterThan 1} => {:mathg1 :result true}. {"02" math:greaterThan "1"} => {:mathg2 :result true}. {(:u :v :u) math:memberCount 3} => {:mathm1 :result true}. {{:s :p :o1. :s :p :o2. :s :p :o1} math:memberCount 2} => {:mathm2 :result true}. {($ :u :v :u $) math:memberCount 2} => {:mathm3 :result true}. {7 math:notLessThan 5} => {:mathnl1 :result true}. {(1 1) math:sum 2} => {:maths1 :result true}. {("1" "1") math:sum 2} => {:maths2 :result true}. {("1970-01-01T00:00:00+01:00"^^xsd:dateTime) math:sum -3600} => {:maths3 :result true}. {("P1D"^^xsd:duration) math:sum 86400.0} => {:maths4 :result true}. ### unit tests for rdf: builtins {[ rdf:rest [ rdf:rest rdf:nil; rdf:first :g; a rdf:List]; rdf:first :f] rdf:first :f} => {:rdff1 :result true}. {[ rdf:rest [ rdf:rest rdf:nil; rdf:first :g; a rdf:List]; rdf:first :f] rdf:rest (:g)} => {:rdfr1 :result true}. ### unit tests for str: builtins {("eul" "er") str:concatenation "euler"} => {:strc1 :result true}. {("€" "Ø"@en-US) str:concatenation "€Ø"} => {:strc2 :result true}. {("test " "is \"ok\"") str:concatenation "test is \"ok\""} => {:strc3 :result true}. {(("test " "is \"ok\"")!str:concatenation " again") str:concatenation "test is \"ok\" again"} => {:strc4 :result true}. {"Rob Smith"^^xsd:string str:contains "Smith"} => {:strcn1 :result true}. {"Rob Smith"@en str:contains "Smith"@en} => {:strcn2 :result true}. {"Tim" str:containsIgnoringCase "IM"} => {:strci1 :result true}. {"abracadabra" str:matches "(a|b|r|c|d)+"} => {:strm1 :result true}. {("http://example.org/1995/manifesto" "http://([^/]+)/([^/]+)") str:scrape "example.org"} => {:strs1 :result true}. {("{x" "{(.)") str:scrape "x"} => {:strs2 :result true}. {("http://example.org/1995/manifesto" "http://([^/]+)/([^/]+)") str:search ("example.org" "1995")} => {:strs3 :result true}. {"euler" str:startsWith "eu"} => {:strs4 :result true}. ### unit tests for time: builtins {"2006-12-14"^^xsd:date time:day "14"} => {:timed1 :result true}. {"2006-12-14"^^xsd:date time:month "12"} => {:timem1 :result true}. {"2006-12-14"^^xsd:date time:year "2006"} => {:timey1 :result true}.