aboutsummaryrefslogtreecommitdiff
path: root/lib/core/literal.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/core/literal.ml')
-rw-r--r--lib/core/literal.ml17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/core/literal.ml b/lib/core/literal.ml
index 42e31e7..fbff07b 100644
--- a/lib/core/literal.ml
+++ b/lib/core/literal.ml
@@ -33,13 +33,14 @@ let equal a b =
(Option.equal String.equal a.language b.language)
let compare a b =
- let result = String.compare
- (Iri.to_string a.datatype ^ canonical a)
- (Iri.to_string b.datatype ^ canonical b)
- in
- Format.printf "compare literal: %d\n" result;
- result
+ String.compare
+ (Iri.to_string a.datatype ^ canonical a ^
+ (Option.value ~default:"" a.language))
+ (Iri.to_string b.datatype ^ canonical b ^
+ (Option.value ~default:"" b.language))
let pp ppf literal =
- (* TODO print the datatype and language *)
- Fmt.pf ppf "@[<h 1><literal@ %s>@]" (canonical literal)
+ (* TODO print language. Maybe use the Turtle pp for nicer pp. *)
+ Fmt.pf ppf "@[<h 1><literal@ %s^^%a>@]"
+ (canonical literal)
+ Iri.pp (datatype literal)