Note: Atlas is a Proof of Concept. APIs may change.
| Namespace | Purpose |
|---|---|
atlas.core | Public API facade (register, find*, identity-for, deps-of, invariants) |
atlas.registry | Core registration and compound identity operations |
atlas.query | Querying entities by aspects |
atlas.ontology | Data-flow resolution (context/response/deps), tools, templates |
atlas.registry.lookup | Entity resolution (props-for, has-aspect?, all-with-aspect) |
atlas.invariant | Architectural validation |
The semantic kernel - registration and compound identity operations.
Register an entity in the registry.
;; 4-arity: explicit dev-id
(register! dev-id type aspects props)
;; 3-arity: auto-generate dev-id
(register! type aspects props)
Parameters:
dev-id - Keyword, human-readable identifier (e.g., :fn/login)type - Qualified keyword, entity type (e.g., :atlas/execution-function)aspects - Set of qualified keywords (e.g., #{:domain/auth :tier/service})props - Map of propertiesExample:
(registry/register!
:fn/validate-token
:atlas/execution-function
#{:domain/auth :operation/validate :tier/service}
{:execution-function/context [:auth/token]
:execution-function/response [:auth/valid?]
:execution-function/deps #{:component/oauth}})
Get the compound identity for a dev-id.
(identity-for dev-id) => #{...} or nil
Example:
(registry/identity-for :fn/validate-token)
;; => #{:atlas/execution-function :domain/auth :operation/validate :tier/service}
Get the properties for a compound identity.
(fetch registry compound-identity) => map or nil
Example:
(registry/fetch @registry/registry
#{:atlas/execution-function :domain/auth :operation/validate :tier/service})
;; => {:atlas/dev-id :fn/validate-token, :execution-function/context [...], ...}
Extract the entity type from a compound identity.
(entity-type compound-identity) => keyword or nil
Example:
(registry/entity-type #{:atlas/execution-function :domain/auth :tier/service})
;; => :atlas/execution-function
Extract non-type aspects from a compound identity.
(aspects compound-identity) => #{...}
Example:
(registry/aspects #{:atlas/execution-function :domain/auth :tier/service})
;; => #{:domain/auth :tier/service}
Check if a compound identity is structurally valid.
(valid? compound-identity) => boolean
Get all registered entity types.
(registered-types) => #{:atlas/execution-function :atlas/data-schema ...}
Get registry statistics.
(summary) => {:total-entities n, :by-type {...}, ...}
Pure functions for querying the registry.
Find all entities with given aspect(s).
(find-by-aspect registry aspect) => [{:identity #{...} :props {...}} ...]
(find-by-aspect registry aspects-set) => [...]
Example:
;; Single aspect
(query/find-by-aspect @registry/registry :domain/auth)
;; Multiple aspects (AND)
(query/find-by-aspect @registry/registry #{:domain/auth :tier/service})
Find entity by its dev-id.
(find-by-dev-id registry dev-id) => {:identity #{...} :props {...}} or nil
Find entity with exact compound identity match.
(find-exact registry compound-identity) => {:identity #{...} :props {...}} or nil
Filter registry by predicate.
(where registry pred) => [{:identity #{...} :props {...}} ...]
Example:
;; Find entities with :effect/write
(query/where @registry/registry
#(contains? (:identity %) :effect/write))
;; Find functions with more than 2 deps
(query/where @registry/registry
#(> (count (:execution-function/deps (:props %))) 2))
Find entities similar to target identity.
(semantic-similarity registry target) => [{:identity #{...} :similarity 0.75} ...]
(semantic-similarity registry target min-similarity) => [...]
Uses Jaccard similarity (intersection / union).
Build a dependency graph from the registry.
(dependency-graph registry id-key deps-key) => {dev-id #{dep-ids ...} ...}
Example:
(query/dependency-graph @registry/registry :atlas/dev-id :execution-function/deps)
;; => {:fn/login #{:component/db :fn/validate}, :fn/validate #{:component/oauth}, ...}
Group entities by tier.
(by-tier registry) => {:tier/api [...] :tier/service [...] :tier/foundation [...]}
Find all entities affected by changing an entity.
(impact-of-change registry dev-id) => #{affected-dev-ids ...}
Runtime entity resolution. These functions live in atlas.registry.lookup
(identity-for, props-for, has-aspect?, all-with-aspect),
atlas.ontology (context-for, response-for, deps-for), and
atlas.query.dataflow (trace-data-flow). The most-used ones are re-exported
through the atlas.core facade (identity-for, deps-of). There is no
atlas.entity namespace.
Get semantic identity for dev-id. (atlas.registry.lookup / atlas.core)
(identity-for dev-id) => #{...}
Get properties for dev-id.
(props-for dev-id) => {...}
Get context (input data keys) for dev-id.
(context-for dev-id) => [:key1 :key2 ...]
Get response (output data keys) for dev-id.
(response-for dev-id) => [:key1 :key2 ...]
Get dependencies for dev-id.
(deps-for dev-id) => #{:dep1 :dep2 ...}
Check if entity has an aspect.
(has-aspect? dev-id aspect) => boolean
Find all entities with aspect.
(all-with-aspect aspect) => [dev-ids ...]
Trace what produces each context key for an entity.
(trace-data-flow dev-id) => {:key1 :producer-dev-id, :key2 :external, ...}
Architectural validation.
Run all built-in invariants.
(check-all) => {:valid? boolean :violations [...]}
Run specific invariants.
(check invariant-fns) => {:valid? boolean :violations [...]}
Example:
(inv/check [inv/invariant-deps-exist
inv/invariant-no-circular-deps])
Generate human-readable report.
(report) => "string report"
Structural:
invariant-deps-exist - All dependencies reference existing entitiesinvariant-no-circular-deps - No cycles in dependency graphinvariant-all-fns-reachable - Functions reachable from endpointsData Flow:
invariant-context-satisfiable - Context keys are producibleinvariant-no-orphan-responses - Response keys are consumedSemantic:
invariant-endpoints-are-api-tier - Endpoints are :tier/apiinvariant-components-are-foundation - Components are :tier/foundationinvariant-external-is-async - External integrations are asyncinvariant-pure-has-no-deps - Pure functions have no depsProtocol:
invariant-protocol-exists - Referenced protocols existinvariant-protocol-conformance - Implementations conformDevelopment tools and templates.
Register all built-in entity types.
(register-entity-types!) => nil
Call this once at startup.
Browse all aspects with usage statistics.
(aspect-catalog) => {:domain/auth {:count 5, :entities [...]} ...}
Get aspect suggestions based on similar entities.
(suggest-aspects partial-identity) => [:suggested/aspect1 :suggested/aspect2 ...]
Analyze what's affected by changes to an aspect.
(impact-analysis aspect) => {:direct [...] :transitive [...]}
Pre-built templates for common patterns:
;; Foundation component
(template:foundation-component :component/my-db :domain/users
{:component/provides [:db/query]})
;; Service function
(template:service-function :fn/my-fn :domain/users :operation/read
{:execution-function/context [:user/id]
:execution-function/response [:user/data]
:execution-function/deps #{}})
;; API endpoint
(template:api-endpoint :endpoint/my-ep :domain/users :http/get
{:endpoint/context [:http/params]
:endpoint/response [:http/json]
:endpoint/deps #{:fn/my-fn}})
Fluent query builder.
(-> (where-> :domain/auth)
(and-aspect :tier/service)
(execute-query))
Quick inspection of a dev-id.
(inspect :fn/login)
;; Prints identity, props, deps, consumers, etc.
Atlas uses a global mutable registry:
atlas.registry/registry ; the atom
@atlas.registry/registry ; current state (map)
For testing, reset between tests:
(use-fixtures :each
(fn [f]
(reset! atlas.registry/registry {})
(f)
(reset! atlas.registry/registry {})))
Most functions return nil for not-found rather than throwing. Invariant violations are returned as data:
{:valid? false
:violations [{:invariant :deps-exist
:entity :fn/broken
:message "Dependency :component/missing not found"
:severity :error}]}
Can you improve this documentation?Edit on GitHub
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 |