Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am using Phase2 to get related nodes...where can I find docs on the methods? #219

Closed
angelacode opened this issue May 4, 2017 · 2 comments

Comments

@angelacode
Copy link

grateful_nodes = node.outgoing(:gratefulFor)
`grateful_nodes.methods'

The list includes things like:
How do I find the usage or definitions I know some of these things seem similar to methods for an array.

But I am interested in filter and uniqueness, for example.

:uniqueness,
 :uniqueness=,
 :depth,
 :depth=,
 :prune,
 :prune=,
 :filter,
 :filter=,
 :relationships,
 :relationships=,
 :<<,
 :create,
 :both,
 :outgoing,
 :incoming,
 :include_start_node,
 :size,
 :length,
 :[],
 :empty?,
 :each,
 :iterator,
 :to_a,
 :entries,
 :to_h,
 :sort,
 :sort_by,
 :grep,
 :count,
 :find,
 :detect,
@angelacode
Copy link
Author

Hi, I am following up on the documentation, it's still not clear what I am getting back:

n1.outgoing # Get nodes related by outgoing relationships
n1.incoming # Get nodes related by incoming relationships
n1.both # Get nodes related by any relationships

The output should be nodes, but I get Neography:RelationshipTraversal.

@maxdemarzi
Copy link
Owner

You may want to just use Cypher queries instead of trying to use the traversal api.
@neo.execute_query("MATCH (n) RETURN n LIMIT 25")

What you are seeing is a traversal being built along the lines of https://github.com/maxdemarzi/neography/blob/afb3a4724e67d6665d79ca280bb709e69814e893/lib/neography/node_traverser.rb

Once you finish describing the traverser, you need to .each to get the answers.

See:
https://github.com/maxdemarzi/neography/blob/afb3a4724e67d6665d79ca280bb709e69814e893/examples/linkedin_v2.rb

johnathan.all_simple_paths_to(mary).incoming(:friends).depth(4).nodes.each do |node|
  puts node.map{|n| n.name }.join(' => friends => ')
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants