Re: [Neo] Traverser node return process

2010-04-29 Thread Mattias Persson
the problem you see is GC trashing, the most CPU time is spent running
GC since most of the heap is occupied by objects. A traverser keeps
track of which nodes it has visited and for a big traversal that can
be a problem. A better solution for you here would be to call:

   startNode.getRelationships

directly instead since iterating over relationships like that doesn't
keep such memory.

We also just created a new traversal framework which deals with this
issue, among other things.

2010/4/29, Bhuvan :
> Hello,
>
> We are trying to explore Neo4j for a huge number of graph nodes and
> relations.
> Let's say there are about 6 million users across the world and 6 million
> user address elements like postal-code/city/state/country etc.
> Now I am trying to get all users in a given country which has about 3
> million users. What I found is that traverser returned about 0.6 million
> nodes quickly and thereafter it slows down as shown below:
> --
>  INFO  [2010-04-28 20:15:13,082] [test.TraversalTest] - Starting...
>  INFO  [2010-04-28 20:15:39,030] [test.TraversalTest] – 100,000
>  INFO  [2010-04-28 20:15:41,734] [test.TraversalTest] – 200,000
>  INFO  [2010-04-28 20:15:44,022] [test.TraversalTest] – 300,000
>  INFO  [2010-04-28 20:15:51,353] [test.TraversalTest] – 400,000
>  INFO  [2010-04-28 20:15:53,433] [test.TraversalTest] – 500,000
>  INFO  [2010-04-28 20:15:55,721] [test.TraversalTest] – 600,000
>
>  INFO  [2010-04-28 20:20:54,433] [test.TraversalTest] – 700,000
>  INFO  [2010-04-28 20:25:32,407] [test.TraversalTest] – 800,000
>  INFO  [2010-04-28 20:30:33,274] [test.TraversalTest] – 900,000
>  INFO  [2010-04-28 20:35:26,405] [test.TraversalTest] – 1,000,000
>  INFO  [2010-04-28 20:39:17,099] [test.TraversalTest] – 1,100,000
>  INFO  [2010-04-28 20:42:52,856] [test.TraversalTest] – 1,200,000
>  INFO  [2010-04-28 20:46:57,318] [test.TraversalTest] – 1,300,000
>  INFO  [2010-04-28 20:50:58,397] [test.TraversalTest] – 1,400,000
>  INFO  [2010-04-28 20:54:53,570] [test.TraversalTest] – 1,500,000
> --
> The number in the last of line above shows the returned node count after
> every 100,000 nodes which is printed in the for-loop.
> I used following traverser:
>
> Traverser traverser = startNode.traverse(Traverser.Order.BREADTH_FIRST,
> StopEvaluator.DEPTH_ONE,
> ReturnableEvaluator.ALL_BUT_START_NODE,
> TestRelationshipType.HAS_COUNTRY,
> Direction.INCOMING);
>
> where startNode above is country node to which users are related with
> HAS_COUNTRY relation.
>
> My question is why it slows down in returning nodes after a while and if
> there is something which can be done to avoid it?
>
> Thanks
> Bhuvan
>
>
> ___
> Neo mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>


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


[Neo] Traverser node return process

2010-04-29 Thread Bhuvan
Hello,

We are trying to explore Neo4j for a huge number of graph nodes and relations.
Let's say there are about 6 million users across the world and 6 million user 
address elements like postal-code/city/state/country etc.
Now I am trying to get all users in a given country which has about 3 million 
users. What I found is that traverser returned about 0.6 million nodes quickly 
and thereafter it slows down as shown below:
--
 INFO  [2010-04-28 20:15:13,082] [test.TraversalTest] - Starting...
 INFO  [2010-04-28 20:15:39,030] [test.TraversalTest] – 100,000
 INFO  [2010-04-28 20:15:41,734] [test.TraversalTest] – 200,000
 INFO  [2010-04-28 20:15:44,022] [test.TraversalTest] – 300,000
 INFO  [2010-04-28 20:15:51,353] [test.TraversalTest] – 400,000
 INFO  [2010-04-28 20:15:53,433] [test.TraversalTest] – 500,000
 INFO  [2010-04-28 20:15:55,721] [test.TraversalTest] – 600,000

 INFO  [2010-04-28 20:20:54,433] [test.TraversalTest] – 700,000
 INFO  [2010-04-28 20:25:32,407] [test.TraversalTest] – 800,000
 INFO  [2010-04-28 20:30:33,274] [test.TraversalTest] – 900,000
 INFO  [2010-04-28 20:35:26,405] [test.TraversalTest] – 1,000,000
 INFO  [2010-04-28 20:39:17,099] [test.TraversalTest] – 1,100,000
 INFO  [2010-04-28 20:42:52,856] [test.TraversalTest] – 1,200,000
 INFO  [2010-04-28 20:46:57,318] [test.TraversalTest] – 1,300,000
 INFO  [2010-04-28 20:50:58,397] [test.TraversalTest] – 1,400,000
 INFO  [2010-04-28 20:54:53,570] [test.TraversalTest] – 1,500,000
--
The number in the last of line above shows the returned node count after every 
100,000 nodes which is printed in the for-loop.
I used following traverser:

Traverser traverser = startNode.traverse(Traverser.Order.BREADTH_FIRST,
StopEvaluator.DEPTH_ONE,
ReturnableEvaluator.ALL_BUT_START_NODE,
TestRelationshipType.HAS_COUNTRY, Direction.INCOMING);

where startNode above is country node to which users are related with 
HAS_COUNTRY relation.

My question is why it slows down in returning nodes after a while and if there 
is something which can be done to avoid it?

Thanks
Bhuvan


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


[Neo] IndexBatchInserter can't read an index

2010-04-29 Thread Jon Noronha
I have a database with around 7 million nodes, all of them indexed using the
LuceneIndexBatchInserter. I've confirmed that the indexing works by using
neo4j.py and Neoclipse -- the information is all there.

I'm now trying to write a separate script for adding all the relationships
between these nodes. Every node is indexed by a title, which is just a
string like "Dogs". Because there are around 80 million relationships, I'd
like to add these using the BatchInserter. My problem is that the
IndexBatchInserter can't seem to read my title index.

To see what was going on, I created two very simple files. The following
code DOES work:

GraphDatabaseService graphDb = new EmbeddedGraphDatabase(
"/mnt/root/database/" );
IndexService index = new LuceneIndexService( graphDb );
Transaction tx = graphDb.beginTx();
try
{
Node a = index.getSingleNode("title",args[0]);
System.out.println("" + a);
tx.success();
}
finally
{
tx.finish();
index.shutdown();
graphDb.shutdown();
}

This returns the correct node id. But this code does NOT work:

BatchInserter inserter = new BatchInserterImpl("/mnt/root/database/",
BatchInserterImpl.loadProperties("neo4j.props"));
LuceneIndexBatchInserter indexService = new LuceneIndexBatchInserterImpl(
inserter );
long a = indexService.getSingleNode("title",args[0]);
System.out.println("" + a);
indexService.shutdown();
inserter.shutdown();

Is this a feature or a bug? All of the examples suggest that it's possible
to read from the LuceneIndexBatchInserter, and indeed if I combine the code
that creates the nodes and the index with the code that reads it into one
file everything works perfectly. It's only in separating the files that this
problem occurs.

Appreciate your help,
Jon
___
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo] neo4j commons

2010-04-29 Thread Anders Nawroth
Hi!

Commons is included in the Neo4j kernel since the latest snapshots:
http://m2.neo4j.org/org/neo4j/neo4j-kernel/1.1-SNAPSHOT/

For the 1.0 release, download packages of commons are located here:
http://m2.neo4j.org/org/neo4j/neo4j-commons/1.0/


/anders

Kiss Miklós wrote:
> Hello,
> 
> I'm trying to make neo4j database up and running with basic indexing 
> service in java. Everything works fine except for the indexing: I can't 
> find the org.neo4j.commons package. The link on neo4j's web page is broken:
> 
> https://svn.neo4j.org/components/commons/trunk/
> 
> Where can I download the commons package?
> 
> Thanks in advance,
> Miklós Kiss
> ___
> 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] neo4j commons

2010-04-29 Thread Kiss Miklós
Hello,

I'm trying to make neo4j database up and running with basic indexing 
service in java. Everything works fine except for the indexing: I can't 
find the org.neo4j.commons package. The link on neo4j's web page is broken:

https://svn.neo4j.org/components/commons/trunk/

Where can I download the commons package?

Thanks in advance,
Miklós Kiss
___
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo] NetworkDiameter class/calculation

2010-04-29 Thread Alex Averbuch
Hey,
Is there any example code on how to use the NetworkDiameter class?

The use case is an unweighted graph where all edge types should be
considered.

Problems I'm having:

   - How do I consider more than 2 edge types?
   - Which node should the startNode be? Is the Reference node alright?
   - How do I define the nodeSet? I would like diameter of the entire graph,
   not of any subgraph/connected component.

My first attempt at setting this up is below but it's obviously not working.
Would be really cool if someone could either give me a sample code snippet,
or point me in the right direction.

Cheers!
Alex

PS, The reason I need this is I'll be using the Diameter value to construct
meaningful simulated access patterns.



CostEvaluator costEval = new CostEvaluator() {

@Override
public Integer getCost(Relationship relationship, boolean backwards) {
return 1;
}
};

CostAccumulator costAcc = new CostAccumulator() {

@Override
public Integer addCosts(Integer c1, Integer c2) {
return c1 + c2;
}
};

Comparator costComp = new Comparator() {

@Override
public int compare(Integer arg0, Integer arg1) {
if (arg0 > arg1)
return -1;
if (arg0 < arg1)
return 1;
return 0;
}
};

Node startNode = graphDb.getReferenceNode();
Integer startCost = 0;
SingleSourceShortestPathDijkstra singleSourceShortestPath = new
SingleSourceShortestPathDijkstra(
startCost, startNode, costEval, costAcc, costComp, Direction.BOTH,
RelationshipExpander.forTypes(GISRelationshipTypes.FOOT_WAY,
Direction.BOTH, GISRelationshipTypes.BICYCLE_WAY,
Direction.BOTH, GISRelationshipTypes.CAR_WAY,
Direction.BOTH, GISRelationshipTypes.CAR_SHORTEST_WAY,
Direction.BOTH));

Integer zeroValue = 0;

Set nodeSet = graphDb.getAllNodes();

NetworkDiameter networkDiameter = new NetworkDiameter(
singleSourceShortestPath, zeroValue, nodeSet, costComp);
___
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo] Event framework has landed

2010-04-29 Thread Atle Prange
No, its just an index/key-value store with no
transactional capabilities other than when no exception is being thrown, the
index is updated.

Any tx handling must be impemented on top.

On Thu, Apr 29, 2010 at 2:35 PM, Tobias Ivarsson <
tobias.ivars...@neotechnology.com> wrote:

> On Thu, Apr 29, 2010 at 2:19 PM, Atle Prange 
> wrote:
> >
> > BTW.: I wrote a new IndexService using BabuDB [1]. BabuDB is really fast,
> > but does not work for fulltext query. For now the IndexService is
> embedded
> > in the Object-graph mapper i wrote [2]. Anyone is free to check it out,
> if
> > it looks interesting it could be moved to a neo4j subproject.
> >
> >
> Nice. Does BaduDB expose an XAResource? that would make it a whole lot
> easier to integrate with the transaction system of Neo4j.
>
> --
> Tobias Ivarsson 
> Hacker, Neo Technology
> www.neotechnology.com
> Cellphone: +46 706 534857
> ___
> 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] Event framework has landed

2010-04-29 Thread Tobias Ivarsson
On Thu, Apr 29, 2010 at 2:19 PM, Atle Prange  wrote:
>
> BTW.: I wrote a new IndexService using BabuDB [1]. BabuDB is really fast,
> but does not work for fulltext query. For now the IndexService is embedded
> in the Object-graph mapper i wrote [2]. Anyone is free to check it out, if
> it looks interesting it could be moved to a neo4j subproject.
>
>
Nice. Does BaduDB expose an XAResource? that would make it a whole lot
easier to integrate with the transaction system of Neo4j.

-- 
Tobias Ivarsson 
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
___
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo] Event framework has landed

2010-04-29 Thread Atle Prange
I am using the event framework to auto-index nodes based on a special name i
give the properties: Whenever i want a property to be indexed, i append
:index= to the property-name. On afterCommit() i check all changed
properties, and re-index the values that have changed. Really simple and
smooth, the framework makes it really easy.

BTW.: I wrote a new IndexService using BabuDB [1]. BabuDB is really fast,
but does not work for fulltext query. For now the IndexService is embedded
in the Object-graph mapper i wrote [2]. Anyone is free to check it out, if
it looks interesting it could be moved to a neo4j subproject.

-atle


[1] http://code.google.com/p/babudb/
[2] http://ogrm.org


On Thu, Apr 29, 2010 at 2:08 PM, Atle Prange  wrote:

> Fixed, nice :)
>
> atle
>
>
> On Thu, Apr 29, 2010 at 12:16 PM, Mattias Persson <
> matt...@neotechnology.com> wrote:
>
>> Oo, wait a minute... I saw the problem. Try again with the latest code
>> (just
>> committed)!
>>
>> 2010/4/29 Atle Prange 
>>
>> > Really nice, but it seems that afterCommit() never receives any data,
>> the
>> > TransactionData argument is always null..
>> >
>> > On Tue, Apr 27, 2010 at 10:15 AM, Mattias Persson <
>> > matt...@neotechnology.com
>> > > wrote:
>> >
>> > > Hi everyone!
>> > >
>> > > I'm quite pleased to announce that the new event framework has been
>> > > committed in kernel 1.1-SNAPSHOT. After feedback from you guys the
>> > > framework
>> > > got quite small and cosy. Here's a summary.
>> > >
>> > > *TransactionEventHandler*
>> > > can be registered at a GraphDatabaseService and will thereafter
>> recieve
>> > > diffs of modifications made in each transaction before and after they
>> are
>> > > committed. The transaction can still be modified in beforeCommit() and
>> > that
>> > > method can also throw an exception to prevent the transaction from
>> > > committing, causing a TransactionFailureException to be thrown from
>> the
>> > > code
>> > > which is committing the transaction.
>> > >
>> > > *KernelEventHandler*
>> > > can be registered at a GraphDatabaseService and will receive
>> > notifications
>> > > about when a shutdown is about to occur for the GraphhDatabaseService
>> > > instance. It will also receive notifications about "kernel panics"
>> which
>> > is
>> > > a state which the kernel can come to from where it cannot continue
>> > without
>> > > needing to be restarted. An example of such an error would be a hard
>> > drive
>> > > breakdown or when no more space is left on the device the graph
>> database
>> > is
>> > > running on.
>> > >
>> > > The next step is to write an "auto indexer" for the IndexService so
>> that
>> > > that you won't have to do the manual indexService.index( node, key,
>> value
>> > )
>> > > anymore. Another thing would be to remove (deprecate) the
>> > > IndexService#shutdown() method as it no longer would be required.
>> > >
>> > > So it'd be great if you guys would try this out and tell us how it
>> feels.
>> > >
>> > > --
>> > > Mattias Persson, [matt...@neotechnology.com]
>> > > Hacker, Neo Technology
>> > > www.neotechnology.com
>> > > ___
>> > > 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
>> >
>>
>>
>>
>> --
>> Mattias Persson, [matt...@neotechnology.com]
>> Hacker, Neo Technology
>> www.neotechnology.com
>> ___
>> 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] Event framework has landed

2010-04-29 Thread Atle Prange
Fixed, nice :)

atle

On Thu, Apr 29, 2010 at 12:16 PM, Mattias Persson  wrote:

> Oo, wait a minute... I saw the problem. Try again with the latest code
> (just
> committed)!
>
> 2010/4/29 Atle Prange 
>
> > Really nice, but it seems that afterCommit() never receives any data, the
> > TransactionData argument is always null..
> >
> > On Tue, Apr 27, 2010 at 10:15 AM, Mattias Persson <
> > matt...@neotechnology.com
> > > wrote:
> >
> > > Hi everyone!
> > >
> > > I'm quite pleased to announce that the new event framework has been
> > > committed in kernel 1.1-SNAPSHOT. After feedback from you guys the
> > > framework
> > > got quite small and cosy. Here's a summary.
> > >
> > > *TransactionEventHandler*
> > > can be registered at a GraphDatabaseService and will thereafter recieve
> > > diffs of modifications made in each transaction before and after they
> are
> > > committed. The transaction can still be modified in beforeCommit() and
> > that
> > > method can also throw an exception to prevent the transaction from
> > > committing, causing a TransactionFailureException to be thrown from the
> > > code
> > > which is committing the transaction.
> > >
> > > *KernelEventHandler*
> > > can be registered at a GraphDatabaseService and will receive
> > notifications
> > > about when a shutdown is about to occur for the GraphhDatabaseService
> > > instance. It will also receive notifications about "kernel panics"
> which
> > is
> > > a state which the kernel can come to from where it cannot continue
> > without
> > > needing to be restarted. An example of such an error would be a hard
> > drive
> > > breakdown or when no more space is left on the device the graph
> database
> > is
> > > running on.
> > >
> > > The next step is to write an "auto indexer" for the IndexService so
> that
> > > that you won't have to do the manual indexService.index( node, key,
> value
> > )
> > > anymore. Another thing would be to remove (deprecate) the
> > > IndexService#shutdown() method as it no longer would be required.
> > >
> > > So it'd be great if you guys would try this out and tell us how it
> feels.
> > >
> > > --
> > > Mattias Persson, [matt...@neotechnology.com]
> > > Hacker, Neo Technology
> > > www.neotechnology.com
> > > ___
> > > 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
> >
>
>
>
> --
> Mattias Persson, [matt...@neotechnology.com]
> Hacker, Neo Technology
> www.neotechnology.com
> ___
> 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] Event framework has landed

2010-04-29 Thread Mattias Persson
Oo, wait a minute... I saw the problem. Try again with the latest code (just
committed)!

2010/4/29 Atle Prange 

> Really nice, but it seems that afterCommit() never receives any data, the
> TransactionData argument is always null..
>
> On Tue, Apr 27, 2010 at 10:15 AM, Mattias Persson <
> matt...@neotechnology.com
> > wrote:
>
> > Hi everyone!
> >
> > I'm quite pleased to announce that the new event framework has been
> > committed in kernel 1.1-SNAPSHOT. After feedback from you guys the
> > framework
> > got quite small and cosy. Here's a summary.
> >
> > *TransactionEventHandler*
> > can be registered at a GraphDatabaseService and will thereafter recieve
> > diffs of modifications made in each transaction before and after they are
> > committed. The transaction can still be modified in beforeCommit() and
> that
> > method can also throw an exception to prevent the transaction from
> > committing, causing a TransactionFailureException to be thrown from the
> > code
> > which is committing the transaction.
> >
> > *KernelEventHandler*
> > can be registered at a GraphDatabaseService and will receive
> notifications
> > about when a shutdown is about to occur for the GraphhDatabaseService
> > instance. It will also receive notifications about "kernel panics" which
> is
> > a state which the kernel can come to from where it cannot continue
> without
> > needing to be restarted. An example of such an error would be a hard
> drive
> > breakdown or when no more space is left on the device the graph database
> is
> > running on.
> >
> > The next step is to write an "auto indexer" for the IndexService so that
> > that you won't have to do the manual indexService.index( node, key, value
> )
> > anymore. Another thing would be to remove (deprecate) the
> > IndexService#shutdown() method as it no longer would be required.
> >
> > So it'd be great if you guys would try this out and tell us how it feels.
> >
> > --
> > Mattias Persson, [matt...@neotechnology.com]
> > Hacker, Neo Technology
> > www.neotechnology.com
> > ___
> > 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
>



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


Re: [Neo] Event framework has landed

2010-04-29 Thread Mattias Persson
Could you please supply code to reproduce this?

2010/4/29 Atle Prange 

> Really nice, but it seems that afterCommit() never receives any data, the
> TransactionData argument is always null..
>
> On Tue, Apr 27, 2010 at 10:15 AM, Mattias Persson <
> matt...@neotechnology.com
> > wrote:
>
> > Hi everyone!
> >
> > I'm quite pleased to announce that the new event framework has been
> > committed in kernel 1.1-SNAPSHOT. After feedback from you guys the
> > framework
> > got quite small and cosy. Here's a summary.
> >
> > *TransactionEventHandler*
> > can be registered at a GraphDatabaseService and will thereafter recieve
> > diffs of modifications made in each transaction before and after they are
> > committed. The transaction can still be modified in beforeCommit() and
> that
> > method can also throw an exception to prevent the transaction from
> > committing, causing a TransactionFailureException to be thrown from the
> > code
> > which is committing the transaction.
> >
> > *KernelEventHandler*
> > can be registered at a GraphDatabaseService and will receive
> notifications
> > about when a shutdown is about to occur for the GraphhDatabaseService
> > instance. It will also receive notifications about "kernel panics" which
> is
> > a state which the kernel can come to from where it cannot continue
> without
> > needing to be restarted. An example of such an error would be a hard
> drive
> > breakdown or when no more space is left on the device the graph database
> is
> > running on.
> >
> > The next step is to write an "auto indexer" for the IndexService so that
> > that you won't have to do the manual indexService.index( node, key, value
> )
> > anymore. Another thing would be to remove (deprecate) the
> > IndexService#shutdown() method as it no longer would be required.
> >
> > So it'd be great if you guys would try this out and tell us how it feels.
> >
> > --
> > Mattias Persson, [matt...@neotechnology.com]
> > Hacker, Neo Technology
> > www.neotechnology.com
> > ___
> > 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
>



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


Re: [Neo] Event framework has landed

2010-04-29 Thread Atle Prange
Really nice, but it seems that afterCommit() never receives any data, the
TransactionData argument is always null..

On Tue, Apr 27, 2010 at 10:15 AM, Mattias Persson  wrote:

> Hi everyone!
>
> I'm quite pleased to announce that the new event framework has been
> committed in kernel 1.1-SNAPSHOT. After feedback from you guys the
> framework
> got quite small and cosy. Here's a summary.
>
> *TransactionEventHandler*
> can be registered at a GraphDatabaseService and will thereafter recieve
> diffs of modifications made in each transaction before and after they are
> committed. The transaction can still be modified in beforeCommit() and that
> method can also throw an exception to prevent the transaction from
> committing, causing a TransactionFailureException to be thrown from the
> code
> which is committing the transaction.
>
> *KernelEventHandler*
> can be registered at a GraphDatabaseService and will receive notifications
> about when a shutdown is about to occur for the GraphhDatabaseService
> instance. It will also receive notifications about "kernel panics" which is
> a state which the kernel can come to from where it cannot continue without
> needing to be restarted. An example of such an error would be a hard drive
> breakdown or when no more space is left on the device the graph database is
> running on.
>
> The next step is to write an "auto indexer" for the IndexService so that
> that you won't have to do the manual indexService.index( node, key, value )
> anymore. Another thing would be to remove (deprecate) the
> IndexService#shutdown() method as it no longer would be required.
>
> So it'd be great if you guys would try this out and tell us how it feels.
>
> --
> Mattias Persson, [matt...@neotechnology.com]
> Hacker, Neo Technology
> www.neotechnology.com
> ___
> 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] How to define StartNodes and Reference Nodes

2010-04-29 Thread Mattias Persson
I don't really understand you problem, but it sounds like if you have few
collection types you can go with relationship types by different names.
Else, if the number of collections is big you can make use of indexing,
http://components.neo4j.org/neo4j-index/ to index your nodes and get them
directly by name later on, f.ex:

   IndexService index = new LuceneIndexService( graphDb );

   Node startNode = graphDb.createNode();
   Node collectionType1 = graphDb.createNode();
   Node collectionType1_1 = graphDb.createNode();
   Node collectionType1_2 = graphDb.createNode();
   Node collectionType2 = graphDb.createNode();
   Node collectionType2_1 = graphDb.createNode();
   Node collectionType2_2 = graphDb.createNode();

   startNode.createRelationshipTo( collectionType1, myType );
   collectionType1.createRelationshipTo( collectionType1_1, myType );
   collectionType1.createRelationshipTo( collectionType1_2, myType );
   startNode.createRelationshipTo( collectionType2, myType );
   collectionType2.createRelationshipTo( collectionType2_1, myType );
   collectionType2.createRelationshipTo( collectionType2_2, myType );

   index.index( collectionType1, "collection_type", "1" );
   index.index( collectionType1_1, "collection_type", "1_1" );
   index.index( collectionType1_2, "collection_type", "1_2" );
   index.index( collectionType2, "collection_type", "2" );
   index.index( collectionType2_1, "collection_type", "2_1" );
   index.index( collectionType2_2, "collection_type", "2_2" );

   

   Node collectionType2_1 = index.getSingleNode( "collection_type", "2_1" );

2010/4/29 Stefan Berndt 

> Hello I'm familiarizing with Neo4j more and more.
>
> After testing some rudimentary things I'm now trying to write my first
> Neo4j application with the following Graph:
>
> StartNode |->CollectionType1--->CollectionType1_1
>  |   |
>  |   |>CollectionType1_2
>  |
>  |->CollectionType2--->CollectionType2_1
>  |>CollectionType2_2
>
> There are off course more Collections than 2 and the Items of the
> Collections are also more.
>
> Now I want define my Startnode as a really Startnode. and the Nodes
> CollectionType1...CollectionTypeN as reference nodes.
> Off course i can  get this nodes by GraphDataBaseService.getAllNodes() and
> iterate then over the Iterable until i've found my Node. But I dunno the
> Runtime Behavior if my nodespace becomes really big. Is there another Way
> to define this Startnodes or other important Nodes.
> I thank you for your help.
>
> Cheers,
> Stefan
>
> ___
> Neo mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



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


Re: [Neo] How to define StartNodes and Reference Nodes

2010-04-29 Thread Rick Bullotta
Hi, Stefan.

I always define my start nodes connected to the root node via specific  
relationship types. For example,
I might have a collection of people and a collection of cars. I would  
create a new node to be the start node of the people collection, and  
create A relationship from the root node to this new node, of  
relationship type "people".   Then do the same for each other "start  
node".  Then, to quickly find a start node, simply traverse a single  
relationship from the root node.  Hope that makes sense!

Rick Bullotta

, at 3:38 AM, Stefan Berndt  wrote:

> Hello I'm familiarizing with Neo4j more and more.
>
> After testing some rudimentary things I'm now trying to write my first
> Neo4j application with the following Graph:
>
> StartNode |->CollectionType1--->CollectionType1_1
>  |   |
>  |   |>CollectionType1_2
>  |
>  |->CollectionType2--->CollectionType2_1
>  |>CollectionType2_2
>
> There are off course more Collections than 2 and the Items of the
> Collections are also more.
>
> Now I want define my Startnode as a really Startnode. and the Nodes
> CollectionType1...CollectionTypeN as reference nodes.
> Off course i can  get this nodes by GraphDataBaseService.getAllNodes 
> () and
> iterate then over the Iterable until i've found my Node. But I dunno  
> the
> Runtime Behavior if my nodespace becomes really big. Is there  
> another Way
> to define this Startnodes or other important Nodes.
> I thank you for your help.
>
> Cheers,
> Stefan
>
> ___
> 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] How to define StartNodes and Reference Nodes

2010-04-29 Thread Stefan Berndt
Hello I'm familiarizing with Neo4j more and more.

After testing some rudimentary things I'm now trying to write my first
Neo4j application with the following Graph:

StartNode |->CollectionType1--->CollectionType1_1
  |   |
  |   |>CollectionType1_2
  |
  |->CollectionType2--->CollectionType2_1
  |>CollectionType2_2

There are off course more Collections than 2 and the Items of the
Collections are also more. 

Now I want define my Startnode as a really Startnode. and the Nodes
CollectionType1...CollectionTypeN as reference nodes.
Off course i can  get this nodes by GraphDataBaseService.getAllNodes() and
iterate then over the Iterable until i've found my Node. But I dunno the
Runtime Behavior if my nodespace becomes really big. Is there another Way
to define this Startnodes or other important Nodes.
I thank you for your help.

Cheers, 
Stefan

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


Re: [Neo] REST API w/ LuceneFulltextQueryIndexService

2010-04-29 Thread Mattias Persson
So, I've added that functionality now... so if you download the latest
distribution you should be able to do such indexing/queries (on
/index/fulltext-node/.).

Remember to URI-encode your keys and values. So that even if you have a
complex query just encode it and you'd be fine. You example would be:

   GET /index/fulltext-node/mykey/ford~0.8%20AND%20car~0.2%20AND%20be*

2010/4/29 Andrew Nelder 

> That's a tricky question.  I know for my system, I must do some pretty
> weird
> Lucene searches.  (eg. ford~0.8 AND car~0.2 AND be*)
>
> It's tough to say what the best way to implement something like this would
> be.  However, I will keep thinking about it and get back to you with my
> thoughts on the matter.  If you were to publish a working example (sometime
> in the not-to-distant future) of what you were describing below, I would
> also be more than happy to help you flush out the hooks and loops.
>
> Thanks!
> Andrew
>
> On Wed, Apr 28, 2010 at 12:29 PM, Mattias Persson <
> matt...@neotechnology.com
> > wrote:
>
> > We haven't gotten around to exposing it yet... I know that it's a quick
> fix
> > and will try to look at it soon. It would be something like:
> >
> >   POST /index/fulltext-node/foo/bar%20baz(w/ the node URI)
> >   GET /index/fulltext-node/foo/bar
> >
> > Or something... would that be something in the area of how you would
> > imagine
> > it?
> >
> > 2010/4/28 Andrew Nelder 
> >
> > > Is there a way to utilize the REST API with the
> > > LuceneFulltextQueryIndexService?  I've got a major project that depends
> > on
> > > the fuzzy search capabilities of this IndexService.  Thoughts or ideas?
> > >
> > > Cheers,
> > > Andrew Nelder
> > > ___
> > > Neo mailing list
> > > User@lists.neo4j.org
> > > https://lists.neo4j.org/mailman/listinfo/user
> > >
> >
> >
> >
> > --
> > Mattias Persson, [matt...@neotechnology.com]
> > Hacker, Neo Technology
> > www.neotechnology.com
> > ___
> > 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
>



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