Liking cljdoc? Tell your friends :D

asami.query

Implements query operations based on data accessible through the Graph protocol.

Implements query operations based on data accessible through the Graph protocol.
raw docstring

*env*clj/s

source

*override-restrictions*clj/s

source

*plan-options*clj/s

source

*select-distinct*clj/s

source

agg-labelclj/s

(agg-label [op v])

Inputs: [[op v]] Returns: s/Symbol

Converts an aggregate operation on a symbol into a symbol name

Inputs: [[op v]]
Returns: s/Symbol

Converts an aggregate operation on a symbol into a symbol name
sourceraw docstring

aggregate-fnsclj/s

Map of aggregate symbols to functions that accept a seq of data to be aggregated

Map of aggregate symbols to functions that accept a seq of data to be aggregated
sourceraw docstring

aggregate-overclj/s

(aggregate-over selection with partial-results)

Inputs: [selection :- [s/Any] with :- [Var] partial-results :- [Results]] Returns: s/Any

For each seq of results, aggregates individually, and then together

Inputs: [selection :- [s/Any] with :- [Var] partial-results :- [Results]]
Returns: s/Any

For each seq of results, aggregates individually, and then together
sourceraw docstring

aggregate-queryclj/s

(aggregate-query find
                 bindings
                 with
                 where
                 graph
                 project-fn
                 {:keys [query-plan] :as options})
source

AuditableResultsclj/s

source

binding-joinclj/s

(binding-join graph part [[op & args :as expr] bnd-var])

Inputs: [graph part :- Results [[op & args :as expr] bnd-var] :- EvalPattern]

Uses row bindings as arguments for an expression that uses the names in that binding. Binds a new var to the result of the expression and adds it to the complete results.

Inputs: [graph part :- Results [[op & args :as expr] bnd-var] :- EvalPattern]

Uses row bindings as arguments for an expression that uses the names in that binding.
 Binds a new var to the result of the expression and adds it to the complete results.
sourceraw docstring

conforms?clj/s

(conforms? t d)
source

conjunctionclj/s

(conjunction graph part [_ & patterns])

Inputs: [graph part :- Results [_ & patterns]]

Iterates over the arguments to perform a left-join on each

Inputs: [graph part :- Results [_ & patterns]]

Iterates over the arguments to perform a left-join on each
sourceraw docstring

context-execute-queryclj/s

(context-execute-query graph grouping-vars context [op & args :as where])

Inputs: [graph grouping-vars :- #{Var} context :- Results [op & args :as where] :- Pattern]

For each line in a context, execute a query specified by the where clause

Inputs: [graph grouping-vars :- #{Var} context :- Results [op & args :as where] :- Pattern]

For each line in a context, execute a query specified by the where clause
sourceraw docstring

create-bindingclj/s

(create-binding nm values)

Inputs: [nm :- InSpec values] Returns: Bindings

Creates a bindings between a name and a set of values. If the name is singular, then that name is bound to the singular element found in values. If the name is a seq, then each name in the seq is bound to the corresponding offset in each value.

Inputs: [nm :- InSpec values]
Returns: Bindings

Creates a bindings between a name and a set of values.
 If the name is singular, then that name is bound to the singular element found in values.
 If the name is a seq, then each name in the seq is bound to the corresponding offset in each value.
sourceraw docstring

create-bindingsclj/s

(create-bindings in values)

Inputs: [in :- [InSpec] values] Returns: [(s/one (s/maybe Bindings) "The bindings for other params") (s/one (s/maybe s/Any) "The default graph")]

Converts user provided data for a query into bindings

Inputs: [in :- [InSpec] values]
Returns: [(s/one (s/maybe Bindings) "The bindings for other params") (s/one (s/maybe s/Any) "The default graph")]

Converts user provided data for a query into bindings
sourceraw docstring

disjunctionclj/s

(disjunction graph part [_ & patterns])

Inputs: [graph part :- Results [_ & patterns]]

Implements an OR operation by repeating a join across each arm of the operation, and concatenating the results

Inputs: [graph part :- Results [_ & patterns]]

Implements an OR operation by repeating a join across each arm of the operation,
 and concatenating the results
sourceraw docstring

distinct-fnclj/s

(distinct-fn op)

Returns a function that may deduplicate results, depending on the type of operator

Returns a function that may deduplicate results, depending on the type of operator
sourceraw docstring

empty-bindingsclj/s

source

execute-queryclj/s

(execute-query selection
               constraints
               bindings
               graph
               project-fn
               {:keys [query-plan] :as options})

Inputs: [selection constraints bindings graph project-fn {:keys [query-plan], :as options}]

Inputs: [selection constraints bindings graph project-fn {:keys [query-plan], :as options}]
sourceraw docstring

expand-shortened-pattern-constraintsclj/s

(expand-shortened-pattern-constraints {:keys [where] :as query})

Inputs: [{:keys [where], :as query}]

In the :where sequence of query expand EPV patterns of the form [E] and [E P] to [E ?P ?V] and [E ?P ?V] respectively where ?P and ?V are fresh variables.

Inputs: [{:keys [where], :as query}]

In the :where sequence of query expand EPV patterns of the form [E]
and [E P] to [E ?P ?V] and [E ?P ?V] respectively where ?P and ?V
are fresh variables.
sourceraw docstring

extended-query-keysclj/s

source

Fcnclj/s

source

filter-joinclj/s

(filter-join graph part [[op & args :as fltr]])

Inputs: [graph part :- Results [[op & args :as fltr]] :- FilterPattern]

Uses row bindings in a partial result as arguments to a function whose parameters are defined by those names. Those rows whose bindings return true/truthy are kept and the remainder are removed.

Inputs: [graph part :- Results [[op & args :as fltr]] :- FilterPattern]

Uses row bindings in a partial result as arguments to a function whose parameters are defined by those names.
 Those rows whose bindings return true/truthy are kept and the remainder are removed.
sourceraw docstring

find-varsclj/s

(find-vars f)
source

gate-fnclj/s

(gate-fn graph constraints)

Inputs: [graph constraints :- [Pattern]]

Returns a function that allows data through it or not, based on the results of a series of NOT operations. If any operation returns results, then nothing may get through.

Inputs: [graph constraints :- [Pattern]]

Returns a function that allows data through it or not,
 based on the results of a series of NOT operations.
 If any operation returns results, then nothing may get through.
sourceraw docstring

identity-bindingclj/s

source

InSpecclj/s

source

join-patternsclj/s

(join-patterns graph patterns bindings {:keys [query-plan] :as options})

Inputs: [graph patterns :- [Pattern] bindings :- (s/maybe Bindings) {:keys [query-plan], :as options}] Returns: AuditableResults

Joins the resolutions for a series of patterns into a single result. If options contains :path-plan then returns the plan and does not execute

Inputs: [graph patterns :- [Pattern] bindings :- (s/maybe Bindings) {:keys [query-plan], :as options}]
Returns: AuditableResults

Joins the resolutions for a series of patterns into a single result.
 If options contains :path-plan then returns the plan and does not execute
sourceraw docstring

left-joinclj/s

(left-join pattern results graph)

Joins a partial result (on the left) to a pattern (on the right). The pattern type will determine dispatch.

Joins a partial result (on the left) to a pattern (on the right).
The pattern type will determine dispatch.
sourceraw docstring

minusclj/s

(minus graph part [_ & [fpattern :as patterns]])

Inputs: [graph part :- Results [_ & [fpattern :as patterns]]]

Removes matches. For each line in the current results, performs a subquery with NOT clause. When the NOT clause returns data then that line in the results should be removed.

Inputs: [graph part :- Results [_ & [fpattern :as patterns]]]

Removes matches.
 For each line in the current results, performs a subquery with NOT clause.
 When the NOT clause returns data then that line in the results should be removed.
sourceraw docstring

missingclj/s

(missing var-index arg)

Inputs: [var-index :- VarIndex arg :- s/Any] Returns: (s/maybe Var)

Returns a value when it is a var that does not appear in the var index var-index.

Inputs: [var-index :- VarIndex arg :- s/Any]
Returns: (s/maybe Var)

Returns a value when it is a var that does not appear in the var
index var-index.
sourceraw docstring

modify-patternclj/s

(modify-pattern existing mapping pattern)

Inputs: [existing :- [Value] mapping :- #:s{Num s/Num} pattern :- EPVPattern] Returns: [s/Any]

Creates a new EPVPattern from an existing one, based on existing bindings. Uses the mapping to copy from columns in 'existing' to overwrite variables in 'pattern'. The variable locations have already been found and are in the 'mapping' argument

Inputs: [existing :- [Value] mapping :- #:s{Num s/Num} pattern :- EPVPattern]
Returns: [s/Any]

Creates a new EPVPattern from an existing one, based on existing bindings.
 Uses the mapping to copy from columns in 'existing' to overwrite variables in 'pattern'.
 The variable locations have already been found and are in the 'mapping' argument
sourceraw docstring

newlclj/s≠

clj
(newl s & remaining)
cljs
(newl G__19450 & rest19451)

Inputs: [s :- (s/maybe s/Str) & remaining] Returns: s/Str

Inputs: [s :- (s/maybe s/Str) & remaining]
Returns: s/Str
sourceraw docstring

null-valueclj/s

source

op-errorclj/s

(op-error pattern)
source

operand-varsclj/s

(operand-vars o)
source

operatorsclj/s

source

optionalclj/s

(optional graph part [_ & patterns :as operation])

Inputs: [graph part :- Results [_ & patterns :as operation]]

Performs a left-outer-join, similarly to a conjunction

Inputs: [graph part :- Results [_ & patterns :as operation]]

Performs a left-outer-join, similarly to a conjunction
sourceraw docstring

outer-productclj/s

(outer-product leftb rightb)

Inputs: [leftb :- Bindings rightb :- Bindings] Returns: Bindings

Creates an outer product between 2 sets of bindings

Inputs: [leftb :- Bindings rightb :- Bindings]
Returns: Bindings

Creates an outer product between 2 sets of bindings
sourceraw docstring

parseclj/s

(parse x)

Inputs: [x]

Inputs: [x]
sourceraw docstring

pattern-errorclj/s

(pattern-error pattern)
source

pattern-left-joinclj/s

(pattern-left-join graph part pattern)

Inputs: [graph part :- Results pattern :- EPVPattern] Returns: Results

Takes a partial result, and does an inner join against the resolution of a pattern. Iterates over the partial result, using the bindings to update the pattern to search the index. Each row in the partial result is then repeated to match the rows returned from the index lookup. If no variables match, then the result will be an outer product of the partial result, and the rows returned from an index lookup of the unmodified pattern. The final result has metadata with the columns from the partial result, and all new vars from the pattern.

Inputs: [graph part :- Results pattern :- EPVPattern]
Returns: Results

Takes a partial result, and does an inner join against the resolution of a pattern.
 Iterates over the partial result, using the bindings to update the pattern to search the index.
 Each row in the partial result is then repeated to match the rows returned from the index lookup.
 If no variables match, then the result will be an outer product of the partial result, and
 the rows returned from an index lookup of the unmodified pattern.
 The final result has metadata with the columns from the partial result,
 and all new vars from the pattern.
sourceraw docstring

plain-varclj/s

(plain-var v)
source

plain-varsclj/s

(plain-vars v)
source

Planclj/s

source

prebound-left-joinclj/s

(prebound-left-join part bindings)

Inputs: [part :- Results bindings :- Results] Returns: Results

Takes a bindings (Results) and joins on the current results. This is similar to the pattern-left-join but instead of taking a pattern to be applied to an indexed graph, it takes unindexed data that is already bound. The join is done by indexing the bindings and using the same algorithm that joins rows in pattern-left-join

Inputs: [part :- Results bindings :- Results]
Returns: Results

Takes a bindings (Results) and joins on the current results. This is similar to the
 pattern-left-join but instead of taking a pattern to be applied to an indexed graph,
 it takes unindexed data that is already bound. The join is done by indexing the bindings
 and using the same algorithm that joins rows in pattern-left-join
sourceraw docstring

prependclj/s

(prepend element pattern)

Inputs: [element pattern :- Pattern]

Inputs: [element pattern :- Pattern]
sourceraw docstring

query-entryclj/s

(query-entry query empty-graph inputs plan?)

Inputs: [query empty-graph inputs plan?]

Main entry point of user queries

Inputs: [query empty-graph inputs plan?]

Main entry point of user queries
sourceraw docstring

query-keysclj/s

source

query-mapclj/s

(query-map query)

Inputs: [query]

Parses a query into it's main components. Queries can be a sequence, a map, or an EDN string. These are based on Datomic-style queries. The return map contains: :find - The elements to be projected from a query. :all - true if duplicates are to be returned, false otherwise. Defaults to false. :in - A list of data sources. Optional. :with - list of variables for grouping. :where - A sequence of constraints for the query.

Inputs: [query]

Parses a query into it's main components.
 Queries can be a sequence, a map, or an EDN string. These are based on Datomic-style queries.
 The return map contains:
 :find - The elements to be projected from a query.
 :all - true if duplicates are to be returned, false otherwise. Defaults to false.
 :in - A list of data sources. Optional.
 :with - list of variables for grouping.
 :where - A sequence of constraints for the query.
sourceraw docstring

query-validatorclj/s

(query-validator {:keys [find in where] :as query})

Inputs: [{:keys [find in where], :as query} :- #:s{Keyword (s/cond-pre s/Bool [s/Any])}]

Inputs: [{:keys [find in where], :as query} :- #:s{Keyword (s/cond-pre s/Bool [s/Any])}]
sourceraw docstring

resolve-opclj/s

(resolve-op s)

Inputs: [s :- s/Symbol] Returns: (s/maybe Fcn)

Resolves a symbol to an associated function. Symbols without a namespace are presumed to be in clojure.core

Inputs: [s :- s/Symbol]
Returns: (s/maybe Fcn)

Resolves a symbol to an associated function. Symbols without a namespace are presumed to be in clojure.core
sourceraw docstring

result-labelclj/s

(result-label e)

Inputs: [e] Returns: s/Symbol

Convert an element from a select/find clause into an appropriate label. Note that duplicate columns are not considered

Inputs: [e]
Returns: s/Symbol

Convert an element from a select/find clause into an appropriate label.
 Note that duplicate columns are not considered
sourceraw docstring

retrieve-opclj/s

(retrieve-op op var-index part)

Inputs: [op var-index :- VarIndex part] Returns: Fcn

Retrieves a function for a provided operation. An op can be a variable, a function, a symbol for a function, or a string.

Inputs: [op var-index :- VarIndex part]
Returns: Fcn

Retrieves a function for a provided operation. An op can be a
variable, a function, a symbol for a function, or a string.
sourceraw docstring

rewrite-wildcardsclj/s

(rewrite-wildcards {:keys [where] :as query})

Inputs: [{:keys [where], :as query}]

In the :where sequence of query replace all occurrences of _ with unique variables.

Inputs: [{:keys [where], :as query}]

In the :where sequence of query replace all occurrences of _ with
unique variables.
sourceraw docstring

run-simple-queryclj/s

(run-simple-query graph [fpattern & patterns :as all-patterns])

Inputs: [graph [fpattern & patterns :as all-patterns] :- [PatternOrBindings]]

Inputs: [graph [fpattern & patterns :as all-patterns] :- [PatternOrBindings]]
sourceraw docstring

select-plannerclj/s

(select-planner {:keys [planner] :as options})

Inputs: [{:keys [planner], :as options}]

Selects a query planner function, based on user-selected options

Inputs: [{:keys [planner], :as options}]

Selects a query planner function, based on user-selected options
sourceraw docstring

seq-group-byclj/s

(seq-group-by group-select xs)

Does a group-by style of operation, but it streams over the input and provides a sequence of groups. The input data must already be in a groupable order, meaning that once a grouping variable has stopped appearing, the group is finished. group-select is a function for selecting the data to group by.

Does a group-by style of operation, but it streams over the input and provides a sequence of groups.
The input data must already be in a groupable order, meaning that once a grouping variable has stopped
appearing, the group is finished. group-select is a function for selecting the data to group by.
sourceraw docstring

split-with*clj/s

(split-with* pred coll)

Same as clojure.core/split-with but only executes the predicate once on each matching element. Returns the same as [(vec (take-while pred coll)) (drop-while pred coll)]

Same as clojure.core/split-with but only executes the predicate once on each matching element.
Returns the same as [(vec (take-while pred coll)) (drop-while pred coll)]
sourceraw docstring

symb?clj/s

(symb? s)

Inputs: [s]

Similar to symbol? but excludes the special ... form

Inputs: [s]

Similar to symbol? but excludes the special ... form
sourceraw docstring

VarIndexclj/s

source

varsclj/s

(vars s)
source

vconjclj/s

(vconj c v)

Used to update a value to be a vector with the new element conj'ed. If the value starts as nil, then create a new vector to hold the element.

Used to update a value to be a vector with the new element conj'ed.
If the value starts as nil, then create a new vector to hold the element.
sourceraw docstring

withoutclj/s

(without e s)

Inputs: [e :- s/Any s :- [s/Any]] Returns: [s/Any]

Returns a sequence minus a specific element

Inputs: [e :- s/Any s :- [s/Any]]
Returns: [s/Any]

Returns a sequence minus a specific element
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close