Re: [Neo] Connecting to Neo4j DB from ActionScript

2010-04-10 Thread Amir Hossein Jadidinejad
Hi,
After a lot of try/miss attempts, finally I've created both the server and 
client sides. I have some problems:
1. I don't know how to manage shutting down stuffs (GraphDatabaseService and 
IndexService) in the client side.
2. When I run the flex page for the first time (after restarting the Tomcat), 
everything is ok. But when I run it again or refresh the page, I have a Error: 
An unknown exception occurred while creating an instance of type 
'wikipedia.wnng.Connector'. - It maybe related to the first item!
3. The source codes are attached, would you please review them or share some 
codes that I can solve the problem?

Kind regards,
Amir

--- On Sat, 3/13/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: Saturday, March 13, 2010, 9:57 AM

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

Re: [Neo] Connecting to Neo4j DB from ActionScript

2010-04-10 Thread rick . bullotta
   I would not use a Runtime shutdown hook from within Tomcat.  I would
   use a ServletContextListener (override the contextInitialized and
   contextDestroyed events), and create singletons for the
   GraphDatabaseService/LuceneIndex when the webapp initializes, and
   shut them down when the webapp is destroyed.  You can only have a
   single instance of the GraphDatabaseService active at a time.



   Those changes should get you working.



   Rick















    Original Message 
   Subject: Re: [Neo] Connecting to Neo4j DB from ActionScript
   From: Amir Hossein Jadidinejad amir.jad...@yahoo.com
   Date: Sat, April 10, 2010 2:48 pm
   To: Neo user discussions user@lists.neo4j.org
   Cc: rick.bullo...@burningskysoftware.com
   Hi,
   After a lot of try/miss attempts, finally I've created both the server
   and client sides. I have some problems:
   1. I don't know how to manage shutting down stuffs
   (GraphDatabaseService and IndexService) in the client side.
   2. When I run the flex page for the first time (after restarting the
   Tomcat), everything is ok. But when I run it again or refresh the page,
   I have a Error: An unknown exception occurred while creating an
   instance of type 'wikipedia.wnng.Connector'. - It maybe related to
   the first item!
   3. The source codes are attached, would you please review them or share
   some codes that I can solve the problem?
   Kind regards,
   Amir
   --- On Sat, 3/13/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: Saturday, March 13, 2010, 9:57 AM

   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

Re: [Neo] Connecting to Neo4j DB from ActionScript

2010-03-13 Thread Rick Bullotta
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

Re: [Neo] Connecting to Neo4j DB from ActionScript

2010-03-13 Thread Amir Hossein Jadidinejad
Dear Rick,
Greatly appreciate your help. Let me some time to learn about the following 
technologies!, I'll send back to you asap.
Thanks again.
Kind regards,
Amir

--- On Sat, 3/13/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: Saturday, March 13, 2010, 9:57 AM

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

[Neo] Connecting to Neo4j DB from ActionScript

2010-03-12 Thread Amir Hossein Jadidinejad
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


Re: [Neo] Connecting to Neo4j DB from ActionScript

2010-03-12 Thread Todd Stavish
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


Re: [Neo] Connecting to Neo4j DB from ActionScript

2010-03-12 Thread Amir Hossein Jadidinejad
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


Re: [Neo] Connecting to Neo4j DB from ActionScript

2010-03-12 Thread Rick Bullotta
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


Re: [Neo] Connecting to Neo4j DB from ActionScript

2010-03-12 Thread Amir Hossein Jadidinejad
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