(<- outvars & predicates)
Constructs a query or predicate macro from a list of predicates. Predicate macros support destructuring of the input and output variables.
Constructs a query or predicate macro from a list of predicates. Predicate macros support destructuring of the input and output variables.
(add-ops-fixed-point tail)
Adds operations to tail until can't anymore. Returns new tail and any unapplied operations.
Adds operations to tail until can't anymore. Returns new tail and any unapplied operations.
(aggregation-assertions! buffers aggs options)
(apply-equality-ops tail equality-pairs)
Accepts a TailStruct instance and a sequence of pairs of input variables, and applies an equality filter for every pair.
Accepts a TailStruct instance and a sequence of pairs of input variables, and applies an equality filter for every pair.
(attempt-join tails options)
Attempt to reduce the supplied set of tails by joining.
Attempt to reduce the supplied set of tails by joining.
(build-agg-tail tail aggs grouping-fields options)
(build-query output-fields raw-predicates)
(build-rule {:keys [fields predicates options] :as input})
(chain tail f)
(default-selector op)
Default selector (either input or output) for this operation. Dispatches based on type.
Default selector (either input or output) for this operation. Dispatches based on type.
(desugar-selectors arg-m & sugar-full-pairs)
Accepts a map of cascalog input or output symbol (:< or :>, for example) to var sequence, a <sugary input or output selector> and a <full vector input or output selector> and either destructures the non-sugary input or moves the sugary input into its proper place. For example:
(desugar-selectors {:>> (["?a"])} :> :>>) ;=> {:>> ["?a"]}
(desugar-selectors {:> ["?a"] :<< [["?b"]]} :> :>> :< :<<) ;=> {:>> ["?a"], :<< ["?b"]}
Accepts a map of cascalog input or output symbol (:< or :>, for example) to var sequence, a <sugary input or output selector> and a <full vector input or output selector> and either destructures the non-sugary input or moves the sugary input into its proper place. For example: (desugar-selectors {:>> (["?a"])} :> :>>) ;=> {:>> ["?a"]} (desugar-selectors {:> ["?a"] :<< [["?b"]]} :> :>> :< :<<) ;=> {:>> ["?a"], :<< ["?b"]}
(existence-field node)
Returns true if this location directly descends from an ExistenceNode, false otherwise. Short-circuits at any merge.
Returns true if this location directly descends from an ExistenceNode, false otherwise. Short-circuits at any merge.
(expand-outvars {:keys [op input output] :as pred})
(expand-positional-selector arg-m)
Accepts a map of cascalog selector to var sequence and, if the map contains an entry for Cascalog's positional selector, expands out the proper number of logic vars and replaces each entry specified within the positional map. This function returns the updated map.
Accepts a map of cascalog selector to var sequence and, if the map contains an entry for Cascalog's positional selector, expands out the proper number of logic vars and replaces each entry specified within the positional map. This function returns the updated map.
(find-join-fields l r)
(fixed-point-prune base-necessary-fields ops-invar-fields ops)
Handle pruning chained operation
Handle pruning chained operation
(grouping-input aggs sort-fields)
These are the operations that go into the aggregators.
These are the operations that go into the aggregators.
(grouping-output aggs grouping-fields)
Returns the union of all grouping fields and all outputs for every aggregation field. These are the only fields available after the aggregation.
Returns the union of all grouping fields and all outputs for every aggregation field. These are the only fields available after the aggregation.
(accept? this tail)
Returns true if this op can be applied to the current tail
Returns true if this op can be applied to the current tail
(apply-to-tail this tail)
Accepts a tail and performs some modification on that tail, returning a new tail.
Accepts a tail and performs some modification on that tail, returning a new tail.
(initial-tails generators operations)
Builds up a sequence of tail structs from the supplied generators and operations.
Builds up a sequence of tail structs from the supplied generators and operations.
(num-out-fields _)
(get-out-fields _)
Get the fields of a generator.
Get the fields of a generator.
(select-fields gen fields)
Select fields of a named generator.
Example: (<- [?a ?b ?sum] (+ ?a ?b :> ?sum) ((select-fields generator ["?a" "?b"]) ?a ?b))
Select fields of a named generator. Example: (<- [?a ?b ?sum] (+ ?a ?b :> ?sum) ((select-fields generator ["?a" "?b"]) ?a ?b))
(joinable? tail joinfields)
Returns true if the supplied tail can be joined with the supplied join fields, false otherwise.
A join works if the join fields are all available in the given tail AND the tail's either fully ground, or every non-join variable is unground.
Returns true if the supplied tail can be joined with the supplied join fields, false otherwise. A join works if the join fields are all available in the given tail AND the tail's either fully ground, or every non-join variable is unground.
(maximal-join tail-seq)
Returns the between the two generators with the largest intersection of joinable fields.
Returns the between the two generators with the largest intersection of joinable fields.
(merge-tails tails options)
The first call begins with a bunch of generator tails, each with a list of operations that could be applied. Based on the op-allowed logic, these tails try to consume as many operations as possible before giving up at a fixed point.
The first call begins with a bunch of generator tails, each with a list of operations that could be applied. Based on the op-allowed logic, these tails try to consume as many operations as possible before giving up at a fixed point.
(necessary-ops necessary-fields ops)
Return only operations whose outvars intersect with necessary-fields
Return only operations whose outvars intersect with necessary-fields
(op-allowed? {:keys [ground? available-fields node]} op)
An operation can be applied to a tail if all of the following conditions apply:
It only consumes fields that are available in the supplied TailStruct,
It's a filter (or the branch is NOT a GeneratorSet)
It only consumes ground variables (or the generator itself is ground)
An operation can be applied to a tail if all of the following conditions apply: - It only consumes fields that are available in the supplied TailStruct, - It's a filter (or the branch is NOT a GeneratorSet) - It only consumes ground variables (or the generator itself is ground)
(parse-exec-args [f & rest :as args])
Accept a sequence of (maybe) string and other items and returns a vector of [theString or "", [other items]].
Accept a sequence of (maybe) string and other items and returns a vector of [theString or "", [other items]].
(parse-subquery output-fields raw-predicates)
Parses predicates and output fields and returns a proper subquery.
Parses predicates and output fields and returns a proper subquery.
(parse-variables vars default-selector)
parses variables of the form ['?a' '?b' :> '!!c'] and returns a map of input variables, output variables, If there is no :>, defaults to selector-default.
parses variables of the form ['?a' '?b' :> '!!c'] and returns a map of input variables, output variables, If there is no :>, defaults to selector-default.
(prefer-filter op)
(prepare-operation op tail)
When an operation produces fields that are already present in the tail, this is interpreted as an implicit filter against the existing values. This function accepts an operation and a TailStruct and returns a sequence of all pairs of output variable substitutions, plus a new operation with output fields swapped as necessary
When an operation produces fields that are already present in the tail, this is interpreted as an implicit filter against the existing values. This function accepts an operation and a TailStruct and returns a sequence of all pairs of output variable substitutions, plus a new operation with output fields swapped as necessary
(prepare-subquery output-fields raw-predicates)
(project tail fields)
(projection-input aggs grouping-fields options)
These are the fields that go into a projection.
These are the fields that go into a projection.
(prune-operations fields grouped options)
Remove non-generator & non-filter operations whose outvar(s) is not used, i.e., when the outvar(s) do not intersect with the query's out-fields, generators outvars (for joins), invars of other operations, and :sort option. Additionally, do not prune operations if a no-input operator exists
Remove non-generator & non-filter operations whose outvar(s) is not used, i.e., when the outvar(s) do *not* intersect with the query's out-fields, generators outvars (for joins), invars of other operations, and :sort option. Additionally, do not prune operations if a no-input operator exists
(query-signature? vars)
Accepts the normalized return vector of a Cascalog form and returns true if the return vector is from a subquery, false otherwise. (A predicate macro would trigger false, for example.)
Accepts the normalized return vector of a Cascalog form and returns true if the return vector is from a subquery, false otherwise. (A predicate macro would trigger false, for example.)
(rename tail fields)
(select-join tails)
Returns the join fields that will join the maximum number of fields at a time. If the search fails, select-join throws.
This is unoptimal. It's better to rewrite this as a search problem to find optimal joins.
Returns the join fields that will join the maximum number of fields at a time. If the search fails, select-join throws. This is unoptimal. It's better to rewrite this as a search problem to find optimal joins.
(split-outvar-constants output)
Accepts a sequence of output variables and returns a 2-vector:
[new-outputs, [seq-of-new-raw-predicates]]
By creating a new output predicate for every constant in the output field.
Accepts a sequence of output variables and returns a 2-vector: [new-outputs, [seq-of-new-raw-predicates]] By creating a new output predicate for every constant in the output field.
(tail-fields-intersection & tails)
Returns true if the supplied item is a TailStruct, false otherwise.
Returns true if the supplied item is a TailStruct, false otherwise.
(unground-assertions! gens ops)
Performs various validations on the supplied set of parsed predicates. If all validations pass, returns the sequence unchanged.
Performs various validations on the supplied set of parsed predicates. If all validations pass, returns the sequence unchanged.
(unground-outvars predicates)
For the supplied sequence of RawPredicate instances, returns a seq of all ungrounding vars in the output position.
For the supplied sequence of RawPredicate instances, returns a seq of all ungrounding vars in the output position.
(validate-aggregation! tail aggs options)
Makes sure that all fields are available for the aggregation.
Makes sure that all fields are available for the aggregation.
(validate-generator-set! input output)
GeneratorSets can't be unground, ever.
GeneratorSets can't be unground, ever.
(validate-predicates! preds opts)
(validate-projection! remaining-ops needed available)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close