Module: Cyrel
- Defined in:
- lib/cyrel.rb,
lib/cyrel/node.rb,
lib/cyrel/plus.rb,
lib/cyrel/query.rb,
lib/cyrel/clause.rb,
lib/cyrel/logging.rb,
lib/cyrel/pattern.rb,
lib/cyrel/ast/node.rb,
lib/cyrel/direction.rb,
lib/cyrel/functions.rb,
lib/cyrel/clause/set.rb,
lib/cyrel/expression.rb,
lib/cyrel/clause/call.rb,
lib/cyrel/clause/skip.rb,
lib/cyrel/clause/with.rb,
lib/cyrel/return_only.rb,
lib/cyrel/ast/compiler.rb,
lib/cyrel/ast/set_node.rb,
lib/cyrel/clause/limit.rb,
lib/cyrel/clause/match.rb,
lib/cyrel/clause/merge.rb,
lib/cyrel/clause/where.rb,
lib/cyrel/pattern/node.rb,
lib/cyrel/pattern/path.rb,
lib/cyrel/ast/call_node.rb,
lib/cyrel/ast/skip_node.rb,
lib/cyrel/ast/with_node.rb,
lib/cyrel/clause/create.rb,
lib/cyrel/clause/delete.rb,
lib/cyrel/clause/remove.rb,
lib/cyrel/clause/return.rb,
lib/cyrel/clause/unwind.rb,
lib/cyrel/ast/limit_node.rb,
lib/cyrel/ast/match_node.rb,
lib/cyrel/ast/merge_node.rb,
lib/cyrel/ast/union_node.rb,
lib/cyrel/ast/where_node.rb,
lib/cyrel/call_procedure.rb,
lib/cyrel/ast/clause_node.rb,
lib/cyrel/ast/create_node.rb,
lib/cyrel/ast/delete_node.rb,
lib/cyrel/ast/remove_node.rb,
lib/cyrel/ast/return_node.rb,
lib/cyrel/ast/unwind_node.rb,
lib/cyrel/clause/order_by.rb,
lib/cyrel/expression/base.rb,
lib/cyrel/expression/case.rb,
lib/cyrel/parameterizable.rb,
lib/cyrel/types/hash_type.rb,
lib/cyrel/ast/foreach_node.rb,
lib/cyrel/ast/literal_node.rb,
lib/cyrel/ast/pattern_node.rb,
lib/cyrel/expression/alias.rb,
lib/cyrel/ast/load_csv_node.rb,
lib/cyrel/ast/order_by_node.rb,
lib/cyrel/expression/exists.rb,
lib/cyrel/types/symbol_type.rb,
lib/cyrel/ast/clause_adapter.rb,
lib/cyrel/expression/literal.rb,
lib/cyrel/expression/logical.rb,
lib/cyrel/ast/expression_node.rb,
lib/cyrel/ast/optimized_nodes.rb,
lib/cyrel/expression/operator.rb,
lib/cyrel/clause/call_subquery.rb,
lib/cyrel/pattern/relationship.rb,
lib/cyrel/expression/comparison.rb,
lib/cyrel/expression/function_call.rb,
lib/cyrel/expression/property_access.rb,
lib/cyrel/ast/query_integrated_compiler.rb,
lib/cyrel/expression/pattern_comprehension.rb
Defined Under Namespace
Modules: AST, Clause, Direction, Expression, Functions, Logging, Parameterizable, Pattern, Types Classes: AliasConflictError, CallProcedure, Node, PathBuilder, Plus, Query, ReturnOnly
Class Method Summary collapse
-
.avg ⇒ Object
Cyrel DSL helper: Cypher avg() aggregation.
-
.call(procedure) ⇒ Object
Cyrel DSL helper: creates a CALL clause for a procedure.
-
.coalesce ⇒ Object
Cyrel DSL helper: Cypher coalesce() function.
-
.collect ⇒ Object
Cyrel DSL helper: Cypher collect() aggregation.
-
.count ⇒ Object
Cyrel DSL helper: Cypher count() aggregation.
-
.create(pattern) ⇒ Object
Cyrel DSL helper: starts a CREATE query.
-
.element_id ⇒ Object
Cyrel DSL helper: returns the element id of a node/relationship (alias).
-
.exists(pattern) ⇒ Object
Cyrel DSL helper: creates an Exists expression.
-
.function(name, *args) ⇒ Object
Cyrel DSL helper: creates a function call expression.
-
.id ⇒ Object
Cyrel DSL helper: returns the element id of a node/relationship.
-
.labels ⇒ Object
Cyrel DSL helper: Cypher labels() function.
-
.match(pattern, path_variable: nil) ⇒ Object
Cyrel DSL helper: starts a MATCH query.
-
.max ⇒ Object
Cyrel DSL helper: Cypher max() aggregation.
-
.min ⇒ Object
Cyrel DSL helper: Cypher min() aggregation.
-
.n(alias_name = nil, *labels, **properties) ⇒ Object
Cyrel DSL helper: alias for node creation.
-
.node(alias_name = nil, *labels, **properties) ⇒ Object
Cyrel DSL helper: creates a node pattern.
-
.node_id ⇒ Object
Cyrel DSL helper: adapter-aware node ID function Example: Cyrel.node_id(:n).
-
.not(expression) ⇒ Object
Cyrel DSL helper: creates a Logical NOT expression.
-
.path ⇒ Object
Cyrel DSL helper: creates a path pattern with a DSL block.
-
.plus(variable) ⇒ Object
Cyrel DSL helper: property merging (SET n += props).
-
.prop(variable, property_name) ⇒ Object
Cyrel DSL helper: creates a PropertyAccess expression.
-
.properties ⇒ Object
Cyrel DSL helper: Cypher properties() function.
-
.query ⇒ Object
Cyrel DSL helper: creates a new query.
-
.rel(alias_name = nil, *types, **properties) ⇒ Object
Cyrel DSL helper: creates a relationship pattern.
-
.return(**return_values) ⇒ Object
Cyrel DSL helper: creates a RETURN clause.
-
.size ⇒ Object
Cyrel DSL helper: Cypher size() function.
-
.sum ⇒ Object
Cyrel DSL helper: Cypher sum() aggregation.
-
.timestamp ⇒ Object
Cyrel DSL helper: Cypher timestamp() function.
-
.to_boolean ⇒ Object
Cyrel DSL helper: Cypher toBoolean() function.
-
.to_float ⇒ Object
Cyrel DSL helper: Cypher toFloat() function.
-
.to_integer ⇒ Object
Cyrel DSL helper: Cypher toInteger() function.
-
.to_string ⇒ Object
Cyrel DSL helper: Cypher toString() function.
-
.type ⇒ Object
Cyrel DSL helper: Cypher type() function.
Class Method Details
.avg ⇒ Object
Cyrel DSL helper: Cypher avg() aggregation. Example: Cyrel.avg(:n)
223 |
# File 'lib/cyrel.rb', line 223 def avg(...) = Functions.avg(...) |
.call(procedure) ⇒ Object
Cyrel DSL helper: creates a CALL clause for a procedure. Example: Cyrel.call(‘db.labels’)
20 21 22 |
# File 'lib/cyrel.rb', line 20 def call(procedure) CallProcedure.new(procedure) end |
.coalesce ⇒ Object
Cyrel DSL helper: Cypher coalesce() function. Example: Cyrel.coalesce(:a, :b)
195 |
# File 'lib/cyrel.rb', line 195 def coalesce(...) = Functions.coalesce(...) |
.collect ⇒ Object
Cyrel DSL helper: Cypher collect() aggregation. Example: Cyrel.collect(:n)
235 |
# File 'lib/cyrel.rb', line 235 def collect(...) = Functions.collect(...) |
.count ⇒ Object
Cyrel DSL helper: Cypher count() aggregation. Example: Cyrel.count(:n)
179 |
# File 'lib/cyrel.rb', line 179 def count(...) = Functions.count(...) |
.create(pattern) ⇒ Object
Cyrel DSL helper: starts a CREATE query. Example: Cyrel.create(pattern)
150 151 152 |
# File 'lib/cyrel.rb', line 150 def create(pattern) Query.new.create(pattern) end |
.element_id ⇒ Object
Cyrel DSL helper: returns the element id of a node/relationship (alias).
165 |
# File 'lib/cyrel.rb', line 165 def element_id(...) = Functions.element_id(...) |
.exists(pattern) ⇒ Object
Cyrel DSL helper: creates an Exists expression. Example: Cyrel.exists(pattern)
249 250 251 |
# File 'lib/cyrel.rb', line 249 def exists(pattern) Expression.exists(pattern) end |
.function(name, *args) ⇒ Object
Cyrel DSL helper: creates a function call expression. Example: Cyrel.function(:count, :*)
173 174 175 |
# File 'lib/cyrel.rb', line 173 def function(name, *args) Expression::FunctionCall.new(name, args) end |
.id ⇒ Object
Cyrel DSL helper: returns the element id of a node/relationship. Example: Cyrel.id(:n)
162 |
# File 'lib/cyrel.rb', line 162 def id(...) = Functions.id(...) |
.labels ⇒ Object
Cyrel DSL helper: Cypher labels() function. Example: Cyrel.labels(:n)
183 |
# File 'lib/cyrel.rb', line 183 def labels(...) = Functions.labels(...) |
.match(pattern, path_variable: nil) ⇒ Object
Cyrel DSL helper: starts a MATCH query. Example: Cyrel.match(pattern)
156 157 158 |
# File 'lib/cyrel.rb', line 156 def match(pattern, path_variable: nil) Query.new.match(pattern, path_variable: path_variable) end |
.max ⇒ Object
Cyrel DSL helper: Cypher max() aggregation. Example: Cyrel.max(:n)
231 |
# File 'lib/cyrel.rb', line 231 def max(...) = Functions.max(...) |
.min ⇒ Object
Cyrel DSL helper: Cypher min() aggregation. Example: Cyrel.min(:n)
227 |
# File 'lib/cyrel.rb', line 227 def min(...) = Functions.min(...) |
.n(alias_name = nil, *labels, **properties) ⇒ Object
Cyrel DSL helper: alias for node creation. Example: Cyrel.n(:person, :Person, name: ‘Alice’)
14 15 16 |
# File 'lib/cyrel.rb', line 14 def n(alias_name = nil, *labels, **properties) Pattern::Node.new(alias_name, labels: labels, properties: properties) end |
.node(alias_name = nil, *labels, **properties) ⇒ Object
Cyrel DSL helper: creates a node pattern. Example: Cyrel.node(:n, :Person, name: ‘Alice’)
32 33 34 |
# File 'lib/cyrel.rb', line 32 def node(alias_name = nil, *labels, **properties) Pattern::Node.new(alias_name, labels: labels, properties: properties) end |
.node_id ⇒ Object
Cyrel DSL helper: adapter-aware node ID function Example: Cyrel.node_id(:n)
169 |
# File 'lib/cyrel.rb', line 169 def node_id(...) = Functions.node_id(...) |
.not(expression) ⇒ Object
Cyrel DSL helper: creates a Logical NOT expression. Example: Cyrel.not(expression)
255 256 257 |
# File 'lib/cyrel.rb', line 255 def not(expression) Expression.not(expression) end |
.path ⇒ Object
Cyrel DSL helper: creates a path pattern with a DSL block. Example: Cyrel.path { node(:a) > rel(:r) > node(:b) }
45 46 47 48 49 |
# File 'lib/cyrel.rb', line 45 def path(&) builder = PathBuilder.new builder.instance_eval(&) Pattern::Path.new(builder.elements) end |
.plus(variable) ⇒ Object
Cyrel DSL helper: property merging (SET n = {props}). Use for updating only specified properties on a node or relationship. Example: Cyrel.plus(:n) => { name: “Alice” } generates SET n = $p1
262 263 264 |
# File 'lib/cyrel.rb', line 262 def plus(variable) Plus.new(variable) end |
.prop(variable, property_name) ⇒ Object
Cyrel DSL helper: creates a PropertyAccess expression. Example: Cyrel.prop(:n, :name)
243 244 245 |
# File 'lib/cyrel.rb', line 243 def prop(variable, property_name) Expression.prop(variable, property_name) end |
.properties ⇒ Object
Cyrel DSL helper: Cypher properties() function. Example: Cyrel.properties(:n)
191 |
# File 'lib/cyrel.rb', line 191 def properties(...) = Functions.properties(...) |
.query ⇒ Object
Cyrel DSL helper: creates a new query. Example: Cyrel.query.match(pattern)
8 9 10 |
# File 'lib/cyrel.rb', line 8 def query Query.new end |
.rel(alias_name = nil, *types, **properties) ⇒ Object
Cyrel DSL helper: creates a relationship pattern. Example: Cyrel.rel(:r, :KNOWS, since: 2020)
38 39 40 41 |
# File 'lib/cyrel.rb', line 38 def rel(alias_name = nil, *types, **properties) length = properties.delete(:length) Pattern::Relationship.new(alias_name: alias_name, types: types, properties: properties, length: length) end |
.return(**return_values) ⇒ Object
Cyrel DSL helper: creates a RETURN clause. Example: Cyrel.return(name: :n)
26 27 28 |
# File 'lib/cyrel.rb', line 26 def return(**return_values) ReturnOnly.new(return_values) end |
.size ⇒ Object
Cyrel DSL helper: Cypher size() function. Example: Cyrel.size(:n)
239 |
# File 'lib/cyrel.rb', line 239 def size(...) = Functions.size(...) |
.sum ⇒ Object
Cyrel DSL helper: Cypher sum() aggregation. Example: Cyrel.sum(:n)
219 |
# File 'lib/cyrel.rb', line 219 def sum(...) = Functions.sum(...) |
.timestamp ⇒ Object
Cyrel DSL helper: Cypher timestamp() function. Example: Cyrel.timestamp
199 |
# File 'lib/cyrel.rb', line 199 def (...) = Functions.(...) |
.to_boolean ⇒ Object
Cyrel DSL helper: Cypher toBoolean() function. Example: Cyrel.to_boolean(:n)
215 |
# File 'lib/cyrel.rb', line 215 def to_boolean(...) = Functions.to_boolean(...) |
.to_float ⇒ Object
Cyrel DSL helper: Cypher toFloat() function. Example: Cyrel.to_float(:n)
211 |
# File 'lib/cyrel.rb', line 211 def to_float(...) = Functions.to_float(...) |
.to_integer ⇒ Object
Cyrel DSL helper: Cypher toInteger() function. Example: Cyrel.to_integer(:n)
207 |
# File 'lib/cyrel.rb', line 207 def to_integer(...) = Functions.to_integer(...) |
.to_string ⇒ Object
Cyrel DSL helper: Cypher toString() function. Example: Cyrel.to_string(:n)
203 |
# File 'lib/cyrel.rb', line 203 def to_string(...) = Functions.to_string(...) |
.type ⇒ Object
Cyrel DSL helper: Cypher type() function. Example: Cyrel.type(:r)
187 |
# File 'lib/cyrel.rb', line 187 def type(...) = Functions.type(...) |