getRelationships(RelationshipType... types)

閲覧: 1 回
最初の未読メッセージにスキップ

sumanth

未読、
2010/02/23 7:01:222010/02/23
To: neo...@googlegroups.com、su...@truesparrow.com

Hi,

I am newbie to neo4j and I am enjoying it.

I have started to create nodes, relationships and assigning properties to the nodes etc.
I've got a problem in accessing relationships of a node.

If 'knows = DynamicRelationshipType.withName("KNOWS")' is a relation defined.

When a relationship 'knows' is formed from node1 to node2, I should be able to access relationship of node1 by one of node1.getRelationships() or node1.getRelationships(knows, direction) or node1.getRelationships(direction) or node1.getRelationships(knows) methods. 

There is no problem with the first three, but the last method throws an error.
Error is:
         NameError: no getRelationships with arguments matching [class org.neo4j.graphdb.DynamicRelationshipType] on object #<#<Class:01xf38cf0>:0x1aa0a15>

From the documentation of node1.getRelationships(RelationshipType... types), I sense that 'types' is a little different from 'knows' .

Please help me understand how types needs to be passed to the method node1.getRelationships(RelationshipType... types).

Thanks,
T.Sumanth

Matt Deiters

未読、
2010/02/23 13:31:112010/02/23
To: neo...@googlegroups.com
Try

RelationshipType.instance('KNOWS') or RelationshipType.instances('KNOWS', "SOMETHING_ELSE")

you can also specify the direction like:

RelationshipType.outgoing('KNOWS')

Matt


--
You received this message because you are subscribed to the Google Groups "neo4jrb" group.
To post to this group, send email to neo...@googlegroups.com.
To unsubscribe from this group, send email to neo4jrb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/neo4jrb?hl=en.

sumanth

未読、
2010/02/24 2:53:272010/02/24
To: neo4jrb
Thank you Matt, will try and see if I can successfully do it. :)

> > neo4jrb+u...@googlegroups.com<neo4jrb%2Bunsu...@googlegroups.com >

sumanth

未読、
2010/02/24 6:15:522010/02/24
To: neo4jrb
Hi Matt,

I have tried the way you have mentioned, only to get the error like:

"undefined method `instance' for
Java::OrgNeo4jGraphdb::RelationshipType:Module"

I tried to get the relations of a node1 like
node1.getRelationships(RelationshipType.instance('KNOWS')).
Relationship 'KNOWS' id defined as knows =
DynamicRelationshipType.withName("KNOWS").

Please tell me, if I am doing anything wrong, or anything missing
there.

Thanks in advance,
Sumanth.

全員に返信
投稿者に返信
転送
新着メール 0 件