ClassMethods

Constants

Methods

#all

Performs a basic match on the relationship, returning all results. This is not executed lazily, it will immediately return matching objects.

def all
  all_query.pluck(:r1)
end
#find

Returns the object with the specified neo4j id.

def find(id, session = self.neo4j_session)
  fail "Unknown argument #{id.class} in find method (expected String or Integer)" if !(id.is_a?(String) || id.is_a?(Integer))
  find_by_id(id, session)
end
#find_by_id

Loads the relationship using its neo_id.

def find_by_id(key, session = Neo4j::Session.current!)
  session.query.match('()-[r]-()').where('ID(r)' => key.to_i).limit(1).return(:r).first.r
end

#first

def first
  all_query.limit(1).order('ID(r1)').pluck(:r1).first
end

#last

def last
  all_query.limit(1).order('ID(r1) DESC').pluck(:r1).first
end
#where

Performs a very basic match on the relationship. This is not executed lazily, it will immediately return matching objects. To use a string, prefix the property with “r1”

def where(args = {})
  where_query.where(where_string(args)).pluck(:r1)
end