import type { Variable } from 'rdf-data-factory'; export type FindOperatorType = | 'in' | 'not' | 'and' | 'or' | 'equal' | 'exists' | 'gt' | 'gte' | 'lt' | 'lte' | 'inverse' | 'inverseRelation' | 'inverseRelationOrder' | 'sequencePath' | 'zeroOrMorePath' | 'inversePath' | 'oneOrMorePath' | 'contains' | 'sequence'; export interface FindOperatorArgs { operator: TType; value?: T | FindOperator; subject?: Variable; isOptional?: boolean; } export class FindOperator { public readonly type = 'operator'; public readonly operator: TType; public readonly subject?: Variable; public readonly value?: T | FindOperator; public readonly isOptional?: boolean; public constructor(args: FindOperatorArgs) { this.operator = args.operator; this.value = args.value; this.subject = args.subject; this.isOptional = args.isOptional; } public static isFindOperator(value: any): boolean { return typeof value === 'object' && 'type' in value && value.type === 'operator'; } public static isPathOperator(operator: FindOperator): boolean { return ( operator.operator === 'inversePath' || operator.operator === 'zeroOrMorePath' || operator.operator === 'sequencePath' || operator.operator === 'zeroOrMorePath' ); } }