(compact iri parsed-context-or-fn)
Compacts an expanded IRI using the provided parsed context or compact function.
Compacts an expanded IRI using the provided parsed context or compact function.
(compact-fn parsed-context)
(compact-fn parsed-context used-atom)
Returns a single-arity function that compacts expanded IRIs using the parsed context.
The returned function will attempt to compact an IRI by:
Optional used-atom parameter (a Clojure atom) captures all context terms that were actually used during compaction. This is useful when working with large contexts (like schema.org) to identify which subset of terms were actually needed.
Returns a single-arity function that compacts expanded IRIs using the parsed context. The returned function will attempt to compact an IRI by: - First checking for exact matches in the context - Then checking for partial matches to create prefixed forms (e.g., "schema:name") - Returning the original IRI if no match is found Optional used-atom parameter (a Clojure atom) captures all context terms that were actually used during compaction. This is useful when working with large contexts (like schema.org) to identify which subset of terms were actually needed.
(details compact-iri parsed-context)
(details compact-iri parsed-context vocab?)
Expands an IRI and returns [expanded-iri context-settings].
vocab? true (default) uses @vocab for properties/classes, false uses @base for @id values.
Expands an IRI and returns [expanded-iri context-settings]. vocab? true (default) uses @vocab for properties/classes, false uses @base for @id values.
(expand node-map)
(expand node-map parsed-context)
Expands a JSON-LD document to its full form with all context applied.
Takes a JSON-LD node (map) and optional parsed context. If the node contains a local @context, it will be merged with any provided parsed context.
Returns an expanded document where:
Recursively expands into child nodes.
Expands a JSON-LD document to its full form with all context applied. Takes a JSON-LD node (map) and optional parsed context. If the node contains a local @context, it will be merged with any provided parsed context. Returns an expanded document where: - Compact IRIs are expanded to full IRIs - JSON-LD keywords (@id, @type, @graph, @list, @value) become Clojure keywords (:id, :type, :graph, :list, :value) - Values include metadata: - :idx - Path in the original document using get-in syntax (useful for error reporting) - :value - The actual value - :type - The datatype IRI (if specified) - :language - Language tag (if specified) - :list - Ordered list values (for @list containers) - @graph returns a vector of expanded nodes Recursively expands into child nodes.
(expand-iri compact-iri parsed-context)
(expand-iri compact-iri parsed-context vocab?)
Expands a compact IRI to its full form using the parsed context.
vocab? true (default) uses @vocab for properties/classes, false uses @base for @id values.
Expands a compact IRI to its full form using the parsed context. vocab? true (default) uses @vocab for properties/classes, false uses @base for @id values.
(external-context url)
Returns a pre-loaded parsed context for the given URL.
Returns nil if not available.
Returns a pre-loaded parsed context for the given URL. Returns nil if not available.
(external-iri iri)
Returns IRI information for a specific IRI if available in pre-loaded vocabularies.
Returns nil if not found.
Returns IRI information for a specific IRI if available in pre-loaded vocabularies. Returns nil if not found.
(external-vocab iri)
Returns vocabulary information for a specific IRI including relationships like rdfs:subClassOf.
Returns nil if not found.
Returns vocabulary information for a specific IRI including relationships like rdfs:subClassOf. Returns nil if not found.
(json-ld? x)
Returns true if the document appears to be JSON-LD (has @graph, @context, or @id).
Returns true if the document appears to be JSON-LD (has @graph, @context, or @id).
(normalize-data data)
(normalize-data data opts)
Normalizes JSON-LD data to a consistent string format for comparison/hashing.
Options:
Normalizes JSON-LD data to a consistent string format for comparison/hashing. Options: - :algorithm - :basic (default) or :URDNA2015 (not yet supported) - :format - :application/json (default) or :application/n-quads (not yet supported)
(parse-context context)
(parse-context base-context context)
(parse-context base-context externals context)
Parses a JSON-LD context and returns a parsed context with an internal representation to make repeated expansion/compaction more efficient for use in other API calls.
Optional parameters:
Parses a JSON-LD context and returns a parsed context with an internal representation to make repeated expansion/compaction more efficient for use in other API calls. Optional parameters: - base-context: Previously parsed context to merge into the new un-parsed context - externals: Set of allowed external context URLs (defaults to pre-loaded contexts)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close