Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
neo4jrest client question
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alex  
View profile  
 More options Apr 18 2012, 2:31 am
From: Alex <alessio.battistu...@gmail.com>
Date: Tue, 17 Apr 2012 23:31:20 -0700 (PDT)
Local: Wed, Apr 18 2012 2:31 am
Subject: neo4jrest client question

Hi guys, i use the neo4jrestclient api and looking documentation i
dont know how to visualize all relation
node to node, let me to explain ..

in the documentation i see u can search for incoming or outgoing
relation referred to a node

like this :

rels = node.relationships.incoming()

or

rels = node.relationships.outgoing()

but if i need all the relation referred to two nodes ?  like node1
referred to node2, is possible ?

thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nigel Small  
View profile  
 More options Apr 18 2012, 2:38 am
From: Nigel Small <ni...@nigelsmall.net>
Date: Wed, 18 Apr 2012 07:38:34 +0100
Local: Wed, Apr 18 2012 2:38 am
Subject: Re: [Neo4j] neo4jrest client question

Hi Alex

I'm not sure exactly how you would do that from within the neo4jrestclient
specifically, but it's certainly possible via the REST interface. Py2neo
makes it available as below:

http://py2neo.org/doc/py2neo.html#py2neo.neo4j.Node.get_relationships

Nige

On 18 April 2012 07:31, Alex <alessio.battistu...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex  
View profile  
 More options Apr 18 2012, 2:44 am
From: Alex <alessio.battistu...@gmail.com>
Date: Tue, 17 Apr 2012 23:44:41 -0700 (PDT)
Local: Wed, Apr 18 2012 2:44 am
Subject: Re: neo4jrest client question
Hi Nige,

im in search of something of that :

rels = node1.relationships.node2.<direction>

but dunno if this is done with traversal in more simple manner ..

Thanks

On 18 Apr, 08:38, Nigel Small <ni...@nigelsmall.net> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Thornton  
View profile  
 More options Apr 18 2012, 3:50 am
From: James Thornton <james.thorn...@gmail.com>
Date: Wed, 18 Apr 2012 00:50:02 -0700 (PDT)
Local: Wed, Apr 18 2012 3:50 am
Subject: Re: neo4jrest client question

On Wednesday, April 18, 2012 1:44:41 AM UTC-5, Alex wrote:

> im in search of something of that :

> rels = node1.relationships.node2.<direction>

> but dunno if this is done with traversal in more simple manner ..

You can use a Gremlin script in Bulbs (http://bulbflow.com/) to find all
the relationships between nodes "a" and "b"...

>>> from bulbs.neo4jserver import Graph
>>> g = Graph()
>>> script = "g.v(a).bothE().filter{it.outVertex == g.v(b) || it.inVertex
== g.v(b)}"
>>> params = dict(a=1, b=2)
>>> edges = g.gremlin.query(script, params)

- James

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex  
View profile  
 More options Apr 18 2012, 5:37 am
From: Alex <alessio.battistu...@gmail.com>
Date: Wed, 18 Apr 2012 02:37:20 -0700 (PDT)
Local: Wed, Apr 18 2012 5:37 am
Subject: Re: neo4jrest client question
Nice !

Ty James

On 18 Apr, 09:50, James Thornton <james.thorn...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Javier de la Rosa  
View profile  
 More options Apr 18 2012, 11:18 am
From: Javier de la Rosa <ver...@gmail.com>
Date: Wed, 18 Apr 2012 11:18:56 -0400
Local: Wed, Apr 18 2012 11:18 am
Subject: Re: [Neo4j] Re: neo4jrest client question
Hi, Alex,

There is no way to do that in the neo4jrestclient, but you can use the
script Nigel has written also in the library:

>>> gremlin = gdb.extensions.GremlinPlugin.execute_script
>>> relationships = gremlin(script=script)

Or just returning the data as raw:

>>> relationships = gremlin(script=script, returns=client.constants.RAW)

Another less efficient way is just a comprehesion list like this one:

>>> [r for r in n2.relationships.all(type=["KNOWS"]).all() if n2 in [r.start, r.end]]

It returns all the relationships of types "KNOWS" between n1 and n2,
no matters the direction. Or you can even use traversals.

--
Javier de la Rosa
http://versae.es

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »