Skip to content

IOntologyQuery

IOntologyQuery is the runtime query surface over a composed OntologyGraph. The source generator emits a concrete OntologyQueryService that implements every member; agents and dispatcher decorators inject IOntologyQuery to ask “what actions are valid here?”, “which properties does this action change?”, “what would I touch downstream if I edited X?” without re-parsing the ontology at every call site.

Namespace: Strategos.Ontology.Query. Source: src/Strategos.Ontology/Query/IOntologyQuery.cs.

CategoryMemberReturns
CoreGetObjectTypes(string? domain, string? implementsInterface, bool includeSubtypes)IReadOnlyList<ObjectTypeDescriptor>
CoreGetActions(string objectType)IReadOnlyList<ActionDescriptor>
CoreGetLinks(string objectType)IReadOnlyList<LinkDescriptor>
CoreGetImplementors(string interfaceName)IReadOnlyList<ObjectTypeDescriptor>
PreconditionsGetValidActions(string objectType, IReadOnlyDictionary<string, object?>? knownProperties)IReadOnlyList<ActionDescriptor>
PreconditionsGetActionConstraintReport(string objectType, IReadOnlyDictionary<string, object?>? knownProperties)IReadOnlyList<ActionConstraintReport>
PreconditionsGetActionConstraintReport(string domain, string objectType, IReadOnlyDictionary<string, object?>? knownProperties)IReadOnlyList<ActionConstraintReport>
PostconditionsTracePostconditions(string objectType, string actionName, int maxDepth)IReadOnlyList<PostconditionTrace>
LifecycleGetActionsForState(string objectType, string stateName)IReadOnlyList<ActionDescriptor>
LifecycleGetTransitionsFrom(string objectType, string stateName)IReadOnlyList<LifecycleTransitionDescriptor>
DerivationGetAffectedProperties(string objectType, string propertyName)IReadOnlyList<AffectedProperty>
DerivationGetDerivationChain(string objectType, string propertyName)IReadOnlyList<DerivationSource>
Interface actionsGetInterfaceActions(string interfaceName)IReadOnlyList<InterfaceActionDescriptor>
Interface actionsResolveInterfaceAction(string objectType, string interfaceActionName)ActionDescriptor?
Inverse linksGetInverseLinks(string objectType, string linkName)IReadOnlyList<LinkDescriptor>
Extension pointsGetExtensionPoints(string objectType)IReadOnlyList<ExternalLinkExtensionPoint>
Extension pointsGetIncomingCrossDomainLinks(string objectType)IReadOnlyList<ResolvedCrossDomainLink>
Object setsGetObjectSet<T>(string objectType)ObjectSet<T> where T : class
Object setsGetObjectTypeNames<T>()IReadOnlyList<string> where T : class
Validation (2.5.0)EstimateBlastRadius(IReadOnlyList<OntologyNodeRef> touchedNodes, BlastRadiusOptions? options)BlastRadius
Validation (2.5.0)DetectPatternViolations(IReadOnlyList<OntologyNodeRef> affectedNodes, DesignIntent intent)IReadOnlyList<PatternViolation>

GetObjectTypes returns every registered descriptor when called with no arguments. domain narrows to a single domain; implementsInterface narrows to types whose ImplementedInterfaces contains the named interface; includeSubtypes follows the IsA<TParent>() hierarchy when filtering by parent. The returned list preserves registration order.

GetActions, GetLinks, and GetImplementors resolve their target by simple name; pass the (domain, objectType) overload of GetActionConstraintReport instead when two domains register the same name.

GetValidActions runs every registered action’s precondition expression against knownProperties and returns the subset whose hard preconditions hold; missing keys evaluate as unsatisfied. GetActionConstraintReport returns one entry per action regardless of pass/fail, with the hard and soft evaluations split — agents read this to plan with awareness of why an action is currently unavailable.

The domain-qualified overload (GetActionConstraintReport(domain, objectType, knownProperties)) is the recommended call site: the default interface implementation falls back to the simple-name overload only for backwards compatibility with test doubles that have not been updated.

TracePostconditions(objectType, actionName, maxDepth = 1) follows declared Modifies, CreatesLinked, and EmitsEvent postconditions; raising maxDepth follows derivation chains from the modified properties, surfacing transitive effects. The result is ordered by traversal depth.

GetObjectSet<T>(string objectType) returns a typed ObjectSet<T> rooted at the named descriptor. GetObjectTypeNames<T>() returns every descriptor name T was registered under, in registration order; a single-registered type has a one-element list, and an unregistered type has an empty list. This lets consumers (e.g. Basileus) enumerate per-collection partitions of a shared content-carrier type without hardcoding descriptor names.

Blast radius and pattern violations (2.5.0)

Section titled “Blast radius and pattern violations (2.5.0)”

EstimateBlastRadius walks links, derivation chains, postconditions, and cross-domain links from a seed set of OntologyNodeRef values until BlastRadiusOptions.MaxExpansionDegree is reached. The returned BlastRadius carries a deterministically ordered set of affected nodes, the cross-domain hops encountered, and a classified scope (single-type, single-domain, cross-domain).

DetectPatternViolations evaluates the supplied affectedNodes against the DesignIntent and returns any pattern fires (empty when the intent is satisfied). The signatures are declared on IOntologyQuery as default-throwing methods — concrete implementations such as OntologyQueryService override them. Test doubles that pre-date 2.5.0 throw NotSupportedException when called.

Every where T : class constraint is on ObjectSet<T> and GetObjectTypeNames<T>. ResolveInterfaceAction returns null when no concrete action implements the named interface action on objectType. Property dictionaries (knownProperties) are optional — pass null for an unconditional reading.