Liking cljdoc? Tell your friends :D

ont-app.vocabulary.core

clj

Defines utilities and a set of namespaces for commonly used linked data constructs, metadata of which specifies RDF namespaces, prefixes and other details.

Defines utilities and a set of namespaces for commonly used linked data
constructs, metadata of which specifies RDF namespaces, prefixes and other
details.
raw docstring

*alias-map*cljs

A map :={alias ns-name, ...}. Where alias is a symbol ns-name is a symbol naming an ns in the current lexical env NOTE: Informs cljc-ns-aliases in cljs space.

A map :={`alias` `ns-name`, ...}.
Where
`alias` is a symbol
`ns-name` is a symbol naming an ns in the current lexical env
NOTE: Informs cljc-ns-aliases in cljs space.
sourceraw docstring

as-calendarclj

(as-calendar date)

Returns an instance of java.util.GregorianCalendar given date (JVM only).

  • Where
    • date is a java.util.Date, the standard value of clojure #inst
  • NOTE: this lets you .get things like the java.util.Calendar/YEAR.
Returns an instance of `java.util.GregorianCalendar` given `date` (JVM only).
- Where
  - `date` is a java.util.Date, the standard value of clojure #inst
- NOTE: this lets you `.get` things like the `java.util.Calendar/YEAR`.
sourceraw docstring

as-kwiclj/smultimethod

Returns keyword identifier for an instance of Resource.

  • Signature: [this] -> kwi.
  • Where:
    • this is an instance of Resource
    • kwi conforms to :voc/kwi-spec
Returns keyword identifier for an instance of Resource.
- Signature: [this] -> `kwi`.
- Where:
  - `this` is an instance of Resource
  - `kwi` conforms to `:voc/kwi-spec`
sourceraw docstring

as-qnameclj/smultimethod

Returns a qname/CURIE for instance of Resource.

  • Signature: [this] -> qname
  • Where
    • this is an instance of Resource
    • qname conforms to :voc/qname-spec
Returns a qname/CURIE for instance of Resource.
- Signature: [this] -> `qname`
- Where
  - `this` is an instance of `Resource`
  - `qname` conforms to `:voc/qname-spec`
sourceraw docstring

as-uri-stringclj/smultimethod

Returns URI string for instance of Resource.

  • Signature: [this] -> uri-string
  • Where
    • this is a Resource
    • uri-string conforms to :voc/uri-str-spec
Returns URI string for instance of Resource.
- Signature: [this] -> `uri-string`
- Where
  - `this` is a Resource
  - `uri-string` conforms to `:voc/uri-str-spec`
sourceraw docstring

clear-caches!clj/s

(clear-caches!)

Side-effects: resets all caches in voc/ to nil. NOTE: call this when you may have imported new namespace metadata

Side-effects: resets all caches in voc/ to nil.
NOTE: call this when you may have imported new namespace metadata
sourceraw docstring

cljc-find-nsclj/s

(cljc-find-ns ns')

Returns ns-name-or-obj for ns', or nil. Where

  • ns-name-or-obj may either be a namespace (in clj) or the name of a namespace (in cljs)
  • ns' is a symbol which may name a namespace. NOTE: Implementations involving cljs must use cljs-put/get-ns-meta to declare ns metadata.
Returns `ns-name-or-obj` for `ns'`, or nil.
Where
  - `ns-name-or-obj` may either be a namespace (in clj)
    or the name of a namespace (in cljs)
  - `ns'` is a symbol which may name a namespace.
NOTE: Implementations involving cljs must use cljs-put/get-ns-meta to declare
      ns metadata.
sourceraw docstring

cljc-ns-aliasesclj/s

(cljc-ns-aliases)

Returns {alias ns, ...}. Where

  • alias is a symbol
  • ns is its associated ns in the current lexical environment. NOTE: cljs will require explicit maintenance of alias-map This is really only necessary if you're importing a package as some symbol other than the preferred prefix.
Returns {`alias` `ns`, ...}.
Where
  - `alias` is a symbol
  - `ns` is its associated ns in the current lexical environment.
NOTE: cljs will require explicit maintenance of *alias-map*
This is really only necessary if you're importing a package
as some symbol other than the preferred prefix.
sourceraw docstring

cljc-resolveclj/s

(cljc-resolve sym)

Returns the resolved sym, if possible.

  • Where
    • sym is a symbol, typically acquired from a string value in a DSTR tag.
  • NOTE:
    • Resolving symbols is not straightforward under cljs, and I have yet to need to do so in anger, so for now under cljs the symbol will be returned unchanged until actual use cases present themselves.
Returns the resolved `sym`, if possible.
- Where
  - `sym` is a symbol, typically acquired from a string value in a DSTR tag.
- NOTE:
  - Resolving symbols is not straightforward under cljs, and I have yet to need to do
    so in anger, so for now under cljs the symbol will be returned unchanged until
    actual use cases present themselves.
sourceraw docstring

cljs-ns-metadatacljs

Stores cljs ns pseudo-metadata. Namespaces in cljs are not proper objects, and there is no metadata available at runtime. This atom stores 'pseudo-metadata' declared with cljc-put-ns-metadata and accessed with cljc-get-metadata. Clj just uses the metadata regime for its ns's

Stores cljs ns `pseudo-metadata`.
Namespaces in cljs are not proper objects, and there is no metadata
available at runtime. This atom stores 'pseudo-metadata' declared with
cljc-put-ns-metadata and accessed with cljc-get-metadata. Clj just uses
the metadata regime for its ns's
sourceraw docstring

configclj/s

A configuration map for ont-app/vocabulary. Typical keys are

  • ::operative-resource-context (optional) a keyword naming the operative resource type context, which informs the resource-type-dispatch function. Resource type contexts should be declared in a taxonomy rooted in ::voc/resource-type-context. Left unspecified, it will be set automatically to the most specific descendant of ::voc/resource-type-context.
    • See also most-specific-resource-type-context
  • inferred-operative-resource-context. This will be created automatically in the absence of ::operative-resource-context
  • ::special-uri-str-re is a regex matching valid URI strings not specified in ordinary-uri-str-re.
    • default: :~ ^(arn:).*
A configuration map for ont-app/vocabulary.
Typical keys are
- `::operative-resource-context` (optional) a keyword naming the operative
     resource type context, which informs the `resource-type-dispatch` function.
     Resource type contexts should be declared in a taxonomy rooted in
     ::voc/resource-type-context. Left unspecified, it will be set automatically to the
     most specific descendant of ::voc/resource-type-context.
     - See also `most-specific-resource-type-context`
- `inferred-operative-resource-context`. This will be created automatically in the absence
   of `::operative-resource-context`
- `::special-uri-str-re` is a regex matching valid URI strings not specified in
     `ordinary-uri-str-re`.
     - default: :~ `^(arn:).*`
sourceraw docstring

default-configclj/s

The default value of voc/config.

The default value of `voc/config`.
sourceraw docstring

disambiguate-prefix-nsclj/smultimethod

Signature: [kw namespaces] -> winning-ns.

  • Where
    • kw is a namespaced keyword
    • namespaces is a set containing a plurality of namespaces associated with prefix = (namespace kw)
    • winning-ns is the member of namespaces appropriate to kw
Signature: [kw namespaces] -> winning-ns.
- Where
  - `kw` is a namespaced keyword
  - `namespaces` is a set containing a plurality of namespaces associated with
     prefix = (namespace kw)
  - `winning-ns` is the member of `namespaces` appropriate to `kw`
sourceraw docstring

get-ns-metaclj/s

(get-ns-meta)
(get-ns-meta ns')

Returns metadata assigned to ns named ns'. Where

  • ns' names a namespace or a 'dummy' namespace whose sole purpose is to hold metadata.
  • metadata := {key value, ...}
  • key is a keyword containing vocabulary metadata, e.g. :vann/preferredNamespacePrefix
Returns `metadata` assigned to ns named `ns'`.
Where
- `ns'` names a namespace or a 'dummy' namespace whose sole purpose is to hold metadata.
- `metadata` := {`key` `value`, ...}
- `key` is a keyword containing vocabulary metadata, e.g. :vann/preferredNamespacePrefix
sourceraw docstring

kw-stringclj/smultimethod

Signature: [this] -> a string to be used as part of a minted kwi.

  • where
    • this is some object
  • Dispatched on (type this)
Signature: [this] -> a string to be used as part of a minted kwi.
- where
  - `this` is some object
- Dispatched on (type this)
sourceraw docstring

mint-kwiclj/smultimethod

Signature: [head-kwi & args] -> cononical-kwi, dispatched on mint-kw-dispatch. Where

  • canonical-kwi is a KWI minted systematically based on its arguments.
  • head-kwi initiates the KWI (typically the name of an existing class in some model).
  • args := [property value, ...], .s.t. the named value is uniquely distinguished. E.g: The default method simply joins arguments on _ as follows: (mint-kwi :myNs/MyClass :myNs/prop1 'foo' :myNs/prop2 'bar) -> :myNs/MyClass_prop1_foo_prop2_bar, but overriding methods will be dispatched on head Compiled arguments are rendered as their hashes.
Signature: [`head-kwi` & `args`] -> `cononical-kwi`, dispatched on `mint-kw-dispatch`.
Where
- `canonical-kwi` is a KWI minted systematically based on its arguments.
- `head-kwi` initiates the KWI (typically the name of an existing class in some
  model).
- `args` := [`property` `value`, ...], .s.t. the named value is uniquely distinguished.
E.g: The default method simply joins arguments on _ as follows:
  (mint-kwi :myNs/MyClass :myNs/prop1 'foo' :myNs/prop2 'bar)
  -> :myNs/MyClass_prop1_foo_prop2_bar, but overriding methods will be
  dispatched on `head`
Compiled arguments are rendered as their hashes.
sourceraw docstring

mint-kwi-dispatchclj/s

(mint-kwi-dispatch head-kwi & _args)

Returns head-kwi as dispatch-key for the mint-kwi method. Where: head-kwi is the first argument dispatch-key is a keyword

Returns `head-kwi` as `dispatch-key` for the `mint-kwi` method.
Where:
`head-kwi` is the first argument
`dispatch-key` is a keyword
sourceraw docstring

most-specific-resource-contextclj/s

(most-specific-resource-context parent-context)

Returns the ::resource-type-context which has no descendents. Raises an error if this is not unique.

Returns the `::resource-type-context` which has no descendents.
Raises an error if this is not unique.
sourceraw docstring

namespace-reclj/s

(namespace-re)

Returns a regex to recognize strings matching a URI for an ns declared with LOD metadata.

  • Side-effect: manages namespace-re-cache
  • NOTE: Groups for namespace and name.
    • i.e. (re-matches (namespace-re) uri-string) -> [uri-string namespace name]
Returns a regex to recognize strings matching a URI for an ns declared with LOD metadata.
- Side-effect: manages `namespace-re-cache`
- NOTE: Groups for namespace and name.
  - i.e. (re-matches (namespace-re) uri-string) -> [uri-string namespace name]
sourceraw docstring

namespace-to-nsclj/s

(namespace-to-ns)

Returns {namespace ns, ...} for each ns with :vann/preferredNamespaceUri declaration.

  • Where
    • namespace is the URI suitable for for an RDF prefix declaration
    • ns is either a clojure ns (clj) or a symbol naming a clojure ns (cljs).
Returns {`namespace` `ns`, ...} for each `ns` with `:vann/preferredNamespaceUri` declaration.
- Where
  - `namespace` is the URI suitable for for an RDF prefix declaration
  - `ns` is either a clojure ns (clj) or a symbol naming a clojure ns (cljs).
sourceraw docstring

ns-to-namespaceclj/s

(ns-to-namespace ns')

Returns iri for ns.

  • Where
    • ns' is an instance of clojure.lang.Namespace (in clj) or a symbol-name for ns (cljs)
    • iri is an iri declared with :vann/preferredNamespaceUri in the metadata for ns', or nil
Returns `iri` for `ns`.
- Where
  - `ns'` is an instance of clojure.lang.Namespace (in clj) or a symbol-name for ns (cljs)
  - `iri` is an iri declared with :vann/preferredNamespaceUri in the metadata for
    `ns'`, or nil
sourceraw docstring

ns-to-prefixclj/s

(ns-to-prefix ns')

Returns the prefix associated with ns'.

  • Where
    • ns' is a clojure namespace, which may have :vann/preferredNamespacePrefix declaration in its metadata.
Returns the prefix associated with `ns'`.
- Where
  - `ns'` is a clojure namespace, which may have :vann/preferredNamespacePrefix
    declaration in its metadata.
sourceraw docstring

operative-resource-contextclj/s

(operative-resource-context)

The resource context on which to dispatch the resource-type multimethod.

The resource context on which to dispatch the `resource-type` multimethod.
sourceraw docstring

ordinary-uri-str-reclj/s

A regex matching a commonly occurring standard URI string. Arbitrarily chosen from https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml.

A regex matching a commonly occurring standard URI string.
Arbitrarily chosen from https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml.
sourceraw docstring

preferred-child-resource-contextclj/smultimethod

Signature: [parent children'] -> preferred child or error.

  • Distpatched on parent
  • Where
    • parent is the resource context from which each child is derived
    • children' := #{child, ...}
    • child is derived from parent in the global heirarchy.
  • NOTE: this is necessary to infer the single most-specific resource type context for a given application in cases where the taxonomy of contexts has multiple branches.
Signature: [`parent` `children'`] -> preferred `child` or error.
- Distpatched on `parent`
- Where
  - `parent` is the resource context from which each `child` is derived
  - `children'` := #{`child`, ...}
  - `child` is derived from `parent` in the global heirarchy.
- NOTE: this is necessary to infer the single most-specific resource type context for a
  given application in cases where the taxonomy of contexts has multiple branches.
sourceraw docstring

prefix-to-namespace-uriclj/s

(prefix-to-namespace-uri prefix)

Returns namespace URI associated with prefix.

  • Where:
    • prefix is a string declared for ns with vann/preferredNamespacePrefix
    • namespace is a string declared for some ns with vann/preferredNamespaceUri
Returns `namespace` URI associated with `prefix`.
- Where:
  - `prefix` is a string declared for `ns` with vann/preferredNamespacePrefix
  - `namespace` is a string declared for some `ns` with vann/preferredNamespaceUri
sourceraw docstring

prefix-to-nsclj/s

(prefix-to-ns)

Returns {prefix ns, ...}.

  • Where
    • prefix is declared in metadata for some ns with :vann/preferredNamespacePrefix
    • ns is an instance of clojure.lang.ns available within the lexical context in which the call was made.
Returns {`prefix` `ns`, ...}.
- Where
  - `prefix` is declared in metadata for some `ns` with
     :vann/preferredNamespacePrefix
  - `ns` is an instance of clojure.lang.ns available within the lexical
     context in which the  call was made.
sourceraw docstring

prefixes-forclj/s

(prefixes-for sparql-string)
(prefixes-for prefix-fn content-string)

Returns [prefix-string...] for each prefix identified in content-string.

  • Where
    • content-string is a string of SPARQL, typically without prefixes

    • prefix-string := PREFIX prefix: namespace

    • prefix is a prefix defined for namespace in metadata of some ns with :vann/preferredNamespacePrefix

    • namespace is a namespace defined in the metadata for some ns with :vann/preferredNamespaceUri

Returns [`prefix-string`...] for each prefix identified in `content-string`.
- Where
  - `content-string` is a string of SPARQL, typically without prefixes
  - `prefix-string` := PREFIX `prefix`: `namespace`

  - `prefix` is a prefix defined for `namespace` in metadata of some ns with
     `:vann/preferredNamespacePrefix`
  - `namespace` is a namespace defined in the metadata for some ns with
    `:vann/preferredNamespaceUri`
sourceraw docstring

prepend-prefix-declarationsclj/s

(prepend-prefix-declarations content-string)
(prepend-prefix-declarations prefixes-for-fn content-string)

Returns content-string, prepended with appropriate PREFIX decls.

  • Where
    • content-string is a string of SPARQL or Turtle/n3, typically without prefixes.
      • default is SPARQL
    • prefixes-for := fn [content-string] -> prefixes-string.
      • in practice this would only be needed for turtle-prefixes-for
Returns `content-string`, prepended with appropriate PREFIX decls.
- Where
  - `content-string` is a string of SPARQL or Turtle/n3, typically without prefixes.
     - default is SPARQL
  - `prefixes-for` := fn [content-string] -> prefixes-string.
    - in practice this would only be needed for `turtle-prefixes-for`
sourceraw docstring

put-ns-meta!clj/s≠

clj
(put-ns-meta! m)
(put-ns-meta! ns' m)
cljs
(put-ns-meta! _m)
(put-ns-meta! ns' m)

Side-effect: ensures that subsequent calls to (cljc-get-ns-meta ns' return m. Where

  • ns' is an ns (clj only) or the name of a namespace, possibly declared for the sole purpose of holding vocabulary metadata (e.g. rdf, foaf, etc)
  • m := {key value, ...}, metadata (clj) or 'pseudo-metadata' (cljs)
  • key is a keyword containing vocabulary metadata, e.g. ::vann/preferredNamespacePrefix NOTE: In cljs, ns's are not available at runtime, so the metadata is stored in an atom called 'voc/cljs-ns-metadata' See also declarations for ont-app.vocabulary.rdf, ont-app.vocabulary.foaf, etc. for examples of namespaces declared solely to hold vocabulary metadata.
Side-effect: ensures that subsequent calls to (cljc-get-ns-meta `ns'` return `m`.
Where
- `ns'`  is an ns (clj only) or the name of a namespace, possibly declared for the sole purpose of holding vocabulary metadata (e.g. rdf, foaf, etc)
- `m` := {`key` `value`, ...}, metadata (clj) or 'pseudo-metadata' (cljs)
- `key` is a keyword containing vocabulary metadata, e.g.
  `::vann/preferredNamespacePrefix`
NOTE: In cljs, ns's are not available at runtime, so the metadata is stored
  in an atom called 'voc/cljs-ns-metadata'
See also declarations for ont-app.vocabulary.rdf, ont-app.vocabulary.foaf, etc.
for examples of namespaces declared solely to hold vocabulary metadata.
sourceraw docstring

register-resource-type-context!clj/s

(register-resource-type-context! child parent)

Side-effects: Derives child from parent and clears (@context ::voc/operative-resource-context).

  • Where
    • child names a resource type context on which methods may be dispatched.
    • parent names a resource type context on which methods may be dispatched.
Side-effects: Derives `child` from `parent` and clears (@context ::voc/operative-resource-context).
- Where
  - `child` names a resource type context on which methods may be dispatched.
  - `parent` names a resource type context on which methods may be dispatched.
sourceraw docstring

resource-typeclj/smultimethod

Signature [this] -> resource-type, dispatched on resource-type-dispatch.

  • Where
    • this is something renderable as a URI, KWI, qname, or some other resource ID.
    • resource-type names a resource type on which as-uri-string, as-kwi, as-qname, resource= and perhaps other methods might be dispatched.
Signature [this] -> `resource-type`, dispatched on `resource-type-dispatch`.
- Where
  - `this` is something renderable as a URI, KWI, qname, or some other
     resource ID.
  - `resource-type` names a resource type on which `as-uri-string`, `as-kwi`,
    `as-qname`, `resource=` and perhaps other methods might be dispatched.
sourceraw docstring

resource-type-dispatchclj/s

(resource-type-dispatch this)

Returns [type-context (type this)].

  • Where
    • this is something which we may want to render as a URI or related construct.
    • type-context is a keyword naming a context to which dispatch methods are keyed. It is the value of (operative-resource-context)
      • defaults to (most-specific-resource-context ::voc/resource-type-context)
Returns [`type-context` (type this)].
- Where
  - `this` is something which we may want to render as a URI or related
     construct.
  - `type-context` is a keyword naming a context to which dispatch methods are
      keyed. It is the value of (operative-resource-context)
     - defaults to (`most-specific-resource-context` `::voc/resource-type-context`)
sourceraw docstring

resource=clj/smultimethod

Truthy when two different resource identifiers refer to the same resource.

  • Signature: [this that] -> truthy
  • Where
    • this is a Resource
    • that is a Resource
Truthy when two different resource identifiers refer to the same resource.
- Signature: [this that] -> truthy
- Where
  - `this` is a Resource
  - `that` is a Resource
sourceraw docstring

sparql-prefix-declarationclj/s

(sparql-prefix-declaration prefix)

Returns PREFIX prefix: <uri>.

  • Where
    • prefix is a prefix in the metadata
    • uri is the uri string associated with prefix in the metadata
Returns PREFIX `prefix`: <`uri`>.
- Where
  - `prefix` is a prefix in the metadata
  - `uri` is the uri string associated with `prefix` in the metadata
sourceraw docstring

sparql-prefixes-forclj/s

(sparql-prefixes-for sparql-string)

Gets SPARQL prefixes from sparql-string.

Gets SPARQL prefixes from `sparql-string`.
sourceraw docstring

tagclj/smultimethod

Signature [obj & maybe tag-spec] -> dstr.

  • Where
    • obj is something to be tagged
    • tag-spec is a resource, or (@lstr/default-tags (type obj))
    • dstr :~ #voc/dstr obj^^tag
    • tag := (as-kwi tag-spec)
Signature [`obj` & maybe `tag-spec`] -> `dstr`.
- Where
  - `obj` is something to be tagged
  - `tag-spec` is a resource, or (@lstr/default-tags (type `obj`))
  - `dstr` :~ #voc/dstr `obj`^^`tag`
  - `tag` := (as-kwi `tag-spec`)
sourceraw docstring

tag-dispatchclj/s

(tag-dispatch obj)
(tag-dispatch _obj tag-spec)

Returns tag for obj with optional tag-spec.

  • Where
    • obj is something to be tagged
    • tag-spec is a resource, or (@dstr/default-tags (type obj))
    • tag := (as-kwi tag-spec)
  • NOTE: this is the dispatch value for the tag method
Returns `tag` for `obj` with optional `tag-spec`.
- Where
  - `obj` is something to be tagged
  - `tag-spec` is a resource, or (@dstr/default-tags (type `obj`))
  - `tag` := (as-kwi `tag-spec`)
- NOTE: this is the dispatch value for the `tag` method
sourceraw docstring

turtle-prefixes-forclj/s

(turtle-prefixes-for ttl-string)

Gets Turtle prefixes from ttl-string.

Gets Turtle prefixes from `ttl-string`.
sourceraw docstring

untagclj/smultimethod

Signature: [dstr & maybe on-not-found-fn?].

  • returns: clojure value appropriate to (as-kwi tag)
  • Where
    • dstr :~ #voc/dstr obj^^tag
    • on-not-found-fn := fn [dstr] -> clojure value or error.
      • Default is error-on-no-untag-found.
Signature: [`dstr` & maybe `on-not-found-fn`?].
- returns: clojure value appropriate to (as-kwi `tag`)
- Where
  - `dstr` :~ #voc/dstr `obj`^^`tag`
  - `on-not-found-fn` := fn [dstr] -> clojure value or error.
     - Default is `error-on-no-untag-found`.
sourceraw docstring

untag-dispatchclj/s

(untag-dispatch dstr & _)

Returns (as-kwi tag) for dstr.

  • Where
    • dstr :~ #voc/dstr obj^^tag
    • tag := (as-qname tag-spec)
Returns (as-kwi `tag`) for `dstr`.
- Where
  - `dstr` :~ #voc/dstr `obj`^^`tag`
  - `tag` := (as-qname `tag-spec`)
  
sourceraw docstring

uri-str-forclj/smultimethod

Deprecated. Use Resource protocol and as-uri-string instead.

Deprecated. Use Resource protocol and `as-uri-string` instead.
sourceraw docstring

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

× close