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::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

#cypher_prop_list, #escape_quotes, #escape_value, #sanitize_escape_sequences, sanitized_column_names, translate_response

Constructor Details

#initialize(session, name) ⇒ CypherLabel

Returns a new instance of CypherLabel.



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

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#create_index(*properties) ⇒ Object



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

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

#drop_index(*properties) ⇒ Object



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

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



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

def indexes
  @session.indexes(@name)
end

#uniqueness_constraintsObject



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

def uniqueness_constraints
  @session.uniqueness_constraints(@name)
end