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>
PreconditionsGetCandidateActions(string objectType, ActionFacts? facts)IReadOnlyList<ActionCandidateEvaluation>
PreconditionsGetCandidateActions(string domain, string objectType, ActionFacts? facts)IReadOnlyList<ActionCandidateEvaluation>
PreconditionsGetCandidateActionsAsync(ActionPrincipal, domain, objectType, objectId, ActionFacts?, CancellationToken)Task<IReadOnlyList<ActionCandidateEvaluation>>
PreconditionsGetValidActions(string objectType, ActionFacts? facts)IReadOnlyList<ActionDescriptor>
PreconditionsGetValidActionsAsync(ActionPrincipal, domain, objectType, objectId, ActionFacts?, CancellationToken)Task<IReadOnlyList<ActionDescriptor>>
PreconditionsGetActionConstraintReport(string objectType, ActionFacts? facts)IReadOnlyList<ActionConstraintReport>
PreconditionsGetActionConstraintReport(string domain, string objectType, ActionFacts? facts)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.

GetCandidateActions* evaluates immutable typed predicates against ActionFacts. It returns results carrying ActionAvailability.Available or Indeterminate, plus the hard and soft constraint evaluations; actions proven Unavailable are excluded. A missing fact is indeterminate; explicit PredicateLiteral.Null and link absence are known values.

GetValidActions* is the compatibility convenience: it excludes only actions proven unavailable and therefore returns the same retained action set without the evaluations. Use GetCandidateActions* when the caller must distinguish known availability from incomplete information, and GetActionConstraintReport* to inspect unavailable actions too. The async forms supply the principal/target context needed by relation and custom evaluators.

Domain-qualified overloads are the recommended call site when multiple domains may register the same object name. The default GetActionConstraintReport(domain, objectType, facts) implementation falls back to the simple-name overload only for compatibility with test doubles.

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. ActionFacts is optional; passing null means every property and link fact is unknown, not false.