@dialog-db/query
Version:
Datalog query engine inspired by Datomic
79 lines • 2.77 kB
TypeScript
/**
* @template {API.Proposition} [Match=API.Proposition]
*/
export class DeductiveRule<Match extends API.Proposition = API.Proposition> {
/**
* @param {Match} match
* @param {API.Scope} scope
* @param {Record<string, API.Join>} disjuncts
* @param {number} cost
* @param {boolean} recurs
*/
constructor(match: Match, scope: API.Scope, disjuncts: Record<string, API.Join>, cost: number, recurs: boolean);
match: Match;
scope: API.Scope;
disjuncts: Record<string, API.Join>;
cost: number;
recurs: boolean;
get when(): Record<string, API.Join>;
toJSON(): {
match: Match;
when?: undefined;
} | {
match: Match;
when: any;
};
toDebugString(): string;
/**
* @param {API.EvaluationContext} context
* @returns {API.Task<API.MatchFrame[], Error>}
*/
evaluate(context: API.EvaluationContext): API.Task<API.MatchFrame[], Error>;
}
/**
* @template {API.Proposition} [Match=API.Proposition]
* @extends {API.RuleApplicationPlan<Match>}
*/
export class RuleApplication<Match extends API.Proposition = API.Proposition> {
/**
* @param {Partial<API.RuleBindings<Match>>} match
* @param {API.RuleSyntax<Match>} rule
* @param {API.Cursor} references
* @param {API.MatchFrame} bindings
*/
constructor(match: Partial<API.RuleBindings<Match>>, rule: API.RuleSyntax<Match>, references: API.Cursor, bindings: API.MatchFrame);
match: Partial<API.RuleBindings<Match>>;
rule: API.RuleSyntax<Match>;
references: API.Cursor;
bindings: API.MatchFrame;
plan: API.RulePlan;
get cost(): number;
/**
* @param {API.EvaluationContext} context
*/
evaluate({ source, selection }: API.EvaluationContext): Generator<typeof import("../task.js").SUSPEND | import("../task.js").Join | import("../task.js").Throw<API.EvaluationError>, API.MatchFrame[], unknown>;
get terms(): [string, API.Term][];
/**
* @param {API.MatchFrame} frame
*/
read(frame: API.MatchFrame): Map<any, any>[];
/**
* @param {API.MatchFrame} frame
* @param {API.MatchFrame[]} outputs
*/
write(frame: API.MatchFrame, ...outputs: API.MatchFrame[]): Map<API.Variable<API.Scalar>, API.Scalar>[];
toJSON(): {
match: Partial<API.RuleBindings<Match>>;
rule: any;
};
/**
* @param {object} input
* @param {API.Querier} input.from
*/
query({ from: source }: {
from: API.Querier;
}): Generator<typeof import("../task.js").SUSPEND | import("../task.js").Join | import("../task.js").Throw<API.EvaluationError>, API.MatchFrame[], unknown>;
toDebugString(): string;
}
import * as API from './plan.js';
//# sourceMappingURL=rule.d.ts.map