grafter.rdf

Functions and macros for creating RDF data.  Includes a small
DSL for creating turtle-like templated forms.

add

(add target triples)(add target graph triples)(add target graph format triple-stream)(add target graph base-uri format triple-stream)
Adds a sequence of statements to the specified datasink.  Supports
all the same targets as add-statement.

Takes an optional string/URI to use as a graph.

add-statement

(add-statement target statement)(add-statement target graph statement)
Add an RDF statement to the target datasink.  Datasinks must
implement grafter.rdf.protocols/ITripleWriteable.

Datasinks include sesame RDF repositories, connections and anything
built by rdf-serializer.

Takes an optional string/URI to use as a graph.

context

(context statement)
Return the RDF context from a statement.

object

(object statement)
Return the RDF object from a statement.

predicate

(predicate statement)
Return the RDF predicate from a statement.

prefixer

(prefixer uri-prefix)
Takes the base prefix of a URI string and returns a function that
concatenates its argument onto the end of it e.g.
((prefixer "http://example.org/") "foo") ;; => "http://example.org/foo";

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.

statements

(statements this & {:keys [format buffer-size], :as options})
Attempts to coerce an arbitrary source of RDF statements into a
sequence of grafter Statements.

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.

subject

(subject statement)
Return the RDF subject from a statement.