Projection functions
Projection functions
(adorn-entities triples)
Inputs: [triples :- [Axiom]] Returns: [Axiom]
Marks new entities as Naga entities
Inputs: [triples :- [Axiom]] Returns: [Axiom] Marks new entities as Naga entities
(dedupe-by pattern->data data)
Inputs: [pattern->data :- #:s{Num s/Num} data :- Results] Returns: Results
Removes duplicate rows, only considering the columns of the specified data for projection. This means the column keys for which the values are non-negative.
Inputs: [pattern->data :- #:s{Num s/Num} data :- Results] Returns: Results Removes duplicate rows, only considering the columns of the specified data for projection. This means the column keys for which the values are non-negative.
(group-exists? resolve-pattern-fn group)
Inputs: [resolve-pattern-fn group :- [Axiom]] Returns: [s/Any]
Determines if a group is instantiating a new piece of data, and if so checks if it already exists.
Inputs: [resolve-pattern-fn group :- [Axiom]] Returns: [s/Any] Determines if a group is instantiating a new piece of data, and if so checks if it already exists.
(insert-project store-fns patterns columns data)
(insert-project {:keys [resolve-pattern new-node node-label] :as store-fns}
patterns
vars-to-update
columns
data)
(insert-project G__18185 G__18186 G__18187 G__18188)
(insert-project G__18192 G__18193 G__18194 G__18195 G__18196)
Inputs: ([store-fns patterns :- [[s/Any]] columns :- [Symbol] data :- Results] [{:keys [resolve-pattern new-node node-label], :as store-fns} patterns :- [[s/Any]] vars-to-update :- #{Var} columns :- [Symbol] data :- Results]) Returns: Results
Similar to project, only the generated data will be in triples for insertion. If triples describe entities with existing dc/ident fields, then they will be dropped.
Inputs: ([store-fns patterns :- [[s/Any]] columns :- [Symbol] data :- Results] [{:keys [resolve-pattern new-node node-label], :as store-fns} patterns :- [[s/Any]] vars-to-update :- #{Var} columns :- [Symbol] data :- Results]) Returns: Results Similar to project, only the generated data will be in triples for insertion. If triples describe entities with existing dc/ident fields, then they will be dropped.
(matching-vars from to)
Inputs: [from :- [s/Any] to :- [Symbol]] Returns: #:s{Num s/Num}
Returns pairs of indexes into seqs where the vars match. For any variable that appears in both sequences, the column number in the 'from' parameter gets mapped to the column number of the same variable in the 'to' parameter.
Inputs: [from :- [s/Any] to :- [Symbol]] Returns: #:s{Num s/Num} Returns pairs of indexes into seqs where the vars match. For any variable that appears in both sequences, the column number in the 'from' parameter gets mapped to the column number of the same variable in the 'to' parameter.
(new-nodes offset-map)
Inputs: [offset-map :- #:s{Num s/Num}] Returns: [s/Num]
Returns all the new node references that appears in a map of offsets. Node references are negative numbers.
Inputs: [offset-map :- #:s{Num s/Num}] Returns: [s/Num] Returns all the new node references that appears in a map of offsets. Node references are negative numbers.
(offset-mappings full-pattern data-vars data)
Inputs: [full-pattern :- [s/Any] data-vars :- [Symbol] data :- Results] Returns: #:s{Num s/Num}
Build a pattern->data mapping that returns offsets into a pattern mapped to corresponding offsets into data. If a data offset is negative, then this indicates a node must be built instead of reading from the data.
Inputs: [full-pattern :- [s/Any] data-vars :- [Symbol] data :- Results] Returns: #:s{Num s/Num} Build a pattern->data mapping that returns offsets into a pattern mapped to corresponding offsets into data. If a data offset is negative, then this indicates a node must be built instead of reading from the data.
(project {:keys [new-node node-label] :as store-fns} [v :as pattern] data)
Inputs: [{:keys [new-node node-label], :as store-fns} [v :as pattern] :- [s/Any] data :- Results] Returns: s/Any
Converts data from results, into just the requested columns, as per the patterns arg.
Depending on the format of the pattern
argument, different projections may occur.
Inputs: [{:keys [new-node node-label], :as store-fns} [v :as pattern] :- [s/Any] data :- Results] Returns: s/Any Converts data from results, into just the requested columns, as per the patterns arg. Depending on the format of the `pattern` argument, different projections may occur. - If the pattern is a sequence of vars, then the associated column in each row of data will be copied into position in each row of results. - If the pattern is a var followed by a dot, then only the first row of data is processed and a single value matching the var will be returned. - If the pattern is a vector containing a var and 3 dots, then only a single value is selected from each row of data and a sequence of those values is returned. - If the pattern is a vector of multiple vars, then only the first row of data is processed and a single vector containing all of the requested results is returned.
(project-collection v columns data)
Inputs: [v :- Var columns :- [Var] data :- Results] Returns: [s/Any]
Returns a single value from every row of results, selected by the variable.
Inputs: [v :- Var columns :- [Var] data :- Results] Returns: [s/Any] Returns a single value from every row of results, selected by the variable.
(project-results {:keys [new-node node-label] :as store-fns}
pattern
columns
data)
Inputs: [{:keys [new-node node-label], :as store-fns} pattern :- [s/Any] columns :- [Var] data :- Results] Returns: Results
Converts each row from a result, into just the requested columns, as per the patterns arg. Any specified value in the patterns will be copied into that position in the projection. Unbound patterns will generate new nodes for each row. e.g. For pattern [?h1 :friend ?h2] data: [[h1=frodo h3=bilbo h2=gandalf] [h1=merry h3=pippin h2=frodo]] leads to: [[h1=frodo :friend h2=gandalf] [h1=merry :friend h2=frodo]]
Inputs: [{:keys [new-node node-label], :as store-fns} pattern :- [s/Any] columns :- [Var] data :- Results] Returns: Results Converts each row from a result, into just the requested columns, as per the patterns arg. Any specified value in the patterns will be copied into that position in the projection. Unbound patterns will generate new nodes for each row. e.g. For pattern [?h1 :friend ?h2] data: [[h1=frodo h3=bilbo h2=gandalf] [h1=merry h3=pippin h2=frodo]] leads to: [[h1=frodo :friend h2=gandalf] [h1=merry :friend h2=frodo]]
(project-row {:keys [new-node node-label] :as store-fns}
wide-pattern
nodes
mapping
row)
Inputs: [{:keys [new-node node-label], :as store-fns} wide-pattern :- [s/Any] nodes :- (s/maybe [s/Num]) mapping :- #:s{Num s/Num} row :- [Value]] Returns: [s/Any]
Creates a new EPVPattern from an existing one, based on existing bindings. Uses the mapping to copy from columns in 'row' to overwrite variables in 'pattern'. 'pattern' must be a vector. The index mappings have already been found and are in the 'mapping' argument
Inputs: [{:keys [new-node node-label], :as store-fns} wide-pattern :- [s/Any] nodes :- (s/maybe [s/Num]) mapping :- #:s{Num s/Num} row :- [Value]] Returns: [s/Any] Creates a new EPVPattern from an existing one, based on existing bindings. Uses the mapping to copy from columns in 'row' to overwrite variables in 'pattern'. 'pattern' must be a vector. The index mappings have already been found and are in the 'mapping' argument
(project-single v columns data)
Inputs: [v :- Var columns :- [Var] data :- Results] Returns: s/Any
Returns a single value out of the first row of results, selected by the variable. Throws an exception if the variable does not exist.
Inputs: [v :- Var columns :- [Var] data :- Results] Returns: s/Any Returns a single value out of the first row of results, selected by the variable. Throws an exception if the variable does not exist.
(project-tuple tuple columns data)
Inputs: [tuple :- [Var] columns :- [Var] data :- Results] Returns: [s/Any]
Returns a tuple of values out of the first row of results, selected by the variables. Throws an exception if any of the variables do not exist.
Inputs: [tuple :- [Var] columns :- [Var] data :- Results] Returns: [s/Any] Returns a tuple of values out of the first row of results, selected by the variables. Throws an exception if any of the variables do not exist.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close