grafter.rdf.templater

Functions for converting tree’s of turtle-like data into Linked Data statements (triples/quads).

add-properties

(add-properties triple-template hash-map)

Appends the key/value pairs from the supplied hash-map into the triple-template form. Assumes it is given a vector representing a single subject.

graph

(graph graph-uri & triples)

Takes a graph-uri and a turtle-like template of vectors and returns a lazy-sequence of quad Statements. A turtle-like template should be structured like this:

[subject [predicate1 object1]
         [predicate2 object2]
         [predicate3 [[blank-node-predicate blank-node-object]]]]

Subjects, predicates and objects can be strings, URI’s or URL’s, whilst objects can also be literal types such as java numeric types, Dates etc.

For convenience strings in these templates are assumed to be URI’s and are cast as such, as URI’s are the most common type in linked data. If you want an RDF string you should use the s function to build one.

triplify

(triplify & subjects)

Takes many turtle like structures and converts them to a lazy-seq of grafter.rdf.protocols.IStatement’s. Users should generally tend to prefer to using graph to triplify.