neo4jrest client question
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:
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.
You do not have the permission required to post.
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:
> 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.
You do not have the permission required to post.
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:
> 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:
> > 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.
You do not have the permission required to post.
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.
You do not have the permission required to post.
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:
> 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.
You do not have the permission required to post.
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.
On Wed, Apr 18, 2012 at 05:37, Alex <alessio.battistu
... @gmail.com> wrote:
> Nice !
> Ty James
> On 18 Apr, 09:50, James Thornton <james.thorn... @gmail.com> wrote: >> 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
--
Javier de la Rosa
http://versae.es
You must
Sign in before you can post messages.
You do not have the permission required to post.