Liking cljdoc? Tell your friends :D

ont-app.rdf.core

clj

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.
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`.
 
raw docstring

add-catalog-entry!clj/s

(add-catalog-entry! download-url namespace-uri prefix media-type)

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'
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'
sourceraw docstring

ask-s-p-oclj/s

(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 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
Returns 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
sourceraw docstring

ask-s-p-o-templateclj/s

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`
sourceraw docstring

bnode-kwi?clj/s

(bnode-kwi? kwi)

True when kwi matches the canonical bnode representation.

True when `kwi` matches the canonical bnode representation.
sourceraw docstring

cache-url-as-local-fileclj/s

(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.

  • 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
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`
sourceraw docstring

cached-file-pathclj/s

(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.
sourceraw docstring

catalog-lookupclj/s

(catalog-lookup url)

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)
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)
sourceraw docstring

check-ns-metadataclj/s

(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.
sourceraw docstring

check-qnameclj/s

(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.
sourceraw docstring

cljc-create-temp-fileclj/s

(cljc-create-temp-file stem ext)

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 '.'
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 '.'
sourceraw docstring

cljc-file-exists?clj/s

(cljc-file-exists? path)

True when path exists in the local file system

True when `path` exists in the local file system
sourceraw docstring

cljc-file-lengthclj/s

(cljc-file-length f)

Returns length of file f. Not supported under cljs.

Returns length of file `f`. Not supported under cljs.
sourceraw docstring

cljc-http-getclj/s

(cljc-http-get url req)

Makes 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
Makes 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
sourceraw docstring

cljc-is-local-file?clj/s

(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
sourceraw docstring

cljc-make-fileclj/s

(cljc-make-file path)

Returns new file object for path. Not supported under cljs.

Returns new file object for `path`. Not supported under cljs.
sourceraw docstring

cljc-make-parentsclj/s

(cljc-make-parents f)

Ensures directory path for file f. Not supported under cljs.

Ensures directory path for file `f`. Not supported under cljs.
sourceraw docstring

cljc-resourceclj/s

(cljc-resource r)

Returns the resource named by r. Not supported under cljs.

Returns the resource named by `r`. Not supported under cljs.
sourceraw docstring

coerce-graph-elementclj/s

(coerce-graph-element x)
(coerce-graph-element policy x)

Returns 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.
Returns `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.
sourceraw docstring

collect-ns-catalog-metadataclj/s

(collect-ns-catalog-metadata gacc _prefix ns)

Reducing function outputs gacc' given voc metadata assigned to namespace

  • NOTE: typically used to initialize the resource catalog.
Reducing function outputs `gacc'` given voc metadata assigned to namespace
- NOTE: typically used to initialize the resource catalog.
sourceraw docstring

default-contextclj/s

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]
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`]
sourceraw docstring

from-clause-forclj/s

(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` 
sourceraw docstring

get-cached-file-path-specclj/s

(get-cached-file-path-spec context url)

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
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`
sourceraw docstring

http-get-from-catalogclj/s

(http-get-from-catalog url)

returns an http response to a GET request for url

  • Where
    • 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`
sourceraw docstring

load-rdfclj/smultimethod

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.
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.
sourceraw docstring

load-rdf-dispatchclj/s

(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`
sourceraw docstring

lookup-file-specs-in-catalogclj/s

(lookup-file-specs-in-catalog url)

Returns 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
Returns `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
sourceraw docstring

normal-form-query-templateclj/s

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` 
sourceraw docstring

on-js-reloadcljs

(on-js-reload)
source

ontologyclj/s

The supporting vocabulary for the RDF module

The supporting vocabulary for the RDF module
sourceraw docstring

parse-urlclj/s

(parse-url url)

Returns a file specification parsed directly from a URL (not in the catalog), or nil

  • where
    • url is a URL, probably a file resource
Returns a file specification parsed directly from a URL (not in the catalog), or nil
- where
  - `url` is a URL, probably a file resource
sourceraw docstring

parse-url-reclj/s

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.
sourceraw docstring

prefixedclj/s

Returns query, with prefix declarations prepended Where

  • query is presumed to be a SPARQL query
Returns `query`, with prefix declarations prepended
Where
- `query` is presumed to be a SPARQL query
sourceraw docstring

query-for-normal-formclj/s

(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 store
  • query-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`
sourceraw docstring

query-for-oclj/s

(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 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)
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)
  
sourceraw docstring

query-for-o-templateclj/s

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`
sourceraw docstring

query-for-p-oclj/s

(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-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)
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)
sourceraw docstring

query-for-p-o-templateclj/s

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`
sourceraw docstring

query-for-subjectsclj/s

(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 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)
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)
sourceraw docstring

query-template-defaultsclj/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.
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.
sourceraw docstring

quote-strclj/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.
sourceraw docstring

read-rdfclj/smultimethod

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

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`
sourceraw docstring

read-rdf-dispatchclj/s

(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`
sourceraw docstring

read-transit-jsonclj/s

(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-handlers
Returns a value parsed from transit string `s`
Where
- `s` is a &quot;-escaped string encoded as transit
Note: custom datatypes will be informed by @transit-read-handlers
sourceraw docstring

render-literalclj/smultimethod

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`)
sourceraw docstring

render-literal-as-transit-jsonclj/s

(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.
sourceraw docstring

render-literal-dispatchclj/s

(render-literal-dispatch 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)
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`)
sourceraw docstring

render-transit-jsonclj/s

(render-transit-json value)

Returns 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
Returns 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
sourceraw docstring

resource-catalogclj/s

A 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 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
sourceraw docstring

special-literal-dispatchclj/s

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.
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.
sourceraw docstring

standard-data-transfer-dispatchclj/s

(standard-data-transfer-dispatch to-transfer)

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.
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.
sourceraw docstring

subjects-query-templateclj/s

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` 
sourceraw docstring

transit-reclj/s

Matches data tagged as transit:json

Matches data tagged as transit:json
sourceraw docstring

transit-read-handlersclj/s

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 {`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`.
sourceraw docstring

transit-write-handlersclj/s

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, ...}
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`, ...}
sourceraw docstring

write-rdfclj/smultimethod

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)

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)
sourceraw docstring

write-rdf-dispatchclj/s

(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`
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close