simple-graph-query
Version:
TypeScript evaluator for Forge expressions with browser-compatible UMD bundle
49 lines (48 loc) • 1.5 kB
TypeScript
import { IAtom, IDataInstance } from "./types";
export type AtomSelectionExample = {
atoms: Set<IAtom>;
datum: IDataInstance;
};
export type AtomPair = readonly [IAtom, IAtom];
export type BinaryRelationExample = {
pairs: Set<AtomPair>;
datum: IDataInstance;
};
type ExpressionNode = {
kind: "identifier";
name: string;
} | {
kind: "union" | "intersection" | "difference";
left: ExpressionNode;
right: ExpressionNode;
} | {
kind: "join";
left: ExpressionNode;
right: ExpressionNode;
} | {
kind: "closure";
child: ExpressionNode;
};
export type WhyNode = {
kind: ExpressionNode["kind"];
expression: string;
result: Set<string> | null;
children?: WhyNode[];
};
export declare class SelectorSynthesisError extends Error {
}
export declare function synthesizeSelector(examples: AtomSelectionExample[], maxDepth?: number): string;
export declare function synthesizeBinaryRelation(examples: BinaryRelationExample[], maxDepth?: number): string;
export type SynthesisWhyExample = {
datum: IDataInstance;
target: Set<string>;
result: Set<string> | null;
why: WhyNode;
};
export type SynthesisWhy = {
expression: string;
examples: SynthesisWhyExample[];
};
export declare function synthesizeSelectorWithWhy(examples: AtomSelectionExample[], maxDepth?: number): SynthesisWhy;
export declare function synthesizeBinaryRelationWithWhy(examples: BinaryRelationExample[], maxDepth?: number): SynthesisWhy;
export {};