cascalog.logic.vars documentation

This namespace deals with all Cascalog variable
transformations.

cascalog-var?

(cascalog-var? obj)
A predicate on 'obj' to check is it a cascalog variable.

fully-ground?

Returns true if every supplied var is a ground variable, false
otherwise.

gen-non-nullable-var

Returns a unique non-nullable var with a optional suffix.

gen-non-nullable-vars

(gen-non-nullable-vars amt)
Generates the given number, 'amt', of non-nullable variables in a sequence.

Example:
(let [var-seq (gen-non-nullable-vars n)]
  (?<- (hfs-textline out-path)
       var-seq
       (in :>> var-seq)))

gen-nullable-var

Returns a unique nullable var with a optional suffix.

gen-nullable-vars

(gen-nullable-vars amt)
Generates the given number, 'amt', of nullable variables in a sequence.

Example:
(let [var-seq (gen-nullable-vars n)]
  (?<- (hfs-textline out-path)
       var-seq
       (in :>> var-seq)))

gen-ungrounding-var

Returns a unique ungrounding var with an optional suffix.

gen-var-fn

(gen-var-fn prefix)
Accepts a prefix and returns a function of no arguments that, when
called, produces a unique string with the supplied prefix.

ground-var?

Returns true of the supplied var is capable of triggering a join
(prefixed by ! or ?), false otherwise.

logic-prefixes

Symbol prefixes reserved by Cascalog for use within predicates. Any
symbol or string prefixed by one of these characters will be
interpreted as a logic variable.

logic-sym?

Returns true if the supplied symbol is a Cascalog logic variable,
false otherwise. & and _ are also accepted.

non-nullable-var?

(non-nullable-var? sym-or-str)
Returns true if the supplied symbol (or string) references a
non-nullable logic variable (prefixed by ?), false otherwise.

nullable-var?

Returns true of the supplied symbol (or string) references a
nullable logic variable (prefixed by ! or !!)

prefixed-by?

(prefixed-by? prefix v)
Returns true if the supplied var `v` is prefixed by the supplied
prefix, false otherwise.

replace-dups

(replace-dups coll)
Accepts a sequence returns the set of replacements, plus a new
sequence with all duplicates replaced by a call to `gen`.

reserved?

Returns true if the supplied symbol is reserved by Cascalog, false
otherwise.

sanitize

(sanitize pred)
Accepts a (potentially nested) data structure and returns a
transformed, sanitized predicate generated by replacing all
wildcards and logic variables with strings.

sanitize-fn

(sanitize-fn anon-gen)
Returns a function that sanitizes an element by resolving logic
variable names and replacing wildcards using the supplied
generator.

selector?

Returns true if the supplied keyword is reserved by cascalog, false
otherwise.

selectors

Keywords that have special meaning within Cascalog's predicates.

unground-var?

(unground-var? sym-or-str)
Returns true if the supplied symbol (or string) references an
ungrounding logic variable (prefixed by !!), false otherwise.

uniquify-var

(uniquify-var v)
Appends a unique suffix to the supplied input.

wildcards

Wildcard strings reserved by Cascalog.

with-logic-vars

macro

(with-logic-vars & body)
Binds all logic variables within the body of `with-logic-vars` to
their string equivalents, allowing the user to write bare symbols. For example:

(with-logic-vars
  (str ?a ?b :see))
;=>  "?a?b:see"