Functions & Protocols for serializing Grafter Statements to (and from) any Linked Data format supported by RDF4j.
Functions & Protocols for serializing Grafter Statements to (and from) any Linked Data format supported by RDF4j.
A multimethod to convert a backend RDF literal into a corresponding Clojure type. This method can be extended to provide custom conversions. You should typically not need to call this directly, instead see backend-quad->grafter-quad.
A multimethod to convert a backend RDF literal into a corresponding Clojure type. This method can be extended to provide custom conversions. You should typically not need to call this directly, instead see backend-quad->grafter-quad.
(backend-quad->grafter-quad st)
Convert an RDF4j backend quad into a grafter Quad.
Convert an RDF4j backend quad into a grafter Quad.
(->backend-type this)
Convert an arbitrary statement type into an RDF4j Statement type
Convert an arbitrary statement type into an RDF4j Statement type
(make-rdf-writer 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 RDFWriter.
Use this to capture the intention to write to a location in a specific RDF format, e.g.
(grafter-2.rdf/add (rdf-writer "/tmp/foo.nt" :format :nt) quads)
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 clojure keyword representing the format extension e.g. :nt.
:encoding The character encoding to be used (default: UTF-8)
Coerces destination into an java.io.Writer using clojure.java.io/writer and returns an RDFWriter. Use this to capture the intention to write to a location in a specific RDF format, e.g. (grafter-2.rdf/add (rdf-writer "/tmp/foo.nt" :format :nt) quads) 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 clojure keyword representing the format extension e.g. :nt. - :encoding The character encoding to be used (default: UTF-8)
(quad->backend-quad is)
Convert a grafter IStatement into a backend (RDF4j) statement type.
Convert a grafter IStatement into a backend (RDF4j) statement type.
(rdf-writer destination
&
{:keys [append format encoding prefixes]
:or {append false encoding "UTF-8" prefixes default-prefixes}
:as opts})
Coerces destination into an java.io.Writer using clojure.java.io/writer and returns an RDFWriter.
Use this to capture the intention to write to a location in a specific RDF format, e.g.
(grafter-2.rdf/add (rdf-writer "/tmp/foo.nt" :format :nt) quads)
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 clojure keyword representing the format extension e.g. :nt.
:encoding The character encoding to be used (default: UTF-8)
:prefixes A map of RDF prefix names to IRI prefixes.
NOTE: this function starts the RDFHandler and writes the supplied
prefixes to the writer, and then returns the writer. If you want to
separate the writing of prefixes from the creation of the writer and
want to control the starting of the writer, please use
make-rdf-writer
and write-prefixes
.
Coerces destination into an java.io.Writer using clojure.java.io/writer and returns an RDFWriter. Use this to capture the intention to write to a location in a specific RDF format, e.g. (grafter-2.rdf/add (rdf-writer "/tmp/foo.nt" :format :nt) quads) 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 clojure keyword representing the format extension e.g. :nt. - :encoding The character encoding to be used (default: UTF-8) - :prefixes A map of RDF prefix names to IRI prefixes. NOTE: this function starts the RDFHandler and writes the supplied prefixes to the writer, and then returns the writer. If you want to separate the writing of prefixes from the creation of the writer and want to control the starting of the writer, please use `make-rdf-writer` and `write-prefixes`.
(statements this & {:keys [format buffer-size base-uri] :as options})
Attempts to coerce an arbitrary source of RDF statements into a sequence of grafter Statements, using the RDF4j backend.
If the source is a quad store quads from all the named graphs will be returned. Any triples in an unnamed graph will be ignored.
Takes optional parameters which may be used depending on the context e.g. specifiying the format of the source triples.
The :format
option is supplied by the wrapping function and may be
nil, or act as an indicator about the format of the triples to read.
Implementers can choose whether or not to ignore or require the
format parameter.
The :buffer-size
option can be used to configure the buffer size
at which statements are parsed from an RDF stream. Its default
value of 32 was found to work well in practice, and also aligns with
chunk size of Clojure's lazy sequences.
The :base-uri
option can be supplied to automatically re@base
IRI's on a new prefix when reading.
Attempts to coerce an arbitrary source of RDF statements into a sequence of grafter Statements, using the RDF4j backend. If the source is a quad store quads from all the named graphs will be returned. Any triples in an unnamed graph will be ignored. Takes optional parameters which may be used depending on the context e.g. specifiying the format of the source triples. The `:format` option is supplied by the wrapping function and may be nil, or act as an indicator about the format of the triples to read. Implementers can choose whether or not to ignore or require the format parameter. The `:buffer-size` option can be used to configure the buffer size at which statements are parsed from an RDF stream. Its default value of 32 was found to work well in practice, and also aligns with chunk size of Clojure's lazy sequences. The `:base-uri` option can be supplied to automatically re`@base` IRI's on a new prefix when reading.
(->rdf4j-uri this)
Coerce an object into an RDF4j IRI
Coerce an object into an RDF4j IRI
(write-prefixes target)
(write-prefixes target prefixes)
Write a map of RDF prefix mappings to the supplied RDFHandler.
NOTE: This call does not flush the handler, so prefixes may appear after a subsequent call to add (or RDF4j's underlying .endRDF method).
Write a map of RDF prefix mappings to the supplied RDFHandler. NOTE: This call does not flush the handler, so prefixes may appear after a subsequent call to add (or RDF4j's underlying .endRDF method).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close