grafter.rdf.io

Functions & Protocols for serializing Grafter Statements into
any Linked Data format supported by Sesame.

filename->rdf-format

(filename->rdf-format fname)
Given a filename we attempt to return an appropriate RDFFormat
object based on the files extension.

ISesameRDFConverter

protocol

members

->sesame-rdf-type

(->sesame-rdf-type this)
Convert a native type into a Sesame RDF Type

sesame-rdf-type->type

(sesame-rdf-type->type this)
Convert a Sesame RDF Type into a Native Type

IStatement->sesame-statement

(IStatement->sesame-statement is)
Convert a grafter IStatement into a Sesame statement.

literal-datatype->type

multimethod

A multimethod to convert an RDF literal into a corresponding
Clojure type.  This method can be extended to provide custom
conversions.

mimetype->rdf-format

(mimetype->rdf-format mime-type)
Given a mimetype string we attempt to return an appropriate
RDFFormat object based on the files extension.

rdf-serializer

(rdf-serializer destination & {:keys [append format encoding], :or {append false, encoding "UTF-8"}})
Coerces destination into an java.io.Writer using
clojure.java.io/writer and returns an RDFSerializer.

Accepts also the following optional options:

:append          If set to true it will append new values to the end of
                 the file destination (default: false).

:format          If a String or a File are provided the format parameter
                 can be optional (in which case it will be infered from
                 the file extension).  This should be a sesame RDFFormat
                 object.

:encoding        The character encoding to be used (default: UTF-8)

s

(s str)(s str lang-or-uri)
Cast a string to an RDF literal.  The second optional argument can
either be a keyword corresponding to an RDF language tag
e.g. :en, :en-gb, or :fr or a string or URI in which case it is
assumed to be a URI identifying the RDF type of the literal.

sesame-statement->IStatement

(sesame-statement->IStatement st)
Convert a sesame Statement into a grafter Quad.