aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/json/rdf_json.ml15
-rw-r--r--test/json/main.ml3
2 files changed, 8 insertions, 10 deletions
diff --git a/lib/json/rdf_json.ml b/lib/json/rdf_json.ml
index 324b7c9..dcd464e 100644
--- a/lib/json/rdf_json.ml
+++ b/lib/json/rdf_json.ml
@@ -63,9 +63,7 @@ let encode_object o =
)
(fun bnode ->
[ ( "type", "bnode" |> json_from_string )
- ; ( "value" , "_:" ^ Blank_node.identifier bnode
- |> json_from_string
- )
+ ; ( "value" , "_:" ^ Blank_node.identifier bnode |> json_from_string)
]
|> json_from_assoc
)
@@ -135,18 +133,17 @@ let decode_object json =
let type' = json |> member "type" |> to_string in
match type' with
| "uri" -> value |> Uri.of_string |> Object.of_iri
- | "bnode" ->
- String.sub value 2 (String.length value - 2)
- |> Blank_node.of_string
- |> Object.of_blank_node
+ | "bnode" -> String.sub value 2 (String.length value - 2)
+ |> Blank_node.of_string
+ |> Object.of_blank_node
| "literal" ->
let datatype = json |> member "datatype" |> to_string |> Uri.of_string in
- let lang_opt = json |> to_option (member "lang") in
+ let lang_opt = json |> member "lang" |> to_option to_string in
let literal = match lang_opt with
| Some lang -> Literal.make
value
datatype
- ~language:(to_string lang)
+ ~language:lang
| None -> Literal.make value datatype
in
literal |> Object.of_literal
diff --git a/test/json/main.ml b/test/json/main.ml
index 8e116cd..2b2073d 100644
--- a/test/json/main.ml
+++ b/test/json/main.ml
@@ -17,7 +17,8 @@ let encode_decode_predicate =
let encode_decode_object =
QCheck.Test.make ~name:"decode encode object"
Rdf_gen.object'
- (fun object' -> Triple.Object.equal
+ (fun object' ->
+ Triple.Object.equal
object'
(object' |> Rdf_json.encode_object |> Rdf_json.decode_object))