This is a backstop for shared logic between various RDF-based implementations of IGraph. It includes:
load-rdf
read-rdf
and write-rdf
.This is a backstop for shared logic between various RDF-based implementations of IGraph. It includes: - support for LangStr using the #voc/lstr custom reader - support for ^^transit:json datatype tags - templating utilities for the standard IGraph member access methods. - i/o methods `load-rdf` `read-rdf` and `write-rdf`.
(add-catalog-entry! download-url namespace-uri prefix media-type)
Adds an entry in @resource-catalog for download-url
namespace-uri
prefix
media-type
download-url
is a URL (or string) naming a place on the web containing an RDF filenamespace-uri
is the primary URI, associated with prefix
prefix
is the preferred prefix for namespace-uri
media-type
is the MIME type, of download-url
eg 'text/turtle'Adds an entry in @resource-catalog for `download-url` `namespace-uri` `prefix` `media-type` - Where - `download-url` is a URL (or string) naming a place on the web containing an RDF file - `namespace-uri` is the primary URI, associated with `prefix` - `prefix` is the preferred prefix for `namespace-uri` - `media-type` is the MIME type, of `download-url` eg 'text/turtle'
(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 a set of them
(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 a set of them (or nil if DEFAULT graph) - `ask-fn` := fn [repo] -> bindings
A 'stache template for a query ref'd in ask-s-p-o
, informed by query-template-map
A 'stache template for a query ref'd in `ask-s-p-o`, informed by `query-template-map`
(bnode-kwi? kwi)
True when kwi
matches the canonical bnode representation.
True when `kwi` matches the canonical bnode representation.
(cache-url-as-local-file context url)
RETURNS cached-file
, with contents of url
loaded
SIDE-EFFECT: creates file named cached-file
if it does not already exist.
context
is a native-normal graph informed by vocabulary below.url
:= a URL or string naming URLcached-file-path
names a local file to contain contents from url
context
)
cached-file-path-fn
]
parse-map
from url
first by looking
it up in the @resource-catalog
and then by parsing the url
itselfcache-directory
]cached-file-path-fn
:= fn (uri) -> parse-map
parse-map
:= m s.t (keys m) :~ #{:url :path :stem :ext} for url
informed by context
RETURNS `cached-file`, with contents of `url` loaded SIDE-EFFECT: creates file named `cached-file` if it does not already exist. - Where - `context` is a native-normal graph informed by vocabulary below. - `url` := a URL or string naming URL - `cached-file-path` names a local file to contain contents from `url` - VOCABULARY (for `context`) - [:rdf-app/UrlCache :rdf-app/pathFn `cached-file-path-fn`] - optional. Default will try to derive `parse-map` from `url` first by looking it up in the @`resource-catalog` and then by parsing the `url` itself - [:rdf-app/UrlCache :rdf-app/directory `cache-directory`] - `cached-file-path-fn` := fn (uri) -> `parse-map` - `parse-map` := m s.t (keys m) :~ #{:url :path :stem :ext} for `url` informed by `context`
(cached-file-path & {:keys [dir url stem ext]})
Returns a canonical path for cached contents read from a URL.
Returns a canonical path for cached contents read from a URL.
(catalog-lookup url)
Returns catalog-entry
for url
catalog-entry
:= m s.t. (keys m) :~ #{?media-type :?prefix :?suffix :?media-url}url
is a URL that may be in the resource catalog:?prefix
is the preferred prefix associated with url
(which informs the stem):?suffix
is the suffix associated with the :?media-url
(informs the extension)Returns `catalog-entry` for `url` - Where - `catalog-entry` := m s.t. (keys m) :~ #{?media-type :?prefix :?suffix :?media-url} - `url` is a URL that may be in the resource catalog - `:?prefix` is the preferred prefix associated with `url` (which informs the stem) - `:?suffix` is the suffix associated with the `:?media-url` (informs the extension)
(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.
(cljc-create-temp-file stem ext)
Returns a temporary file named per stem
and ext
. Not supported under cljs.
stem
is a general name for the fileext
is a file extension typically starting with '.'Returns a temporary file named per `stem` and `ext`. Not supported under cljs. - where - `stem` is a general name for the file - `ext` is a file extension typically starting with '.'
(cljc-file-exists? path)
True when path
exists in the local file system
True when `path` exists in the local file system
(cljc-file-length f)
Returns length of file f
. Not supported under cljs.
Returns length of file `f`. Not supported under cljs.
(cljc-http-get url req)
Makes a GET call to url
with req
. Not yet supported in cljs.
url
is a URL or a URL stringreq
is an http request mapMakes a GET call to `url` with `req`. Not yet supported in cljs. - Where - `url` is a URL or a URL string - `req` is an http request map
(cljc-is-local-file? f)
True when f
is a file in the local file system
True when `f` is a file in the local file system
(cljc-make-file path)
Returns new file object for path
. Not supported under cljs.
Returns new file object for `path`. Not supported under cljs.
(cljc-make-parents f)
Ensures directory path for file f
. Not supported under cljs.
Ensures directory path for file `f`. Not supported under cljs.
(cljc-resource r)
Returns the resource named by r
. Not supported under cljs.
Returns the resource named by `r`. Not supported under cljs.
(coerce-graph-element x)
(coerce-graph-element policy x)
Returns x
, possibly coerced to either a kwi or a java.net.URI per policy
policy
:= m s.t. (keys m) :- #{::kwi-if ::uri-if}x
is any candidate as an element in an IGraphkwi-if
:= fn [x] -> truthy if x
should be translated to a keyword iduri-if
:= fn [x] -> truthy if x
should be translated to a java.net.URIReturns `x`, possibly coerced to either a kwi or a java.net.URI per `policy` - where - `policy` := m s.t. (keys m) :- #{::kwi-if ::uri-if} - `x` is any candidate as an element in an IGraph - `kwi-if` := fn [x] -> truthy if `x` should be translated to a keyword id - `uri-if` := fn [x] -> truthy if `x` should be translated to a java.net.URI - NOTE: Some implementations of IGraph may be a lot more tolarant of datatypes in s/p/o position than the URI/URI/URI-or-literal that RDF expects.
(collect-ns-catalog-metadata gacc _prefix ns)
Reducing function outputs gacc'
given voc metadata assigned to namespace
Reducing function outputs `gacc'` given voc metadata assigned to namespace - NOTE: typically used to initialize the resource catalog.
An atom containing a native-normal graph with default i/o context configurations.
URL cache directory
]An atom containing a native-normal graph with default i/o context configurations. - NOTE: This would typically be the starting point for the i/o context of individual implementations. - VOCABULARY - [:rdf-app/UrlCache :rdf-app/directory `URL cache directory`]
(from-clause-for graph-uri)
Returns FROM graph-uri
'
Note: typically informs query-template-map
Returns FROM `graph-uri`' Note: typically informs `query-template-map`
(get-cached-file-path-spec context url)
Returns m
s.t (keys m) :~ #{:url :path :stem :ext} for url
informed by context
url
(as arg) is x s.t. (str x) -> a URL stringcontext
is an native-normal graph describing the I/O contexturl
(as key) is a URL stringpath
is the path component of url
stem
is the 'stem portion of /path/to/<stem>.<ext>ext
is the 'ext' portion of /path/to/<stem>.<ext>dir
is the directory containing cache filesurl
.cached-file-path-fn
]
m
from url
automatically
Either through lookup-file-specs-in-catalog
or by parsing url
itself.dir
]cached-file-path-fn
:= fn (uri) -> m
Returns `m` s.t (keys m) :~ #{:url :path :stem :ext} for `url` informed by `context` - Where - `url` (as arg) is x s.t. (str x) -> a URL string - `context` is an native-normal graph describing the I/O context - `url` (as key) is a URL string - `path` is the path component of `url` - `stem` is the 'stem portion of /path/to/<stem>.<ext> - `ext` is the 'ext' portion of /path/to/<stem>.<ext> - `dir` is the directory containing cache files - NOTE: this should be sufficient to create a unique temp file path for caching contents of `url`. - VOCABULARY - [:rdf-app/UrlCache :rdf-app/pathFn `cached-file-path-fn`] - optional. Default will try to infer `m` from `url` automatically Either through `lookup-file-specs-in-catalog` or by parsing `url` itself. - [:rdf-app/UrlCache :rdf-app/directory `dir`] - `cached-file-path-fn` := fn (uri) -> `m`
(http-get-from-catalog url)
returns an http response to a GET request for url
url
is a URL with an entry in the @resource-catalog
returns an http response to a GET request for `url` - Where - `url` is a URL with an entry in the @`resource-catalog`
Returns a new IGraph with contents for to-load
,
args: [context
to-load
]
dispatched on: [graph-dispatch
to-load-rdf-dispatch
]
Where
context
is a native-normal graph with descriptions per the vocabulary below.
It may also provide platform-specific details that inform specific methods.to-load
is typically a path or URL, but could be anything you write a method for
:rdf-app/LocalFile
. We may need to derive file-extension
.graph-dispatch
is the dispatch value identifying the IGraph implementationto-load-rdf-dispatch
is the dispatch value derived for to-load-rdf
file-extension
may be implicit from a file name or derived per vocabulary below
It may be necesary to inform your RDF store about the expected format.VOCABULARY (in context
)
#'load-rdf
:rdf-app/hasGraphDispatch graph-dispatch
]#'load-rdf
:rdf-app/toImportDispatchFn (fn [to-load] -> to-load-dispatch)]
... optional. Defaults to output of standard-data-transfer-dispatch
#'load-rdf
:rdf-app/extensionFn (fn [to-load] -> file-extension)]
... optional. By default it parses the presumed path name described by to-load
cache-directory
]Returns a new IGraph with contents for `to-load`, - args: [`context` `to-load`] - dispatched on: [`graph-dispatch` `to-load-rdf-dispatch`] - Where - `context` is a native-normal graph with descriptions per the vocabulary below. It may also provide platform-specific details that inform specific methods. - `to-load` is typically a path or URL, but could be anything you write a method for - if this is a file name that exists in the local file system this will be dispatched as `:rdf-app/LocalFile`. We may need to derive `file-extension`. - `graph-dispatch` is the dispatch value identifying the IGraph implementation - `to-load-rdf-dispatch` is the dispatch value derived for `to-load-rdf` - `file-extension` may be implicit from a file name or derived per vocabulary below It may be necesary to inform your RDF store about the expected format. - VOCABULARY (in `context`) - [`#'load-rdf` :rdf-app/hasGraphDispatch `graph-dispatch`] - [`#'load-rdf` :rdf-app/toImportDispatchFn (fn [to-load] -> to-load-dispatch)] ... optional. Defaults to output of `standard-data-transfer-dispatch` - [`#'load-rdf` :rdf-app/extensionFn (fn [to-load] -> file-extension)] ... optional. By default it parses the presumed path name described by `to-load` - [rdf-app/UrlCache rdf-app/directory `cache-directory`] - [rdf-app/UrlCache rdf-app/cacheMaintenance :rdf-app/DeleteOnRead] ... optional. specifies that a cached file should be deleted after a read. - by default it will not be deleted.
(load-rdf-dispatch context to-load)
Returns [graph-dispatch to-load-dispatch]. See docstring for rdf/load-rdf
Returns [graph-dispatch to-load-dispatch]. See docstring for `rdf/load-rdf`
(lookup-file-specs-in-catalog url)
Returns file-specs
for url
file-specs
:= m s.t. (keys m) :~ #{:url :path :stem :ext}url
(as arg) is a URL we may want to get from an http callurl
(as key) is the string version of url
path
is the file path of url
stem
is the preferred prefix for url
in the catalogext
is the file suffix associated with the media type of url
in the catalogReturns `file-specs` for `url` - Where - `file-specs` := m s.t. (keys m) :~ #{:url :path :stem :ext} - `url` (as arg) is a URL we may want to get from an http call - `url` (as key) is the string version of `url` - `path` is the file path of `url` - `stem` is the preferred prefix for `url` in the catalog - `ext` is the file suffix associated with the media type of `url` in the catalog
A 'stache template for a query ref'd in query-for-normal-form
, informed by query-template-map
A 'stache template for a query ref'd in `query-for-normal-form`, informed by `query-template-map`
The supporting vocabulary for the RDF module
The supporting vocabulary for the RDF module
(parse-url url)
Returns a file specification parsed directly from a URL (not in the catalog), or nil
url
is a URL, probably a file resourceReturns a file specification parsed directly from a URL (not in the catalog), or nil - where - `url` is a URL, probably a file resource
A regex to parse a file URL string with a file name and an extension.
A regex to parse a file URL string with a file name and an extension.
Returns query
, with prefix declarations prepended
Where
query
is presumed to be a SPARQL queryReturns `query`, with prefix declarations prepended Where - `query` is presumed to be 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, or a set of them
(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, or a set of them (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 a set of them
(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 a set of them (or nil if DEFAULT graph)
A 'stache template for a query ref'd in query-for-o
, informed by query-template-map
A 'stache template for a query ref'd in `query-for-o`, informed by `query-template-map`
(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
from query to 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 a set of them
(or nil if DEFAULT graph)Returns {`p` #{`o`...}...} for `s` from query to `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 a set of them (or nil if DEFAULT graph)
A 'stache template for a query ref'd in query-for-p-o
, informed by query-template-map
A 'stache template for a query ref'd in `query-for-p-o`, informed by `query-template-map`
(query-for-subjects query-fn rdf-store)
(query-for-subjects graph-uri query-fn rdf-store)
Returns [subject
...] at endpoint of rdf-store
for graph-uri
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 a set of them (or nil if DEFAULT
graph)Returns [`subject` ...] at endpoint of `rdf-store` for `graph-uri` 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 a set of them (or nil if DEFAULT graph)
Default key/value pairs appicable to query templates for your platform. Where
:from-clauses
one FROM clause for each graph informing the query: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 - `:from-clauses` one FROM clause for each graph informing the query - `: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.
Side-effect: updates g
with added contents from to-read
,
Returns: modified g
args: [context g to-read]
dispatched on: [graph-dispatch to-read-dispatch]
Where
context
is a native-normal graph with descriptions per the vocabulary below.
It may also provide platform-specific details that inform specific methods.
to-read
is typically a path or URL, but could be anything you write a method for
:rdf-app/LocalFile
. We may need to derive file-extension
.graph-dispatch
is the dispatch value identifying the IGraph implementation
to-read-dispatch
is the dispatch value derived for to-read
file-extension
may be implicit from a file name or derived per vocabulary below
It may be necesary to inform your RDF store about the expected format.
VOCABULARY (in context
)
[#'read-rdf
:rdf-app/hasGraphDispatch graph-dispatch
]
[#'read-rdf
:rdf-app/toImportDispatchFn (fn [to-read] -> to-read-dispatch
)]
... optional. Defaults to output of standard-data-transfer-dispatch
[#'read-rdf
:rdf-app/extensionFn (fn [to-read] -> file-extension)]
... optional. By default it parses the presumed path name described by to-read
Side-effect: updates `g` with added contents from `to-read`, Returns: modified `g` - args: [context g to-read] - dispatched on: [graph-dispatch to-read-dispatch] - Where - `context` is a native-normal graph with descriptions per the vocabulary below. It may also provide platform-specific details that inform specific methods. - `to-read` is typically a path or URL, but could be anything you write a method for - if this is a file name that exists in the local file system this will be dispatched as `:rdf-app/LocalFile`. We may need to derive `file-extension`. - `graph-dispatch` is the dispatch value identifying the IGraph implementation - `to-read-dispatch` is the dispatch value derived for `to-read` - `file-extension` may be implicit from a file name or derived per vocabulary below It may be necesary to inform your RDF store about the expected format. - VOCABULARY (in `context`) - [`#'read-rdf` :rdf-app/hasGraphDispatch `graph-dispatch`] - [`#'read-rdf` :rdf-app/toImportDispatchFn (fn [to-read] -> `to-read-dispatch`)] ... optional. Defaults to output of `standard-data-transfer-dispatch` - [`#'read-rdf` :rdf-app/extensionFn (fn [to-read] -> file-extension)] ... optional. By default it parses the presumed path name described by `to-read`
(read-rdf-dispatch context g to-read)
Returns [graph-dispatch to-read-dispatch]. See docstring for rdf/read-rdf
Returns [graph-dispatch to-read-dispatch]. See docstring for `rdf/read-rdf`
(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
for methods with signature (fn [literal] -> rdf
)
Returns an RDF (Turtle) rendering of `literal` for methods with signature (fn [literal] -> `rdf`)
(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 native normal graph using this vocabulary:
namespace-uri
:dcat/downloadURL download-url
]namespace-uri
:vann/preferredNamespacePrefix prefix
]download-url
:dcat/mediaType media-type
]download-url
is a URL stringmedia-type
:= :rdf/type :dct/MediaTypeOrExtentA native normal graph using this vocabulary: - [`namespace-uri` :dcat/downloadURL `download-url`] - [`namespace-uri` :vann/preferredNamespacePrefix `prefix`] - [`download-url` :dcat/mediaType `media-type`] - where - `download-url` is a URL string - `media-type` := :rdf/type :dct/MediaTypeOrExtent
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.
(standard-data-transfer-dispatch to-transfer)
Returns a standard dispatch-key
for to-transfer
, defaulting to (type to-transfer)
to-transfer
is typically an argument to the load-rdf
, read-rdf
or write-rdf
methods.dispatch-key
:~ #{:rdf-app/LocalFile, :rdf-app/FileResource :rdf/WebResource}
or the type of to-transfer
.to-transfer
is a local path stringto-transfer
is a file resource (maybe from a jar)Returns a standard `dispatch-key` for `to-transfer`, defaulting to (type to-transfer) - Where - `to-transfer` is typically an argument to the `load-rdf`, `read-rdf` or `write-rdf` methods. - `dispatch-key` :~ #{:rdf-app/LocalFile, :rdf-app/FileResource :rdf/WebResource} or the type of `to-transfer`. - :rdf-app/LocalFile indicates that `to-transfer` is a local path string - :rdf-app/FileResource indicates that `to-transfer` is a file resource (maybe from a jar) - :rdf-app/WebResource indicates something accessible through a curl call.
A 'stache template for a query ref'd in query-for-subjects
, informed by query-template-map
A 'stache template for a query ref'd in `query-for-subjects`, informed by `query-template-map`
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
, a symbol, 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`, a symbol, is a direct reference to the class instance to be encoded - `write-handler` := fn [s] -> {`field` `value`, ...}
Side-effect: writes contents of g
to to-write
in fmt
,
Returns: modified g
args: [context g to-write fmt]
dispatched on: [graph-dispatch to-write-dispatch fmt]
Where
context
is a native-normal graph with descriptions per the vocabulary below.
It may also provide platform-specific details that inform specific methods.to-write
is typically a path or URL, but could be anything you write a method for
:rdf-app/LocalFile
.graph-dispatch
is the dispatch value identifying the IGraph implementationto-write-dispatch
is the dispatch value derived for to-write
fmt
is typically a KWI derived from :dct/MediaTypeOrExtent
VOCABULARY (in context
)
[#'write-rdf
:rdf-app/hasGraphDispatch graph-dispatch
]
[#'write-rdf
:rdf-app/toExportDispatchFn (fn [to-write] -> to-write-dispatch
)]
... optional. Defaults to (type to-write)
Side-effect: writes contents of `g` to `to-write` in `fmt`, Returns: modified `g` - args: [context g to-write fmt] - dispatched on: [graph-dispatch to-write-dispatch fmt] - Where - `context` is a native-normal graph with descriptions per the vocabulary below. It may also provide platform-specific details that inform specific methods. - `to-write` is typically a path or URL, but could be anything you write a method for - if this is a file name that exists in the local file system this will be dispatched as `:rdf-app/LocalFile`. - `graph-dispatch` is the dispatch value identifying the IGraph implementation - `to-write-dispatch` is the dispatch value derived for `to-write` - `fmt` is typically a KWI derived from `:dct/MediaTypeOrExtent` - VOCABULARY (in `context`) - [`#'write-rdf` :rdf-app/hasGraphDispatch `graph-dispatch`] - [`#'write-rdf` :rdf-app/toExportDispatchFn (fn [to-write] -> `to-write-dispatch`)] ... optional. Defaults to (type to-write)
(write-rdf-dispatch context g to-write fmt)
Returns [graph-dispatch to-write-dispatch fmt]. See docstring for rdf/write-rdf
Returns [graph-dispatch to-write-dispatch fmt]. See docstring for `rdf/write-rdf`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close