Class: Neo4j::Server::CypherLabel

Inherits:
Label
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/neo4j-server/cypher_label.rb

Constant Summary

Constants included from Core::CypherTranslator

Core::CypherTranslator::EMPTY_PROPS, Core::CypherTranslator::SANITIZE_ESCAPED_REGEXP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Label

create, #create_constraint, #drop_constraint, find_all_nodes, find_nodes

Methods included from Core::CypherTranslator

#create_escape_value, #cypher_prop_list, #cypher_string, #escape_quotes, #escape_value, #label_string, #prop_identifier, #sanitize_escape_sequences, sanitized_column_names, translate_response

Constructor Details

#initialize(session, name) ⇒ CypherLabel

Returns a new instance of CypherLabel.



8
9
10
11
# File 'lib/neo4j-server/cypher_label.rb', line 8

def initialize(session, name)
  @name = name
  @session = session
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/neo4j-server/cypher_label.rb', line 6

def name
  @name
end

Instance Method Details

#create_index(*properties) ⇒ Object



13
14
15
16
# File 'lib/neo4j-server/cypher_label.rb', line 13

def create_index(*properties)
  response = @session._query("CREATE INDEX ON :`#{@name}`(#{properties.join(',')})")
  response.raise_error if response.error?
end

#drop_index(*properties) ⇒ Object



18
19
20
21
22
23
# File 'lib/neo4j-server/cypher_label.rb', line 18

def drop_index(*properties)
  properties.each do |property|
    response = @session._query("DROP INDEX ON :`#{@name}`(#{property})")
    response.raise_error if response.error? && !response.error_msg.match(/No such INDEX ON/)
  end
end

#indexesObject



25
26
27
# File 'lib/neo4j-server/cypher_label.rb', line 25

def indexes
  @session.indexes(@name)
end

#uniqueness_constraintsObject



29
30
31
# File 'lib/neo4j-server/cypher_label.rb', line 29

def uniqueness_constraints
  @session.uniqueness_constraints(@name)
end