Build and query an entity index for URPX documents.
URPX JSON-LD documents are graphs: most entities carry a :jsonld/id and refer
to other entities by reference shape {:jsonld/id "urpx:foo"}. Coercion
leaves these references intact; consumers dereference them on demand against
an index keyed by id string.
Note: many references point to vocabulary IRIs in the URPX ontology (e.g. urpx:peakTier, urpx:allDays, urpx:bundledLedger) rather than entities defined in the document. Those lookups return nil — callers distinguish internal refs (resolve to a node) from vocabulary terms (do not).
Build and query an entity index for URPX documents.
URPX JSON-LD documents are graphs: most entities carry a :jsonld/id and refer
to other entities by reference shape `{:jsonld/id "urpx:foo"}`. Coercion
leaves these references intact; consumers dereference them on demand against
an index keyed by id string.
Note: many references point to vocabulary IRIs in the URPX ontology
(e.g. urpx:peakTier, urpx:allDays, urpx:bundledLedger) rather than entities
defined in the document. Those lookups return nil — callers distinguish
internal refs (resolve to a node) from vocabulary terms (do not).(build-index doc)Walk a URPX document (raw or coerced) and return a map from id string to
the entity node bearing that id. Suitable input: anything urpx.core/load-rate-plan
or urpx.coerce/coerce-rate-plan produces.
Walk a URPX document (raw or coerced) and return a map from id string to the entity node bearing that id. Suitable input: anything `urpx.core/load-rate-plan` or `urpx.coerce/coerce-rate-plan` produces.
(get-entity index id)Look up an entity directly by id string. Same as (resolve-ref index id)
when the input is a string, but with a clearer name when the call site
already has the bare id.
Look up an entity directly by id string. Same as `(resolve-ref index id)` when the input is a string, but with a clearer name when the call site already has the bare id.
(ref? v)True if v looks like a JSON-LD @id reference — a map with a :jsonld/id
but no :jsonld/type. (Real entities carry both; references carry only :jsonld/id.)
True if `v` looks like a JSON-LD @id reference — a map with a :jsonld/id but no :jsonld/type. (Real entities carry both; references carry only :jsonld/id.)
(resolve-ref index ref-or-id)Given an index and either a Ref map ({:jsonld/id "urpx:foo"}) or an id string,
return the indexed entity, or nil if not found.
Returns nil for vocabulary IRIs that don't correspond to a node in the document.
Given an `index` and either a Ref map ({:jsonld/id "urpx:foo"}) or an id string,
return the indexed entity, or nil if not found.
Returns nil for vocabulary IRIs that don't correspond to a node in the document.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |