-
Notifications
You must be signed in to change notification settings - Fork 273
Neo4j::wrapper introduction
andreasronge edited this page Oct 2, 2012
·
9 revisions
class Company
include Neo4j::NodeMixin
has_n(:employees)
end
class Person
include Neo4j::NodeMixin
property :name
property :age, :size, :type => Fixnum, :index => :exact
property :description, :index => :fulltext
has_one(:best_friend)
has_n(:employed_by).from(:employees)
end
Neo4j::Transaction.run do
Person.new(:name => 'jimmy', :age => 35)
end
person = Person.find(:age => (10..42)).first
Neo4j::Transaction.run do
person.best_friend = Person.new
person.employed_by << Company.new(:name => "Foo ab")
end
# find by navigate incoming relationship
company = person.employed_by.find { |p| p[:name] == 'Foo ab' }
puts "Person #{person.name} employed by #{company[:name]}"
# navigate the outgoing relationship:
company.employees.each {|x| puts x.name}
WARNING: Much of the information in this wiki is out of date. We are in the process of moving things to readthedocs
- Project Introduction
- Neo4j::ActiveNode
- Neo4j::ActiveRel
- Search and Scope
- Validation, Uniqueness, and Case Sensitivity
- Indexing VS Legacy Indexing
- Optimized Methods
- Inheritance
- Core: Nodes & Rels
- Introduction
- Persistence
- Find : Lucene
- Relationships
- Third Party Gems & extensions
- Scaffolding & Generators
- HA Cluster