Class: Legion::Extensions::Neo4j::Client

Inherits:
Object
  • Object
show all
Includes:
Helpers::Client, Runners::Admin, Runners::Cypher, Runners::GraphDataScience, Runners::Indexes, Runners::Nodes, Runners::Relationships, Runners::Transactions
Defined in:
lib/legion/extensions/neo4j/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Runners::GraphDataScience

#drop_graph, #list_graphs, #project_graph, #run_louvain, #run_node_similarity, #run_pagerank

Methods included from Runners::Admin

#call_procedure, #create_database, #database_info, #db_stats, #discovery, #drop_database, #list_databases, #list_functions, #list_procedures, #server_info

Methods included from Runners::Transactions

#begin_transaction, #commit_transaction, #execute_in_transaction, #rollback_transaction

Methods included from Runners::Indexes

#create_existence_constraint, #create_fulltext_index, #create_index, #create_uniqueness_constraint, #drop_constraint, #drop_index, #list_constraints, #list_indexes

Methods included from Runners::Relationships

#create_relationship, #delete_relationship, #find_relationships, #get_relationship, #list_relationship_types, #merge_relationship, #neighbors, #shortest_path, #update_relationship

Methods included from Runners::Nodes

#count_nodes, #create_node, #delete_node, #find_nodes, #get_node, #list_labels, #merge_node, #update_node

Methods included from Runners::Cypher

#multi_statement, #query, #query_single

Constructor Details

#initialize(url: 'http://localhost:7474', username: 'neo4j', password: nil, database: 'neo4j', read_only: false, **extra) ⇒ Client

Returns a new instance of Client.



27
28
29
30
31
# File 'lib/legion/extensions/neo4j/client.rb', line 27

def initialize(url: 'http://localhost:7474', username: 'neo4j', password: nil, database: 'neo4j',
               read_only: false, **extra)
  @opts = { url: url, username: username, password: password, database: database,
            read_only: read_only, **extra }
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



25
26
27
# File 'lib/legion/extensions/neo4j/client.rb', line 25

def opts
  @opts
end

Instance Method Details

#connection(**override) ⇒ Object



33
34
35
# File 'lib/legion/extensions/neo4j/client.rb', line 33

def connection(**override)
  super(**@opts.merge(override.compact))
end

#execute_cypher(query, parameters: {}, database: nil, **override) ⇒ Object



37
38
39
40
# File 'lib/legion/extensions/neo4j/client.rb', line 37

def execute_cypher(query, parameters: {}, database: nil, **override)
  db = database || @opts[:database]
  super(query, parameters: parameters, database: db, **@opts.merge(override.compact))
end