Better Literals
Literals are the RDF terms that can hold values (https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal).
Currently literals are implemented as records in ocaml-rdf
with values being encoded as strings:
type t = {
value: string;
datatype: IRI.t;
language: string option;
}
This can be improved by using native OCaml types. For example a boolean (using the http://www.w3.org/2001/XMLSchema#boolean datatype) such be stored as OCaml bool
type.
It would be very cool if ocaml-rdf
users can define their own custom datatypes. This might be a bit tricky to implement as this is a very dynamic-typey feature in a very static-typey language. But I think OCaml has some tricks to make this work (functors).
So the tricky part is to create a system that allows custom datatypes that are directly mapped to native OCaml types.
It would be nice to implement some commonly used datatypes in ocaml-rdf
for following RDF and XSD datatypes directly in:
- xsd:string (https://www.w3.org/TR/xmlschema11-2/#string)
- rdf:langString
- xsd:boolean
- xsd:decimal
- xsd:float
- xsd:dateTime
- xsd:base64Binary