Hi, Amir.

Most of what we're doing is fairly specific to our domain model (each node
has a type and a name property) and technology landscape (WebORB backend,
for example), but there are some guidelines I can share with you to help.

1) You'll want to create a viewer based on ExtendedFlexGraph, which brings
with it a lot of very useful filtering/searching/layout capabilities that
the base FlexGraph class does not have

2) You'll want to create a custom node renderer and a custom arc
(relationship) renderer.  We overrode the newInstance(), set data, and
addToolTipValues() methods to allow us to display Neo node and relationship
properties in the mouse-over event, and to provide custom text to display on
each node/relationship.  The Neo relationship model fits nicely with Flexviz
in that an "arc" in Flexviz has a type that corresponds to the
"RelationshipType" in neo.  The Neo node model also fits reasonably well,
with the concept of an "id" (arcs have id's also).

3) You'll need a back-end service (servlet or other) to get data to your
Flex front end.  We're using WebORB, which allows a high performance bridge
to the Flex app using Flex remoting (and a binary protocol), but you could
do the same thing with a Flex HTTPService and by outputting XML from a
servlet, perhaps in some variant of GraphML.  In the handler for a response
for the server, you'll then want to parse the result and create the graph
model inside Flexviz.  Here's the code we use (realize that our result
structure is a "native" object, but the same approach could be used with
XML).

                                neoModel = response.result as
ArrayCollection;
                                
                                graph.nodeRenderer = new NeoNodeRenderer();
                                graph.arcRenderer = new
NeoRelationshipRenderer();
                                
                                model = new DefaultGraphModel();
                                
                                var node:Object;
                                var edge:Object;
                                
                                for each(node in neoModel) {
                                        var graphNode:DefaultGraphNode = new
DefaultGraphNode(node.id, node.type, node.name, node);
                                        model.addNode(graphNode);
                                }
                                
                                for each(node in neoModel) {
                                        for each(edge in node.edges) {
                                                
                                                var fromItem: IGraphNode =
model.getNode(edge.fromNode);
                                                var toItem:  IGraphNode =
model.getNode(edge.toNode);
                                                var arc:DefaultGraphArc =
new DefaultGraphArc(edge.id, fromItem, toItem, edge.type, edge, false,
true);
                                                model.addArc(arc);
                                
                                        }
                                }
                                
                                graph.model = model;
                                var layout:ILayoutAlgorithm = new
RadialLayoutAlgorithm();
                                graph.runLayout(layout);

4) On the server side, we created a class that handles client requests, with
a single parameter corresponding to the "root" node of the request.  In our
case, we don't want to display the entire Neo4J graph - only nodes one
relationship away from a specified node (similar to Neoclipse's default
behavior)

5) On the client, we created a double click handler for the graph so that
double-clicking a node reinvokes the service with a new "root" node and
redisplays the graph.  It is easy to implement a "go back" function by
keeping track of the previous root node id's in a stack.

Hope that helps!

Rick

-----Original Message-----
From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On
Behalf Of Amir Hossein Jadidinejad
Sent: Saturday, March 13, 2010 12:04 AM
To: Neo user discussions
Subject: Re: [Neo] Connecting to Neo4j DB from ActionScript

Dear Rick,
It's really interesting. Would you please share your experiments with us?,
Some example, source code,...
Greatly appreciate your help.
Kind regards,
Amir

--- On Fri, 3/12/10, Rick Bullotta <rick.bullo...@burningskysoftware.com>
wrote:

From: Rick Bullotta <rick.bullo...@burningskysoftware.com>
Subject: Re: [Neo] Connecting to Neo4j DB from ActionScript
To: "'Neo user discussions'" <user@lists.neo4j.org>
Date: Friday, March 12, 2010, 6:27 PM

Amir, I'm doing something similar (also with Flexviz).  I looked at a number
of other Flex graph visualization libraries (Kapit, SpringGraph, YFiles,
Raviz/Birdeye, Flare) and definitely preferred Flexviz to the others. It
seems quite extensible/customizable as well.

I'm using Flex/Flash remoting between the server and the client, and on the
server side, I'm using WebORB Java.

Rick

-----Original Message-----
From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On
Behalf Of Amir Hossein Jadidinejad
Sent: Friday, March 12, 2010 5:10 PM
To: Neo user discussions
Subject: Re: [Neo] Connecting to Neo4j DB from ActionScript

Dear Todd,
I'm not familiar with them. Would you please provide me a simple how-to or
some source code example?
In fact, I'm going to visualise the Neo4j DB using FlexViz. It's really
beautiful and flexible.
Thanks.
Amir

--- On Fri, 3/12/10, Todd Stavish <toddstav...@gmail.com> wrote:

From: Todd Stavish <toddstav...@gmail.com>
Subject: Re: [Neo] Connecting to Neo4j DB from ActionScript
To: "Neo user discussions" <user@lists.neo4j.org>
Date: Friday, March 12, 2010, 4:43 PM

Hi Amir,

I used GSON (google's json package) on the Neo side and Flex's json
AS3 classes to make the connection.

-Todd



On Fri, Mar 12, 2010 at 4:31 PM, Amir Hossein Jadidinejad
<amir.jad...@yahoo.com> wrote:
> Hi,
> Is it possible to connect a Neo4j instance using ActionScript and Adobe
Flex?!
> Thanks.
>
>
>
>
> _______________________________________________
> Neo mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user



      
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user



      
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to