grafter.rdf.sparql
deprecated in 0.12.0
DEPRECATED: Use grafter.rdf4j.sparql instead. This namespace contains the
old sesame implementation.
key->replacer
(key->replacer k)
query
(query sparql-file)
(query sparql-file repo)
(query sparql-file bindings repo)
Takes a string reference to a sparql-file on the resource path and
optionally a map of bindings that should map SPARQL variables from
your query to concrete values, allowing you to restrict and
customise your query.
The bindings map is optional, and if it's not provided then the
query in the file is run as is.
Additionally, if your sparql query specifies a LIMIT or OFFSET the
bindings map supports the special keys ::limits and ::offsets.
Which should be maps binding identifiable limits/offsets from your
query to new values.
VALUES clause bindings are supported like normal ?var bindings when
there is just one VALUES binding. When there are more than one, you
should provide a vector containing the component var names as the
key in the map, with a sequence of sequences as the values
themselves. e.g. to override a clause like this:
VALUES ?a ?b { (1 2) (3 4) }
You would provide a map that looked like this:
{[:a :b] [[1 1] [2 2] [3 3]]}
nil's inside the VALUES row's themselves will raise an error.
The clojure keyword :grafter.rdf.sparql/undef can be used to
represent a SPARQL UNDEF, in the bound VALUES data.
The final argument `repo` should be the repository to query.
If only one argument referencing a resource path to a SPARQL query
then a partially applied function is returned. e.g.
(def spog (query "grafter/rdf/sparql/select-spog.sparql"))
(spog r) ;; ... triples ...
(spog r {:s [(URI. "http://s1") (URI. "http://s2")]}) ;; triples for VALUES clause subjects s.
(spog r {:s (java.net.URI. "http://example.org/data/a-triple")}) ;; triples for given subject s.
var-key-matcher
(var-key-matcher k)