[Neo4j] Delete a RelationshipType

2010-10-31 Thread Amir Hossein Jadidinejad
Hi,
I have a graph with two different RelationshipType: R1, R2
I want to replace all RelationshipTypes with a new R3. It means that previous 
relations are exist but its types change to R3. Iterate over all nodes, delete 
previous relations and create new relation with the following source code:
int pc = 0;
Node ref = graphDb.getReferenceNode();
for (IteratorNode itr = graphDb.getAllNodes().iterator(); 
itr.hasNext();) {
Node current_node = itr.next();
if (current_node.equals(ref))
continue;
ArrayListLong current_relations = new ArrayListLong();
for (IteratorRelationship rel_itr = 
current_node.getRelationships().iterator(); rel_itr
.hasNext();) {
Relationship rel = rel_itr.next();
current_relations.add(rel.getId());
}
for (long r : current_relations)
updateRelation(r);
if (++pc % 100 == 0)
System.out.println(\t\t\t + pc);
if (pc % 1 == 0) {
System.out.println(\t\t\tsaving to disk...);
tx.success();
tx.finish();
tx = graphDb.beginTx();
}
}


private void updateRelation(long relID) {
Relationship rel = graphDb.getRelationshipById(relID);
Node startNode = rel.getStartNode();
Node endNode = rel.getEndNode();
rel.delete();
startNode.createRelationshipTo(endNode, 
NodeRelationshipTypes2.related_to);
}


After running, size of the graph is changed from 2GB to 3.5GB and when I print 
the relationship types with:

System.out.println(\tRelationship types:);
for (IteratorRelationshipType rel_type_itr = 
graphDb.getRelationshipTypes().iterator(); rel_type_itr
.hasNext();)
System.out.println(\t\t + rel_type_itr.next().name());

R1, R2 and R3 are in the output. Why?

I checked all node's relations, there is no relation which its type is equal to 
R1 or R2!

Kind regards



  
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Neo4j Java Rest Client

2010-08-23 Thread Amir Hossein Jadidinejad
Hi,
We have a graph database and a bunch of applications that use it (each 
application run a special graph algorithm on this database-a framework for a 
special graph).We want to provide a REST server and change the application's 
code in order to interact with the REST server instead of the same embedded 
database.
There are some pages in the wiki that describes installing and running 
neo4j-rest and get/post methods in JSON.
I'm not familiar with accessing REST service through a Java client. Would you 
please help me? An example that compare EmbeddedGraphDatabase with REST service 
is great. 

Kind regards



  
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] OpenJDK vs SunJDK

2010-08-18 Thread Amir Hossein Jadidinejad
Hi,
Regarding Neo4j project, is there any difference or priority about Sun-Java-6 
or 
OpenJDK?



  
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Very slow read performance-1sec to get a node's relationships

2010-07-23 Thread Amir Hossein Jadidinejad
Yes, it seems that Neo4j has to be warmed up like my car! ;)
After warm-up, its performance is great.
Thank you so much






From: Mattias Persson matt...@neotechnology.com
To: Neo4j user discussions user@lists.neo4j.org
Sent: Sat, July 24, 2010 1:12:50 AM
Subject: Re: [Neo4j] Very slow read performance-1sec to get a node's 
relationships

2010/7/22 Amir Hossein Jadidinejad amir.jad...@yahoo.com

 Dear David,
 This issue make me crazy! help me please.
 I've created a new database with the following features:
 NeoStore:

* neostore.nodestore.db = 30M
* neostore.propertystore.db = 258M

* neostore.propertystore.db.strings = 916M
* neostore.relationshipstore.db = 700M
* (other files are small size)
 Primitives:

* NumberOfNodesIdsInUse: 3,599,278
* NumberOfPropertyIdsInUse: 10,797,831
* NumberOfRelationshipIdsInUse: 22,059,798
* NumberOfRelationshipIdsInUse: 2

 And the following configurations file:
 neostore.nodestore.db.mapped_memory=120M
 neostore.relationshipstore.db.mapped_memory=2G
neostore.propertystore.db.mapped_memory=400M
neostore.propertystore.db.strings.mapped_memory=1G
neostore.propertystore.db.arrays.mapped_memory=50M
dump_configuration=true

 The following is my test case (iterate over all nodes and get all
 relationships
 for each one):
for (IteratorNode itr = graphdb.getAllNodes().iterator();
 itr.hasNext();) {
Node current_node = itr.next();
nodes++;
for (IteratorRelationship itr1 =
 current_node.getRelationships().iterator(); itr1.hasNext();) {
Relationship rel = itr1.next();
related_parent++;
 //Node out_node = rel.getEndNode();
 //String out_cui = out_node.getProperty(cui).toString();
}
}

 This program is executed using the following parameters:
 java -d64 -server -XX:+UseNUMA -Xmx5632m -classpath

$CLASSPATH:../lib/geronimo-jta_1.1_spec-1.1.1.jar:../lib/jline-0.9.94.jar:../lib/lucene-core-2.9.2.jar:../lib/mysql-connector-java-5.1.7-bin.jar:../lib/neo4j-index-1.1-20100714.135430-157.jar:../lib/neo4j-kernel-1.1-20100714.134745-137.jar:../lib/neo4j-remote-graphdb-0.7-20100714.140411-116.jar:../lib/neo4j-shell-1.1-20100714.140808-144.jar:../lib/servlet-api.jar:../lib/trove.jar:../lib/weka.jar:.

  org.Test

 I arrange the memory as follow:
All available memory: 12GB
OS: 2GB
HEAP: 5.5GB
MemoryMap: 4.5GB

 The following is the output:
 Physical mem: 12034MB
 Heap size: 5006MB
 store_dir=/home/amir/WCRM20100312
 rebuild_idgenerators_fast=true
 neostore.propertystore.db.index.keys.mapped_memory=1M
 logical_log=/home/amir/WCRM20100312/nioneo_logical.log
 neostore.propertystore.db.strings.mapped_memory=1G
 neostore.propertystore.db.arrays.mapped_memory=50M
 neo_store=/home/amir/WCRM20100312/neostore
 neostore.relationshipstore.db.mapped_memory=2G
 neostore.propertystore.db.index.mapped_memory=1M
 create=true
 neostore.propertystore.db.mapped_memory=400M
 dump_configuration=true
 neostore.nodestore.db.mapped_memory=120M
 dir=/home/amir/WCRM20100312/lucene-fulltext

 I've got the interesting results with different runs. In the beginning of
 the
 first run, the program is really slow with low cpu/memory utilization but
 after
 a 5-10 minutes, it has better throughput. BTW, Overall performance for the
 first
 run is low.
Total execution time: 900 sec
 After running the program again, it's really fast with very good cpu/memory
 utilization:
Total execution time: 310 sec
 I know that it's because of caching property. But what this speed is never
 reached at the first run?! Note that all the files have to be resident in
 the
 main memory according to the configuration settings.
 PS: Let me know if there is a flaw in the configuration settings.
 Kind regards,
 Amir


This is sort of expected behaviour... the first time a
node/relationship/(string/array)property is accessed it's loaded from
disk... even if that area of the file is memory mapped it still needs to be
read from that memory and into neo4j and put into its cache. If an entity
exists in cache it's returned immediately w/o needing to read anything from
disk (memory mapped or not). So first runs (i.e. cold run) are always slower
than consecutive runs.

-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user



  
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Very slow read performance-1sec to get a node's relationships

2010-07-22 Thread Amir Hossein Jadidinejad
Dear David,
This issue make me crazy! help me please.
I've created a new database with the following features:
NeoStore:

* neostore.nodestore.db = 30M
* neostore.propertystore.db = 258M

* neostore.propertystore.db.strings = 916M
* neostore.relationshipstore.db = 700M
* (other files are small size)
Primitives:

* NumberOfNodesIdsInUse: 3,599,278
* NumberOfPropertyIdsInUse: 10,797,831
* NumberOfRelationshipIdsInUse: 22,059,798
* NumberOfRelationshipIdsInUse: 2 

And the following configurations file:
neostore.nodestore.db.mapped_memory=120M
neostore.relationshipstore.db.mapped_memory=2G
neostore.propertystore.db.mapped_memory=400M
neostore.propertystore.db.strings.mapped_memory=1G
neostore.propertystore.db.arrays.mapped_memory=50M
dump_configuration=true

The following is my test case (iterate over all nodes and get all relationships 
for each one):
for (IteratorNode itr = graphdb.getAllNodes().iterator(); 
itr.hasNext();) {
Node current_node = itr.next();
nodes++;
for (IteratorRelationship itr1 = 
current_node.getRelationships().iterator(); itr1.hasNext();) {
Relationship rel = itr1.next();
related_parent++;
//Node out_node = rel.getEndNode();
//String out_cui = out_node.getProperty(cui).toString();
}
}

This program is executed using the following parameters:
java -d64 -server -XX:+UseNUMA -Xmx5632m -classpath 
$CLASSPATH:../lib/geronimo-jta_1.1_spec-1.1.1.jar:../lib/jline-0.9.94.jar:../lib/lucene-core-2.9.2.jar:../lib/mysql-connector-java-5.1.7-bin.jar:../lib/neo4j-index-1.1-20100714.135430-157.jar:../lib/neo4j-kernel-1.1-20100714.134745-137.jar:../lib/neo4j-remote-graphdb-0.7-20100714.140411-116.jar:../lib/neo4j-shell-1.1-20100714.140808-144.jar:../lib/servlet-api.jar:../lib/trove.jar:../lib/weka.jar:.
 org.Test

I arrange the memory as follow:
All available memory: 12GB
OS: 2GB
HEAP: 5.5GB
MemoryMap: 4.5GB

The following is the output:
Physical mem: 12034MB
Heap size: 5006MB
store_dir=/home/amir/WCRM20100312
rebuild_idgenerators_fast=true
neostore.propertystore.db.index.keys.mapped_memory=1M
logical_log=/home/amir/WCRM20100312/nioneo_logical.log
neostore.propertystore.db.strings.mapped_memory=1G
neostore.propertystore.db.arrays.mapped_memory=50M
neo_store=/home/amir/WCRM20100312/neostore
neostore.relationshipstore.db.mapped_memory=2G
neostore.propertystore.db.index.mapped_memory=1M
create=true
neostore.propertystore.db.mapped_memory=400M
dump_configuration=true
neostore.nodestore.db.mapped_memory=120M
dir=/home/amir/WCRM20100312/lucene-fulltext

I've got the interesting results with different runs. In the beginning of the 
first run, the program is really slow with low cpu/memory utilization but after 
a 5-10 minutes, it has better throughput. BTW, Overall performance for the 
first 
run is low.
Total execution time: 900 sec
After running the program again, it's really fast with very good cpu/memory 
utilization:
Total execution time: 310 sec
I know that it's because of caching property. But what this speed is never 
reached at the first run?! Note that all the files have to be resident in the 
main memory according to the configuration settings.
PS: Let me know if there is a flaw in the configuration settings.
Kind regards,
Amir




From: David Montag david.mon...@neotechnology.com
To: Neo4j user discussions user@lists.neo4j.org
Sent: Mon, July 19, 2010 3:23:54 PM
Subject: Re: [Neo4j] Very slow read performance-1sec to get a node's 
relationships

Hi Amir,

In your previous e-mail you listed some sizes of store files:

neostore.propertystore.db : 2GB
neostore.propertystore.db.strings : 4GB

You are however only memory mapping a fraction of the size of those files:

neostore.propertystore.db.mapped_memory=100M
neostore.propertystore.db.strings.mapped_memory=200M

Try increasing these numbers to cover the whole files. Alternatively, you
could also try using the auto config feature scheduled for 1.1. To use it,
just make sure to not provide the memory mapping configurations you want
auto configured, and they will automatically be set to sensible values. You
need to be using 1.1-SNAPSHOT to get access to that feature though.

Also, it shouldn't affect performance negatively in your case, but you have
overdimensioned the mapped memory for the relationship store file. It is
1.5GB and you have mapped 5GB. In general it's good to map as much as you
need.

If you'd like, you can also run your test with dump_configuration=true in
your config and then send us the output printed at startup.

We're interested to hear how this works out for you.

David

On Sun, Jul 18, 2010 at 10:39 PM, Amir Hossein Jadidinejad 
amir.jad...@yahoo.com wrote:

 I have program that runs

Re: [Neo4j] Neo4j Tuning for specific application

2010-07-18 Thread Amir Hossein Jadidinejad
No, I mean the I/O mapping approach is not appropriate in 
EmbeddedGraphDatabase. You have an EmbeddedReadOnlyGraphDatabase that 
support read only access to the database. It's great. Why you don't have 
EmbeddedInMemoryGraphDatabase that load the whole graph into the memory?
I have a large memory that isn't leveraged by Neo4j. Why?
How can I configure EmbeddedGraphDatabase in order to utilize all the free 
memory and decrease these time-consuming I/O access?



  
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Very slow read performance-1sec to get a node's relationships

2010-07-18 Thread Amir Hossein Jadidinejad
I have program that runs different threads in parallel. Each thread do the 
following job:
for (IteratorRelationship itr = 
current_node.getRelationships(NodeRelationshipTypes.related_to)
.iterator(); itr.hasNext();) {
Relationship rel = itr.next();
Node out_node = rel.getOtherNode(current_node);
String node_type = out_node.getProperty(type).toString();
Q.add(out_cui);
}
-just getting a set of output links.

By the following command:
java -d64 -server -XX:+UseNUMA -Xmx4096m -classpath 
$CLASSPATH:../lib/geronimo-jta_1_spec-1.1.1.jar:../lib/jline-0.9.94.jar:../lib/lucene-core-2.9.2.jar:../lib/mysql-connector-java-5.1.7-bin.jar:../lib/neo4j-index-1.1-20100714.135430-157.jar:../lib/neo4j-kernel-1.1-20100714.134745-137.jar:../lib/neo4j-remote-graphdb-0.7-20100714.140411-116.jar:../lib/neo4j-shell-1.1-20100714.140808-144.jar:../lib/servlet-api.jar:../lib/trove.jar:../lib/weka.jar:.
 myclass

On a machine with 12GB memory.

After running, disk is overloaded while heap memory is free! It takes roughly 
1sec for each thread in order to get a list of outgoing links!
The following is my configuration file:
neostore.nodestore.db.mapped_memory=120M
neostore.relationshipstore.db.mapped_memory=5G
neostore.propertystore.db.mapped_memory=100M
neostore.propertystore.db.strings.mapped_memory=200M
neostore.propertystore.db.arrays.mapped_memory=0M

After inspecting the application using jconsole, I found that the 
configuration settings are Unavailable (the snapshot is attached).
Why my application is too slow?

Would you please provide a list of TODO checks?



  ___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] EmbeddedReadOnlyGraphDatabase vs. EmbeddedGraphDatabase

2010-07-15 Thread Amir Hossein Jadidinejad
Hi,
What's the difference (advantages) between EmbeddedReadOnlyGraphDatabase and 
EmbeddedGraphDatabase?!
I have the following simple code:
MapString, String configuration = 
EmbeddedReadOnlyGraphDatabase.loadConfigurations(CONFIG_DB_PATH);
GraphDatabaseService neoInstance = new 
EmbeddedReadOnlyGraphDatabase(NEO_DB_PATH, configuration);
IndexService index = new LuceneIndexService(neoInstance);

After running I have a the following exception:
- org.neo4j.kernel.EmbeddedReadOnlyGraphDatabase cannot be cast to 
org.neo4j.kernel.EmbeddedGraphDatabase

Would you please give us an example of ReadOnly usage (GraphDB + Index)?



  
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Neo4j Tuning for specific application

2010-07-10 Thread Amir Hossein Jadidinejad
Hi,
I have a GraphDB with the following attributes:
Number of nodes: 3.6M
Number of relation types: 2 
Total size of DB: 9GB
lucene : 160MB
neostore.nodestore.db : 31MB
neostore.propertystore.db : 2GB
neostore.propertystore.db.strings : 4GB
neostore.relationshipstore.db : 1.5GB

Machine characteristics:
vm.dirty_background_ratio = 50
vm.dirty_ratio = 80
OS: Ubuntu x64
CPU: Corei7
MEM: 12GB

The following is our running scenario (The source code is attached):
1. Iterate over all nodes and extract a list of node IDs (fillNodes function).
2. For each node ID, initiate a worker thread that process the following items 
(8 threads are executed in parallel using a pool - walk function):
-extract relationships of this node.
-perform a light processing.
-update results (in a ConcurrentHashMap).

Note that:
-The above scenario is iterative. Roughly it runs 10 times.
-No update is applied to the DB during running (read only).

After running the application:
-Less than 4GB/12GB of memory is occupied. It seems that Neo4j is leveraged 
only 2GB of memory.
-The hard disk is overloaded.
-Only less than 20% of 8 cores is utilized in average. 

Some documents are available in the wiki regarding performance (Performance 
Guide, Configuration Settings, Linux Performance Guide). They are so general.
Would you please instruct me to have a better memory map and speed up my 
application?
I can benchmark different configurations and reflect the results in the wiki 
for 
future users.
Kind regards,
Amir



  package wikipedia.wnng;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;

import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Transaction;
import org.neo4j.index.IndexService;

public class RandomWalker {

public enum NodeRelationshipTypes implements RelationshipType {
go_to, related_to
}

class WalkerThread extends Thread {

private String cui;

public WalkerThread(String str) {
super(str);
cui = str;
}

public void run() {
// create current row of transition matrix
MapString, Double Pi = new HashMapString, Double();
Transaction tx = graphDb.beginTx();
try {
Node current_node = index.getSingleNode(cui, 
cui);
for (IteratorRelationship itr = 
current_node.getRelationships(NodeRelationshipTypes.go_to,
Direction.INCOMING).iterator(); 
itr.hasNext();) {
Relationship rel = itr.next();
Node income_node = rel.getStartNode();

Pi.put(income_node.getProperty(cui).toString(), 
Double.valueOf(rel.getProperty(weight)
.toString()));
}
tx.success();
} finally {
tx.finish();
}

// calculate v2 = alpha * Pi * v1 + (1 - alpha) * v1
// Pi * v1
Double result = new Double(0.0);
for (String index : Pi.keySet()) {
if (v1.containsKey(index))
result += Pi.get(index) * v1.get(index);
}
// alpha * Pi * v1
result *= alpha;
// (1 - alpha) * v1
Double temp = v1.get(cui);
temp = (temp == null) ? 0.0 : (1 - alpha) * temp;

// result = alpha * Pi * v1 + (1 - alpha) * v1[cui]
result += temp;

// update v2 with new value
v2.put(cui, result);
}
}

private HashSetString nodes;

private final double alpha = 0.5;
private final double epsilon = 0.1;

private ConcurrentMapString, Double v1;
private ConcurrentMapString, Double v2;

private final GraphDatabaseService graphDb;
private final IndexService index;

public RandomWalker() {

v1 = new ConcurrentHashMapString, Double(); // feature vector 
1
v2 = new ConcurrentHashMapString, Double(); // feature vector 
2

  

[Neo4j] Tuning Neo4j DB

2010-05-25 Thread Amir Hossein Jadidinejad
Hi,
I've created a large 5GB neo4j DB. It runs on a machine with 12GB of memory. Is 
it possible to tune DB in order to utilize memory as much as possible?-better 
performance 
Something like an In-Memory DB.
Kind regards



  
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo] newbie question regarding compatibility with other Java network analysis libraries

2010-04-13 Thread Amir Hossein Jadidinejad
Hi,
As I know, Neo4j is an efficient Graph Storage. So visualization, analysis 
algorithms,... have to be implemented (some of them are already exist) 
separately and they are not related to the core component of Neo4j.
Regards,
Amir 

--- On Mon, 4/12/10, Larry White ljw1...@gmail.com wrote:

From: Larry White ljw1...@gmail.com
Subject: [Neo] newbie question regarding compatibility with other Java network 
analysis libraries
To: user@lists.neo4j.org
Date: Monday, April 12, 2010, 10:28 PM

Hi,
Sorry if this has been asked and re-asked, but i couldn't find a convenient
way to search the archives.  I have a couple questions but I'll ask them
separately.

Is the db's model of networks compatible with any of the java open source
network analysis and visualization libraries - or would I have to transform
the network in order to do any visualization, etc. I know there's an
analysis package that comes with the db, but some of the other open source
tools seem especially powerful.
___
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] Graph analysis algorithms-Gremlin

2010-04-13 Thread Amir Hossein Jadidinejad
Hi,
I've created a small version of the web graph. I'm going to apply different 
graph algorithms (components, paths, distances,...) to know this graph better 
and better for future investigations. It seems that I have two options:
1. Using the graph algorithm package: 
http://components.neo4j.org/neo4j-graph-algo/
2. Using the Gremlin and leverage the algorithms of different graph libraries: 
http://wiki.github.com/tinkerpop/gremlin/working-with-jung-algorithms -

I don't have complete information about the last option. Would you please 
familiar us with it?
Let me know if there are any other option (or library other than JUNG) for this 
purpose.
Kind regards,
Amir



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


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

[Neo] Node not found using BatchInserter

2010-03-31 Thread Amir Hossein Jadidinejad
Hi,
Check the following code:
            for (IteratorLong rel_itr = 
inserter.getRelationshipIds(current_node).iterator(); rel_itr.hasNext();) {
                long neighbor = rel_itr.next();
                if (neighbor != current_node  neighbor != -1) {
                    try {
exist_neighbors.add(inserter.getNodeProperties(neighbor).get(cui).toString());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }

After running, I have a lot of this error:
org.neo4j.graphdb.NotFoundException: id=3225225
    at 
org.neo4j.kernel.impl.batchinsert.BatchInserterImpl.getNodeRecord(BatchInserterImpl.java:517)
    at 
org.neo4j.kernel.impl.batchinsert.BatchInserterImpl.getNodeProperties(BatchInserterImpl.java:238)
    at org.qiau.wnng.build.BuildGraph.addAllNodes(BuildGraph.java:220)
    at org.qiau.wnng.build.BuildGraph.main(BuildGraph.java:288)

Is it possible that a neighbor node not found while getRelationshipIds method 
return it?!



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


[Neo] transaction concept

2010-03-30 Thread Amir Hossein Jadidinejad
Hi,
I just want to sure about transactions. 
Before the transaction's success (commit), I have a loop that first check the 
relations of each node and then add new relations for each node of the graph. 
Is it possible that when checking the existence of a relation, it's not shown 
because its transaction does not committed?
Or transaction success (commit) means that the effect of this transaction is 
successfully reflect to disk?
Thanks.



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


[Neo] JavaDoc for BatchInserter

2010-03-30 Thread Amir Hossein Jadidinejad
How can I find JavaDoc for BatchInserter?!
It's not available in the doc folder of apoc or kernel component.




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


[Neo] previous relations doesn't overwrite

2010-03-29 Thread Amir Hossein Jadidinejad
Hi,
I'm going to load a huge graph. After playing with some test cases, I found 
that when a new relationship add to the graph, it does not overwrite the 
previous relation and when printing the relationships, redundant items are in 
the output. I don't want such a redundant items! f.ex. suppose the following 
code:
            Node alex = index.getSingleNode(name, alex);
            for(Relationship r: alex.getRelationships())
                System.out.println(r.getEndNode().getId());
Here is the output:
1
1
1
1
2

It seems that I have to check the current relationships before any update, 
Isn't it?
Amir



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


[Neo] Using subreference nodes

2010-03-28 Thread Amir Hossein Jadidinejad
Hi,
Is it necessary to using subreference nodes?
It exists in the util component. Is a jar file available for download?
Thanks.



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


Re: [Neo] How to cite Neo4j?

2010-03-14 Thread Amir Hossein Jadidinejad
Thanks.
I was looking for n ac academic paper about Neo4j. It seems that I have to cite 
its online we site.
Kind regards,
Amir

--- On Sun, 3/14/10, Peter Neubauer neubauer.pe...@gmail.com wrote:

From: Peter Neubauer neubauer.pe...@gmail.com
Subject: Re: [Neo] How to cite Neo4j?
To: Neo user discussions user@lists.neo4j.org
Date: Sunday, March 14, 2010, 3:02 PM

Amir,
we have collected some of the sources we know of here:
http://wiki.neo4j.org/content/External_Articles . If you find more,
please let us know and feel free to add to the wiki, even your own
work :)

Does that help?

Cheers,

/peter neubauer

COO and Sales, Neo Technology

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

http://www.neo4j.org             - Your high performance graph database.
http://www.tinkerpop.com      - Processing for Internet-scale graphs.
http://www.thoughtmade.com - Scandinavias coolest Bring-a-Thing party.



On Fri, Mar 12, 2010 at 9:46 PM, Amir Hossein Jadidinejad
amir.jad...@yahoo.com wrote:
 Hi,
 I'm using Neo4j in my research thesis as a great data store. How can I cite 
 it?, I can't find any research paper that represent Neo4j. If one available, 
 let me know.
 Kind regards,
 Amir




 ___
 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-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] How to cite Neo4j?

2010-03-12 Thread Amir Hossein Jadidinejad
Hi,
I'm using Neo4j in my research thesis as a great data store. How can I cite 
it?, I can't find any research paper that represent Neo4j. If one available, 
let me know.
Kind regards,
Amir



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


[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 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 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


[Neo] Using Neoclipse

2010-03-04 Thread Amir Hossein Jadidinejad
Hi,
I'm checking getting started guide, it's great. Currently, I want to visualise 
my graph db using Neoclipse. After the installation using the update site, I 
have Neo4j perspective in my Eclipse IDE, but I don't know how to visualise my 
graph?!
Kind regards,
Amir




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


[Neo] Undirected relationships

2010-03-04 Thread Amir Hossein Jadidinejad
Hi,
I'm going to setup a Nearest Neighbour Graph. Its relations are not directed. 
How to define undirected relationships in Neo4j?
By the way, I'm confused with relations! check the following codes to create a 
simple graph:
        GraphDatabaseService graphDb = new EmbeddedGraphDatabase(var);

        IndexService index = new LuceneIndexService(graphDb);

        Transaction tx = graphDb.beginTx();
        try {
            Node andy = graphDb.createNode();
            Node larry = graphDb.createNode();

            andy.setProperty(name, Andy Wachowski);
            index.index(andy, name, andy.getProperty(name));

            larry.setProperty(name, Larry Wachowski);
            index.index(larry, name, larry.getProperty(name));

            andy.createRelationshipTo(larry, MyRelationshipTypes.KNOWS);

            tx.success();

        } finally {
            tx.finish();
            index.shutdown();
            graphDb.shutdown();
        }

This is a simple relations from andy to larry. When I print the neighbours 
of larry by the following codes:
            Node a = index.getSingleNode(name, Larry Wachowski);
            System.out.println(Relations:);
            for(Relationship r: a.getRelationships())
                System.out.println(r.getEndNode().getProperty(name));

The output is:
Relations:
Larry Wachowski

It means that larry is related to himself! why?
Kind regards,
Amir



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


[Neo] Graph Visualization

2010-01-23 Thread Amir Hossein Jadidinejad
Hi,
What's the best way to visualize some part of a graph in Neo4j Graph DB?
Albeit I can create an online instance and pass it to third-party visualizer, 
but:
1. Is it an straight forward (embedded) visualizer available?
2. If NO, which third-party graph visualizer do you prefer?
Thanks and kind regards,
Amir



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


Re: [Neo] Which version of Neo4j?!

2009-07-18 Thread Amir Hossein Jadidinejad
Dear Andreas,
Excuse me, I thought that there is an integration problem between b8 and b9 
versions!, If not, for the time being I prefer stable version to produce my 
graph.
My project is a mined ontology from the WEB that contains 2M concepts and 16M 
relations (weighted-undirected). 
Approximately, how long does it take to complete? (add all nodes and 
relations)Do you have any consideration or offers to better maintenance of such 
a huge graph?Also, I need to find a node and get all neighbors as a weighted 
list for follow-up works. So it's important for this graph to handle such 
requests efficiently.
Thank you and kind regards,
Amir

--- On Sat, 7/18/09, Andreas Kollegger akolleg...@tembopublic.org wrote:

From: Andreas Kollegger akolleg...@tembopublic.org
Subject: Re: [Neo] Which version of Neo4j?!
To: Neo user discussions user@lists.neo4j.org
Date: Saturday, July 18, 2009, 8:07 AM

Hi Amir,

The usual trade-offs apply: neo4j-b8 is stable and should be used for  
production code; neo4j-b9 snapshots are where the latest bugfixes and  
improvements appear, but the changes can lead to uncertainty.  
Personally, I prefer developing against trunk for any project, picking  
a stable build when my own projects enter the final integration phase  
for a milestone release. What's your timeframe like?

I don't think there are any compatibility concerns for the graph data  
itself when moving from b8 to b9, which would probably be the bigger  
concern for you. Core developers, am I right to think that?

Best,
Andreas

On Jul 18, 2009, at 4:14 AM, Amir Hossein Jadidinejad wrote:

 Hi,
 I'm going to develop a huge graph database with Neo4j that take a  
 long time to complete and so I can't reproduce it again!
 There are two version is available: the standard neo4j-b8 and the  
 snapshot version depending on neo4j-b9.
 What's the difference?, Which one you prefer?
 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