aboutsummaryrefslogtreecommitdiff
path: root/test/turtle/main.ml
diff options
context:
space:
mode:
authorpukkamustard <pukkamustard@posteo.net>2022-01-22 17:26:19 +0100
committerpukkamustard <pukkamustard@posteo.net>2022-01-22 17:26:19 +0100
commitcd1e27f9ed89112335caf4688ae7787a4c85d003 (patch)
tree0f6204b52c6054c68f2ac17a3512ab5f5b4f5939 /test/turtle/main.ml
parent83728551a1bcb67dd957fd313bd5f06c84aae966 (diff)
Rdf.Literal: add some helpers
Diffstat (limited to 'test/turtle/main.ml')
-rw-r--r--test/turtle/main.ml23
1 files changed, 9 insertions, 14 deletions
diff --git a/test/turtle/main.ml b/test/turtle/main.ml
index 0142ba7..6209677 100644
--- a/test/turtle/main.ml
+++ b/test/turtle/main.ml
@@ -319,12 +319,12 @@ let predobjs_test_case =
@@ Prefixed_name.of_strings "xsd" "string")
~language:"ru");
] );
- ] );
+ ] )
(* "<http://www.perceive.net/schemas/relationship/enemyOf> \"LITERAL\" ", *)
(* "<http://www.perceive.net/schemas/relationship/enemyOf> .", *)
(* [ Predicate.of_iri @@ Iri.of_prefixed_name @@ Prefixed_name.of_strings "" "p", *)
(* [ Obj_iri (Iri.of_prefixed_name @@ Prefixed_name.of_strings "" "WWWWWWWWWWWWWWWWWWWwwW"); ] ; ] *)
- (* ; *)
+ (* ; *);
]
in
test_case "predobjs" `Quick (fun () ->
@@ -397,7 +397,7 @@ let triple_test_case =
@@ Iri.of_iriref
"http://www.perceive.net/schemas/relationship/enemyOf",
[ Obj_iri (Iri.of_iriref "http://example.org/#green-goblin") ] );
- ] );
+ ] )
(* TODO why does this test fail? *)
(* "[ foaf:name \"Bob\" ]", *)
(* Triple.of_bnodps ( *)
@@ -407,7 +407,7 @@ let triple_test_case =
(* (Iri.of_prefixed_name @@ Prefixed_name.of_strings "xsd" "string")) *)
(* ] *)
(* ])) *)
- (* ; *)
+ (* ; *);
]
in
test_case "triple" `Quick (fun () ->
@@ -604,17 +604,12 @@ let turtle_to_graph_test_case =
* their value, and nothing else. *)
let obj_literal ?obj_language ?obj_datatype obj_value =
match (obj_language, obj_datatype) with
- | Some lang, Some datatype ->
- let obj_datatype_iri = Rdf.Iri.of_string datatype in
- Rdf.Literal.make obj_value ~language:lang obj_datatype_iri
+ | Some lang, Some _datatype ->
+ Rdf.Literal.make_string ~language:lang obj_value
| None, Some datatype ->
let obj_datatype_iri = Rdf.Iri.of_string datatype in
Rdf.Literal.make obj_value obj_datatype_iri
- | Some lang, None ->
- let obj_datatype_iri =
- Rdf.Iri.of_string "http://www.w3.org/2001/XMLSchema#string"
- in
- Rdf.Literal.make obj_value ~language:lang obj_datatype_iri
+ | Some lang, None -> Rdf.Literal.make_string ~language:lang obj_value
| None, None ->
Fmt.pr "DO YOU HEAR ME?";
let obj_datatype_iri =
@@ -833,7 +828,7 @@ let turtle_to_graph_test_case =
|> Rdf.Graph.add
(triple_of_iri_iri_literal "http://localhost:4000/users/alice"
"https://www.w3.org/ns/activitystreams#preferredUsername"
- "alice") );
+ "alice") )
(* TODO: this test fails. That is because the base uri is not used yet, I think. *)
(* " @base <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@@ -880,7 +875,7 @@ let turtle_to_graph_test_case =
"http://xmlns.com/foaf/0.1/name"
~obj_language:"ru"
"Человек-паук")
- ; *)
+ ; *);
]
in
test_case "turtle parser and transform" `Quick (fun () ->