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

relationships: incoming and outgoing are nil #7

Open
mugwump opened this issue Dec 6, 2011 · 2 comments
Open

relationships: incoming and outgoing are nil #7

mugwump opened this issue Dec 6, 2011 · 2 comments

Comments

@mugwump
Copy link

mugwump commented Dec 6, 2011

Excuse if this is stupid and/or there is an obvious solution, I'm just starting with neo4j/architect4r: I'm trying to make a list of things using neo4j/architect4r. My model is roughly like this:

class List < Architect4r::Model::Node
end

class Thing < Architect4r::Model::Node 
end

class ContainsThing < Architect4r::Model::Relationship
 def list
   source
 end 

 def thing
  destination
 end
end

I then try to make a list with two things on it:

    list = List.new
    list.save

    thing1 = Thing.new
    thing1.save

    thing2 = Thing.new
    thing2.save

    listed1 = ContainsThing.new(list, thing1)
    listed1.save

    listed2 = ContainsThing.new(list, thing2)
    listed2.save

    list.should respond_to(:links)
    list.links.outgoing.should include listed1

list properly responds to links, but outgoing and incoming are both nil. When I examine the list-node in the neo4j it only has a model-type relationship to the List Root. But no ContainsThing-relationship that connects it to the thing. What am I doing wrong here?!

@mugwump
Copy link
Author

mugwump commented Dec 6, 2011

After digging around a little, I found that the LinksQueryInterface that is used by the Relationships-model is not implemented yet and simply returns nil for incoming, outgoing and all - or am I missing some magic here?!

@mugwump
Copy link
Author

mugwump commented Dec 7, 2011

ok, I'm currently trying to fix this by forking&then implementing the LinksQueryInterface: I ran into some issues here, but no showstopppers:

  • maybe we can add some code to download neo4j and put it into neo4j_server (similar to what neography does): At first this was missing, then I copied it manually, then I ran into some version-mismatches
  • that being said: bootstrapping the server with the stuff in spec/fixtures/graph.db.default did not work due to a version mismatch. And anyway, this does not appear to be needed - an empty database works just fine, as all specs set up their own data. I therefore replaced neo_manager.reset_to_sample ... with neo_manager.reset which works just fine. Maybe we need some kind of factory_girl to specify fixtures?!
  • the neo4j-server is started without a port, but the TEST_SERVER_CONFIG explicitly states 7475 as port (obviously to avoid any conflicts with running neo4j-instances) - which then causes most tests to fail. I changed the port in the config, but is there a way to tell neo4j to run on another port?!

After these changes I got

143 examples, 1 failure, 9 pending

which is pretty impressive!! The only failing spec comes from a validation (Validations extension should not allow creating a record if it is invalid)

I will now try to implement the links, hope to get this working today/tomorrow...

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

1 participant