This is a backstop for shared logic between various RDF-based implementations of IGraph. It includes:
This is a backstop for shared logic between various RDF-based implementations of IGraph. It includes: - support for LangStr using the #lstr custom reader - support for ^^transit:json datatype tags - templating utilities for the standard IGraph member access methods.
(ask-s-p-o ask-fn rdf-store s p o)
(ask-s-p-o graph-uri ask-fn rdf-store s p o)
Returns true if s
p
o
is a triple at endpoint of rdf-store
Where:
s
p
o
are subject, predicate and objectrdf-store
is an RDF storegraph-uri
is a URI or KWI naming the graph (or nil if DEFAULT graph)ask-fn
:= fn [repo] -> bindingsReturns true if `s` `p` `o` is a triple at endpoint of `rdf-store` Where: - `s` `p` `o` are subject, predicate and object - `rdf-store` is an RDF store - `graph-uri` is a URI or KWI naming the graph (or nil if DEFAULT graph) - `ask-fn` := fn [repo] -> bindings
(bnode-kwi? kwi)
True when kwi
matches output of bnode-translator
.
True when `kwi` matches output of `bnode-translator`.
(check-ns-metadata kwi)
Logs a warning when kwi
is in a namespace with no metadata.
Logs a warning when `kwi` is in a namespace with no metadata.
(check-qname uri-spec)
Traps the keyword assertion error in voc and throws a more meaningful error about blank nodes not being supported as first-class identifiers.
Traps the keyword assertion error in voc and throws a more meaningful error about blank nodes not being supported as first-class identifiers.
The supporting vocabulary for the RDF module
The supporting vocabulary for the RDF module
Returns query
, with prefix declarations prepended
Where
query
is a SPARQL queryReturns `query`, with prefix declarations prepended Where - `query` is a SPARQL query
(query-for-normal-form query-fn rdf-store)
(query-for-normal-form graph-uri query-fn rdf-store)
Returns IGraph normal form for graph
named by graph-uri
in rdf-store
Where
graph
is a named graph in rdf-store
graph-uri
is a URI or KWI naming the graph (default nil -> DEFAULT graph)rdf-store
is an RDF storequery-fn
:= fn [rdf-store sparql-query] -> #{bmap
, ...}bmap
:= {:?s :?p :?o}sparql-query
:- normal-form-query-template
Returns IGraph normal form for `graph` named by `graph-uri` in `rdf-store` Where - `graph` is a named graph in `rdf-store` - `graph-uri` is a URI or KWI naming the graph (default nil -> DEFAULT graph) - `rdf-store` is an RDF store - `query-fn` := fn [rdf-store sparql-query] -> #{`bmap`, ...} - `bmap` := {:?s :?p :?o} - `sparql-query` :- `normal-form-query-template`
(query-for-o query-fn rdf-store s p)
(query-for-o graph-uri query-fn rdf-store s p)
Returns #{o
...} for s
and p
at endpoint of rdf-store
Where:
o
is an object rendered per binding translator of rdf-store
s
is a subject URI rendered per binding translator of rdf-store
p
is a predicate URI rendered per binding translator of rdf-store
rdf-store
is an RDF storequery-fn
:= fn [repo] -> bindingsgraph-uri
is a URI or KWI naming the graph (or nil if DEFAULT graph)Returns #{`o`...} for `s` and `p` at endpoint of `rdf-store` Where: - `o` is an object rendered per binding translator of `rdf-store` - `s` is a subject URI rendered per binding translator of `rdf-store` - `p` is a predicate URI rendered per binding translator of `rdf-store` - `rdf-store` is an RDF store - `query-fn` := fn [repo] -> bindings - `graph-uri` is a URI or KWI naming the graph (or nil if DEFAULT graph)
(query-for-p-o query-fn rdf-store s)
(query-for-p-o graph-uri query-fn rdf-store s)
Returns {p
#{o
...}...} for s
at endpoint of rdf-store
Where
p
is a predicate URI rendered per binding translator of rdf-store
o
is an object value, rendered per the binding translator of rdf-store
s
is a subject uri keyword. ~ voc/voc-rerdf-store
is and RDF store.query-fn
:= fn [repo] -> bindingsgraph-uri
is a URI or KWI naming the graph (or nil if DEFAULT graph)Returns {`p` #{`o`...}...} for `s` at endpoint of `rdf-store` Where - `p` is a predicate URI rendered per binding translator of `rdf-store` - `o` is an object value, rendered per the binding translator of `rdf-store` - `s` is a subject uri keyword. ~ voc/voc-re - `rdf-store` is and RDF store. - `query-fn` := fn [repo] -> bindings - `graph-uri` is a URI or KWI naming the graph (or nil if DEFAULT graph)
(query-for-subjects query-fn rdf-store)
(query-for-subjects graph-uri query-fn rdf-store)
Returns [subject
...] at endpoint of rdf-store
Where
subject
is the uri of a subject from rdf-store
,
rendered per the binding translator of rdf-store
rdf-store
conforms to ::sparql-client specquery-fn
:= fn [repo] -> bindingsgraph-uri
is a URI or KWI naming the graph (or nil if DEFAULT graph)Returns [`subject` ...] at endpoint of `rdf-store` Where - `subject` is the uri of a subject from `rdf-store`, rendered per the binding translator of `rdf-store` - `rdf-store` conforms to ::sparql-client spec - `query-fn` := fn [repo] -> bindings - `graph-uri` is a URI or KWI naming the graph (or nil if DEFAULT graph)
Default key/value pairs appicable to query templates for your platform. Where
:graph-name-open
opens the named graph expession:graph-name-close
closes :graph-name-open
:rebind-_s
asserts new binding for ?_s in ?_s ?_p ?_o:rebind-_p
asserts a new binding the value retrieved for ?_p in ?_s ?_p ?_o:rebind-_o
aserts a new binding the value retrieved for ?_o in ?_s ?_p ?_oIRI(?_S)
in jena to set up bnode round-tripping for ?_s.Default key/value pairs appicable to query templates for your platform. Where - `:graph-name-open` opens the named graph expession - `:graph-name-close` closes `:graph-name-open` - `:rebind-_s` asserts new binding for ?_s in ?_s ?_p ?_o - `:rebind-_p` asserts a new binding the value retrieved for ?_p in ?_s ?_p ?_o - `:rebind-_o` aserts a new binding the value retrieved for ?_o in ?_s ?_p ?_o - NOTE: For example we may assert :rebind-_s as `IRI(?_S)` in jena to set up bnode round-tripping for ?_s.
(quote-str s)
Returns s
, in escaped quotation marks.
Where
s
is a string, typically to be rendered in a query or RDF source.Returns `s`, in escaped quotation marks. Where - `s` is a string, typically to be rendered in a query or RDF source.
(read-transit-json s)
Returns a value parsed from transit string s
Where
s
is a "-escaped string encoded as transit
Note: custom datatypes will be informed by @transit-read-handlersReturns a value parsed from transit string `s` Where - `s` is a "-escaped string encoded as transit Note: custom datatypes will be informed by @transit-read-handlers
Returns an RDF (Turtle) rendering of literal
Returns an RDF (Turtle) rendering of `literal`
(render-literal-as-transit-json x)
Returns 'x^^transit:json' NOTE: this will be encoded on write and decoded on read by the cognitect/transit library.
Returns 'x^^transit:json' NOTE: this will be encoded on write and decoded on read by the cognitect/transit library.
(render-literal-dispatch literal)
Returns a key for the render-literal method to dispatch on given literal
Where
literal
is any non-keywordspecial-dispatch
are special cases; otherwise
(type literal
)Returns a key for the render-literal method to dispatch on given `literal` Where - `literal` is any non-keyword - NOTE: LangStr and non-nil `special-dispatch` are special cases; otherwise (type `literal`)
(render-transit-json value)
Returns a string of transit for value
Where
value
is any value that be handled by cognitict/transitReturns a string of transit for `value` Where - `value` is any value that be handled by cognitict/transit - Note: custom datatypes will be informed by @transit-write-handlers
A function [x] -> dispatch-value
Where
x
is any value, probabaly an RDF literaldispatch-value
is a value to be matched to a render-literal-dispatch method.
Default is to return nil, signalling no special dispatch.A function [x] -> `dispatch-value` Where - `x` is any value, probabaly an RDF literal - `dispatch-value` is a value to be matched to a render-literal-dispatch method. Default is to return nil, signalling no special dispatch.
Matches data tagged as transit:json
Matches data tagged as transit:json
Atom of the form {className
read-handler
Where
className
is a fully qualified string naming a class to be encodedread-handler
:= fn [from-rep] -> instance
from-rep
:= an Object s.t. (field
from-rep), encoded in corresponding
write-handler in @transit-write-handlers
.Atom of the form {`className` `read-handler` Where - `className` is a fully qualified string naming a class to be encoded - `read-handler` := fn [from-rep] -> `instance` - `from-rep` := an Object s.t. (`field` from-rep), encoded in corresponding write-handler in @`transit-write-handlers`.
Atom of the form {Class
write-handler
, ...}
Where
Class
is a direct reference to the class instance to be encodedwrite-handler
:= fn [s] -> {field
value
, ...}Atom of the form {`Class` `write-handler`, ...} Where - `Class` is a direct reference to the class instance to be encoded - `write-handler` := fn [s] -> {`field` `value`, ...}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close