aboutsummaryrefslogtreecommitdiff
path: root/test/turtle/main.ml
diff options
context:
space:
mode:
authorAlleyCat <info@alleycat.cc>2021-06-07 14:54:31 +0200
committerarie <arie@alleycat.cc>2021-06-28 21:02:45 +0200
commit618d4dc294d0613de8747a2b14aec89429958b8a (patch)
tree08c075809eb8b7690e1ef1b3392f3215284bd889 /test/turtle/main.ml
parent23adcf64b873ad6b0c97d288e4066786faf96c32 (diff)
Rdf turtle:
add object' tests and predobjs tests
Diffstat (limited to 'test/turtle/main.ml')
-rw-r--r--test/turtle/main.ml50
1 files changed, 31 insertions, 19 deletions
diff --git a/test/turtle/main.ml b/test/turtle/main.ml
index ea13811..6ada3e4 100644
--- a/test/turtle/main.ml
+++ b/test/turtle/main.ml
@@ -124,23 +124,23 @@ let predicate_test_case =
let object_test_case =
let cases = [
- (* Literal *)
+ (* Literal *)
"\"That Seventies Show\"^^xsd:string",
Turtle.Literal.make
("That Seventies Show")
(Turtle.Iri.of_prefixed_name @@ Turtle.Prefixed_name.of_strings "xsd" "string")
|> (fun lit -> Turtle.Obj_literal lit) ;
- (* Iri *)
+ (* Iri *)
"xsd:string",
Turtle.Iri.of_prefixed_name @@ Turtle.Prefixed_name.of_strings "xsd" "string"
|> (fun iri -> Turtle.Obj_iri iri) ;
- (* Blank_node *)
+ (* Blank_node *)
"_:string",
Turtle.Obj_blank_node (Turtle.Blank_node.of_string "string") ;
- (* Blank_node *)
+ (* Blank_node *)
"_:string",
Turtle.Obj_blank_node (Turtle.Blank_node.of_string "string") ;
- (* Collection *)
+ (* Collection *)
"( \"apple\" \"banana\" )",
Turtle.Obj_coll (
Turtle.Collection (
@@ -158,20 +158,13 @@ let object_test_case =
) ;
(* BNodePlist *)
"[ foaf:name \"Bob\" ]",
- Turtle.Obj_coll (
- Turtle.Collection (
- [
- Turtle.Obj_literal (
- Turtle.Literal.make
- ("apple")
- (Turtle.Iri.of_prefixed_name @@ Turtle.Prefixed_name.of_strings "xsd" "string")) ;
- Turtle.Obj_literal (
- Turtle.Literal.make
- ("banana")
- (Turtle.Iri.of_prefixed_name @@ Turtle.Prefixed_name.of_strings "xsd" "string")) ;
- ]
- )
- ) ;
+ Turtle.Obj_BnodPs (Turtle.BNodePs ([ Turtle.Predicate.of_iri @@ Turtle.Iri.of_prefixed_name @@ Turtle.Prefixed_name.of_strings "foaf" "name",
+ [ Turtle.Obj_literal ( Turtle.Literal.make
+ ("Bob")
+ (Turtle.Iri.of_prefixed_name @@ Turtle.Prefixed_name.of_strings "xsd" "string"))
+ ]
+ ]))
+ ;
] in
test_case "object" `Quick
(fun () ->
@@ -214,6 +207,25 @@ let predobjs_test_case =
]
]
;
+ "rel:enemyOf <#green-goblin> ;
+ a foaf:Person ;
+ foaf:name \"Spiderman\", \"Человек-паук\"@ru",
+ [ Turtle.Predicate.of_iri @@ Turtle.Iri.of_prefixed_name @@ Turtle.Prefixed_name.of_strings "rel" "enemyOf",
+ [ Turtle.Obj_iri ( Turtle.Iri.of_iriref (Turtle.Iriref.of_string "#green-goblin"));]
+ ;
+ Turtle.Predicate.a,
+ [ Turtle.Obj_iri (Turtle.Iri.of_prefixed_name @@ Turtle.Prefixed_name.of_strings "foaf" "Person");]
+ ;
+ Turtle.Predicate.of_iri @@ Turtle.Iri.of_prefixed_name @@ Turtle.Prefixed_name.of_strings "foaf" "name",
+ [ Turtle.Obj_literal ( Turtle.Literal.make
+ ("Spiderman")
+ (Turtle.Iri.of_prefixed_name @@ Turtle.Prefixed_name.of_strings "xsd" "string"));
+ Turtle.Obj_literal ( Turtle.Literal.make
+ ("Человек-паук")
+ (Turtle.Iri.of_prefixed_name @@ Turtle.Prefixed_name.of_strings "xsd" "string")
+ ~language:"ru");
+ ]
+ ]
] in
test_case "predobjs" `Quick
(fun () ->