<<>> <> <> <> <> <<>> DIRECTORY IO USING [STREAM], Rope USING [ROPE], LoganBerry, LoganQueryClass; LoganQuery: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; Cursor: TYPE = LoganQueryClass.Cursor; ComplexCursor: TYPE = LoganQueryClass.Cursor; -- for backward compatibility CursorDirection: TYPE = LoganBerry.CursorDirection; <> <> NextEntry: PROC [cursor: Cursor, dir: CursorDirection ¬ increasing] RETURNS [entry: LoganBerry.Entry]; <> <> EndGenerate: PROC [cursor: Cursor] RETURNS []; <> <> <> <<>> <: In this case, since a pattern is not explicitly specified, a default pattern is used (currently the default is "DWIM"). The attribute value may be either a token or a rope literal. An explicit pattern type may be given in parenthesis immediately following the attribute type. Thus, an attribute pattern is given in the form (): Several of these may be concatenated together to get a list of attribute patterns. For example, Name: "Douglas B. Terry" Phone(prefix): 494-44 Office(wildcard): 35-2*>> PatternType: TYPE = Rope.ROPE; AttributePattern: TYPE = REF AttributePatternRec; AttributePatternRec: TYPE = RECORD [ attr: LoganBerry.Attribute, ptype: PatternType ¬ NIL ]; AttributePatterns: TYPE = LIST OF AttributePattern; SyntaxError: ERROR [explanation: Rope.ROPE ¬ NIL]; <<>> ReadAttributePatterns: PROC [s: IO.STREAM] RETURNS [ap: AttributePatterns]; <> <<>> WriteAttributePatterns: PROC [s: IO.STREAM, ap: AttributePatterns] RETURNS []; <> <<>> PatternsToEntry: PROC [ap: AttributePatterns] RETURNS [entry: LoganBerry.Entry]; <> <<>> EntryToPatterns: PROC [entry: LoganBerry.Entry] RETURNS [ap: AttributePatterns]; <> <<>> <> QueryPlan: TYPE = LIST OF SubPlan; SubPlan: TYPE = REF SubPlanRec; SubPlanRec: TYPE = RECORD[ attr: LoganBerry.Attribute, -- field type and pattern ptype: PatternType, -- pattern matching used wasDWIM: BOOLEAN ¬ FALSE, -- ptype was DWIM filter: LoganQueryClass.MatchProc ¬ NIL, -- match proc itype: ATOM ¬ $notAnIndex, -- index layout start, end: ROPE ¬ NIL, -- base range cost: REAL ¬ 2.0, -- estimated query cost infoMsg: ROPE ¬ NIL, -- informational message errMsg: ROPE ¬ NIL -- error in pattern if not NIL ]; QueryEntries: PROC [db: LoganBerry.OpenDB, patterns: AttributePatterns, baseIndex: LoganBerry.AttributeType ¬ NIL, defaultPattern: PatternType ¬ "DWIM", planOnly: BOOLEAN ¬ FALSE] RETURNS [cursor: Cursor, plan: QueryPlan]; <> <<>> <> <(): where the pattern specification is optional. >> <> <<>> <> <> <> <> <> <<>> <> <<>> ParseTree: TYPE = ParseNode; ParseNodeTag: TYPE = {and, or, not, ap}; ParseNode: TYPE = REF ParseNodeRec; ParseNodeRec: TYPE = RECORD [ tag: ParseNodeTag, child1: ParseNode ¬ NIL, -- used if tag in $and .. $not child2: ParseNode ¬ NIL, -- used if tag in $and .. $or ap: AttributePattern ¬ NIL -- used if tag = $ap ]; ParseBooleanQuery: PROC [s: IO.STREAM] RETURNS [tree: ParseTree]; <> <<>> BooleanFilterEntries: PROC [input: Cursor, query: ParseTree, inputOrder: LoganBerry.AttributeType, primaryKey: LoganBerry.AttributeType, defaultPattern: PatternType ¬ "DWIM"] RETURNS [output: Cursor]; <> <<>> <> AbortQuery: PROC [cursor: Cursor]; <> <<>> END. <<>> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <<>>