Re: [Neo4j] How to copy a complete database?

2011-03-03 Thread Tobias Ivarsson
Yes, the statistics tool almost does that, but with a wider range of
possible encodings.

What would you want from a class like that? Give it a string as input and
have it tell you if it is short or not? Or go through an existing store and
tell you how many of the strings are short?

-tobias

On Thu, Mar 3, 2011 at 5:18 PM, Balazs E. Pataki wrote:

> Hi Tobias,
>
> Do you happen to have some little class which can at tell us which
> property values neo4j would consider short and which of your 6 encoding
> would it use? Maybe the string statistics collecting program you created
> earlier has this logic - but I'm just guessing.
>
> Thanks,
> ---
> balazs
>
> On 3/3/11 11:52 AM, Tobias Ivarsson wrote:
> > No there is no simpler way, yet. We've been thinking about creating a
> "short
> > string compression tool" for accomplishing this, but haven't done so yet.
> >
> > Cheers,
> > Tobias
> >
> > On Thu, Mar 3, 2011 at 11:35 AM, Balazs E. Pataki >wrote:
> >
> >> Hi,
> >>
> >> I have a big database based on Neo4J 1.2. Now, if I would like to use
> >> the "short strings" feature of Neo4j 1.3 M03 I should regenerate my full
> >> database, that is all strings should be reset so that it may or may not
> >> be stored according to the new "short strings" policy.
> >>
> >> It seems to me that the easiest way to do this would be to somehow be
> >> able to copy the full 1.2 database to a newly created 1.3 M03 database
> >> by traversing the 1.2 database. But there maybe a simpler (neo4j
> >> builtin) way to do this. Any hints about this?
> >>
> >> Thanks,
> >> ---
> >> balazs
> >> ___
> >> 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
>



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


Re: [Neo4j] How to copy a complete database?

2011-03-03 Thread Balazs E. Pataki
Hi Tobias,

Do you happen to have some little class which can at tell us which 
property values neo4j would consider short and which of your 6 encoding 
would it use? Maybe the string statistics collecting program you created 
earlier has this logic - but I'm just guessing.

Thanks,
---
balazs

On 3/3/11 11:52 AM, Tobias Ivarsson wrote:
> No there is no simpler way, yet. We've been thinking about creating a "short
> string compression tool" for accomplishing this, but haven't done so yet.
>
> Cheers,
> Tobias
>
> On Thu, Mar 3, 2011 at 11:35 AM, Balazs E. Patakiwrote:
>
>> Hi,
>>
>> I have a big database based on Neo4J 1.2. Now, if I would like to use
>> the "short strings" feature of Neo4j 1.3 M03 I should regenerate my full
>> database, that is all strings should be reset so that it may or may not
>> be stored according to the new "short strings" policy.
>>
>> It seems to me that the easiest way to do this would be to somehow be
>> able to copy the full 1.2 database to a newly created 1.3 M03 database
>> by traversing the 1.2 database. But there maybe a simpler (neo4j
>> builtin) way to do this. Any hints about this?
>>
>> Thanks,
>> ---
>> balazs
>> ___
>> 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] Clear graph (delete all nodes and relations)

2011-03-03 Thread Alfredas Chmieliauskas
On Thu, Mar 3, 2011 at 12:30 PM, Peter Neubauer
 wrote:
> Well,
> reference nodes are not part of the Blueprints API. Neo4j is not
> decided yet how and if to change the reference node approach. Either
> make it a setup option, keep it, or remove it totally.
>
> Marko is coming over in April, so there will be fighting at the Malmö
> office over this :)

Sounds great. Let us know who wins.

... just to be clear -  for now there's no elegant way to
"clear" the graph using blueprints or spring-data-graph api, right?

Thanks,

Alfredas

>
> Cheers,
>
> /peter neubauer
>
> 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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>
>
>
> On Thu, Mar 3, 2011 at 12:12 PM, Alfredas Chmieliauskas
>  wrote:
>> On Wed, Mar 2, 2011 at 12:14 PM, Peter Neubauer
>>  wrote:
>>> Well,
>>> you can set the reference node to anything, so you could do
>>>
>>> graph.delete();
>>> newRoot = neo4j.createNode();
>>> neo4j.setReferenceNode(newRoot);
>>
>> I bet this is the problem: the reference node gets deleted. I one of
>> solving it would be not to delete the ref node at all.
>> The other way is as you have outlined here, I'm just not sure that
>> there's a method setReferenceNode() (at least could not find it).
>>
>> Also - where is Marko? It would be great to have your opinion on whats
>> happening from the point of view of blueprints neo4j impl.
>>
>> Alfredas
>>
>>>
>>> Cheers,
>>>
>>> /peter neubauer
>>>
>>> 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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
>>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>>
>>>
>>>
>>> On Wed, Mar 2, 2011 at 12:10 PM, Craig Taverner  wrote:
 Is this not because blueprints does not respect the neo4j reference node,
 and so deletes it (really clears the graph). Is there a way to create the
 reference node again? Perhaps as simple as db.createNode(), and the first
 will be node 0?

 On Wed, Mar 2, 2011 at 12:08 PM, Peter Neubauer <
 peter.neuba...@neotechnology.com> wrote:

> Mmh,
> have you committed the transaction after your clear, and How are you
> trying to create the Relationship? It seems you are trying to use Node
> 0 for it, which you have deleted before? In that case, you need to add
> a new node and use that as the starting point for your relationship?
>
> Cheers,
>
> /peter neubauer
>
> 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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>
>
>
> On Wed, Mar 2, 2011 at 11:44 AM, Alfredas Chmieliauskas
>  wrote:
> > Dear all,
> >
> > a crazy primitive question. How do I clear a graph (without doing rm -f)
> ?
> > If I delete all the nodes and relationships or use blueprints
> > graph.clear() I get a weird error later when adding new nodes:
> >
> > Caused by: java.lang.IllegalStateException: First node[0] is deleted
> > and cannot be used to create a relationship
> >        at
> org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.relationshipCreate(WriteTransaction.java:1475)
> >        at
> org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaConnection$RelationshipEventConsumerImpl.createRelationship(NeoStoreXaConnection.java:257)
> >        at
> org.neo4j.kernel.impl.nioneo.xa.NioNeoDbPersistenceSource$NioNeoDbResourceConnection.relationshipCreate(NioNeoDbPersistenceSource.java:371)
> >        at
> org.neo4j.kernel.impl.persistence.PersistenceManager.relationshipCreate(PersistenceManager.java:154)
> >        at
> org.neo4j.kernel.impl.core.NodeManager.createRelationship(NodeManager.java:310)
> >        at
> org.neo4j.kernel.impl.core.NodeImpl.createRelationshipTo(NodeImpl.java:388)
> >        at
> org.neo4j.kernel.impl.core.NodeProxy.createRelationshipTo(NodeProxy.java:187)
> >        at
> org.neo4j.util.GraphDatabaseUtil.getOrCreateSingleOtherNode(GraphDatabaseUtil.java:137)
> >        at
> org.neo4j.util.GraphDatabaseUtil.getOrCreateSubReferenceNode(Gra

Re: [Neo4j] How to copy a complete database?

2011-03-03 Thread Craig Taverner
What would be the consequence of running a background thread that iterated
through all nodes and relationships, and if any had a short string property,
it would re-save the property? I assume the properties store would get a lot
of empty space in the beginning, or would old-id reuse kick in and prevent
this?

It seems like something can can be done at application level easily enough.
And if only some fraction of your properties are really short strings, this
should be more efficient than copying the entire database.

On Thu, Mar 3, 2011 at 11:52 AM, Tobias Ivarsson <
tobias.ivars...@neotechnology.com> wrote:

> No there is no simpler way, yet. We've been thinking about creating a
> "short
> string compression tool" for accomplishing this, but haven't done so yet.
>
> Cheers,
> Tobias
>
> On Thu, Mar 3, 2011 at 11:35 AM, Balazs E. Pataki  >wrote:
>
> > Hi,
> >
> > I have a big database based on Neo4J 1.2. Now, if I would like to use
> > the "short strings" feature of Neo4j 1.3 M03 I should regenerate my full
> > database, that is all strings should be reset so that it may or may not
> > be stored according to the new "short strings" policy.
> >
> > It seems to me that the easiest way to do this would be to somehow be
> > able to copy the full 1.2 database to a newly created 1.3 M03 database
> > by traversing the 1.2 database. But there maybe a simpler (neo4j
> > builtin) way to do this. Any hints about this?
> >
> > Thanks,
> > ---
> > balazs
> > ___
> > Neo4j mailing list
> > User@lists.neo4j.org
> > https://lists.neo4j.org/mailman/listinfo/user
> >
>
>
>
> --
> Tobias Ivarsson 
> Hacker, Neo Technology
> www.neotechnology.com
> Cellphone: +46 706 534857
> ___
> 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] How to copy a complete database?

2011-03-03 Thread Alex Averbuch
You could use GraphMigrator from Blueprints:
https://github.com/tinkerpop/blueprints/blob/master/src/main/java/com/tinkerpop/blueprints/pgm/util/graphml/GraphMigrator.java

Check out *testMigratingTinkerGraphExample3()* in this test case for usage:
https://github.com/tinkerpop/blueprints/blob/master/src/test/java/com/tinkerpop/blueprints/pgm/util/graphml/GraphMLReaderTestSuite.java

Basically:
Neo4jGraph oldGraph = new Neo4jGraph(oldDirectory);
Neo4jGraph newGraph = new Neo4jGraph(newDirectory);
GraphMigrator.migrateGraph(oldGraph, newGraph);

On Thu, Mar 3, 2011 at 12:25 PM, Axel Morgner  wrote:

> +1
>
> On 03.03.2011 12:25, Peter Neubauer wrote:
> > Mmh,
> > maybe this could be in some Utilities class? Seems a good thing to be
> > able to clone a graph ...
>
> ___
> 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] Clear graph (delete all nodes and relations)

2011-03-03 Thread Peter Neubauer
Well,
reference nodes are not part of the Blueprints API. Neo4j is not
decided yet how and if to change the reference node approach. Either
make it a setup option, keep it, or remove it totally.

Marko is coming over in April, so there will be fighting at the Malmö
office over this :)

Cheers,

/peter neubauer

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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Thu, Mar 3, 2011 at 12:12 PM, Alfredas Chmieliauskas
 wrote:
> On Wed, Mar 2, 2011 at 12:14 PM, Peter Neubauer
>  wrote:
>> Well,
>> you can set the reference node to anything, so you could do
>>
>> graph.delete();
>> newRoot = neo4j.createNode();
>> neo4j.setReferenceNode(newRoot);
>
> I bet this is the problem: the reference node gets deleted. I one of
> solving it would be not to delete the ref node at all.
> The other way is as you have outlined here, I'm just not sure that
> there's a method setReferenceNode() (at least could not find it).
>
> Also - where is Marko? It would be great to have your opinion on whats
> happening from the point of view of blueprints neo4j impl.
>
> Alfredas
>
>>
>> Cheers,
>>
>> /peter neubauer
>>
>> 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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>
>>
>>
>> On Wed, Mar 2, 2011 at 12:10 PM, Craig Taverner  wrote:
>>> Is this not because blueprints does not respect the neo4j reference node,
>>> and so deletes it (really clears the graph). Is there a way to create the
>>> reference node again? Perhaps as simple as db.createNode(), and the first
>>> will be node 0?
>>>
>>> On Wed, Mar 2, 2011 at 12:08 PM, Peter Neubauer <
>>> peter.neuba...@neotechnology.com> wrote:
>>>
 Mmh,
 have you committed the transaction after your clear, and How are you
 trying to create the Relationship? It seems you are trying to use Node
 0 for it, which you have deleted before? In that case, you need to add
 a new node and use that as the starting point for your relationship?

 Cheers,

 /peter neubauer

 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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
 http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



 On Wed, Mar 2, 2011 at 11:44 AM, Alfredas Chmieliauskas
  wrote:
 > Dear all,
 >
 > a crazy primitive question. How do I clear a graph (without doing rm -f)
 ?
 > If I delete all the nodes and relationships or use blueprints
 > graph.clear() I get a weird error later when adding new nodes:
 >
 > Caused by: java.lang.IllegalStateException: First node[0] is deleted
 > and cannot be used to create a relationship
 >        at
 org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.relationshipCreate(WriteTransaction.java:1475)
 >        at
 org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaConnection$RelationshipEventConsumerImpl.createRelationship(NeoStoreXaConnection.java:257)
 >        at
 org.neo4j.kernel.impl.nioneo.xa.NioNeoDbPersistenceSource$NioNeoDbResourceConnection.relationshipCreate(NioNeoDbPersistenceSource.java:371)
 >        at
 org.neo4j.kernel.impl.persistence.PersistenceManager.relationshipCreate(PersistenceManager.java:154)
 >        at
 org.neo4j.kernel.impl.core.NodeManager.createRelationship(NodeManager.java:310)
 >        at
 org.neo4j.kernel.impl.core.NodeImpl.createRelationshipTo(NodeImpl.java:388)
 >        at
 org.neo4j.kernel.impl.core.NodeProxy.createRelationshipTo(NodeProxy.java:187)
 >        at
 org.neo4j.util.GraphDatabaseUtil.getOrCreateSingleOtherNode(GraphDatabaseUtil.java:137)
 >        at
 org.neo4j.util.GraphDatabaseUtil.getOrCreateSubReferenceNode(GraphDatabaseUtil.java:167)
 >        at
 org.neo4j.util.GraphDatabaseUtil.getOrCreateSubReferenceNode(GraphDatabaseUtil.java:150)
 >        at
 org.springframework.data.graph.neo4j.support.GraphDatabaseContext.getOrCreateSubReferenceNode(GraphDatabaseContext.java:275)
 >        at
 org.springframework.data.graph.neo4j.support.SubReferenceNodeTypeStrategy.o

Re: [Neo4j] How to copy a complete database?

2011-03-03 Thread Axel Morgner
+1

On 03.03.2011 12:25, Peter Neubauer wrote:
> Mmh,
> maybe this could be in some Utilities class? Seems a good thing to be
> able to clone a graph ...

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


Re: [Neo4j] How to copy a complete database?

2011-03-03 Thread Peter Neubauer
Mmh,
maybe this could be in some Utilities class? Seems a good thing to be
able to clone a graph ...

Cheers,

/peter neubauer

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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Thu, Mar 3, 2011 at 12:08 PM, Axel Morgner  wrote:
> Hi Balazs,
>
> you have to manually copy all nodes and relationships from one to the
> other database. I have written a tool for that and posted some code here
> [1].
>
> But take care, in the posted version in [1], relationship properties
> were not copied. To fix that, you have to replace
>
>                s.createRelationshipTo(e, r.getType());
>
> by
>
>                 Relationship newRelationship =
> s.createRelationshipTo(e, r.getType());
>
>                 for (String key : r.getPropertyKeys()) {
> newRelationship.setProperty(key, r.getProperty(key));
>                 }
>
> I hope this is useful for you.
>
> Greetings
>
> Axel
>
> [1] http://lists.neo4j.org/pipermail/user/2010-November/005478.html
>
> On 03.03.2011 11:35, Balazs E. Pataki wrote:
>> Hi,
>>
>> I have a big database based on Neo4J 1.2. Now, if I would like to use
>> the "short strings" feature of Neo4j 1.3 M03 I should regenerate my full
>> database, that is all strings should be reset so that it may or may not
>> be stored according to the new "short strings" policy.
>>
>> It seems to me that the easiest way to do this would be to somehow be
>> able to copy the full 1.2 database to a newly created 1.3 M03 database
>> by traversing the 1.2 database. But there maybe a simpler (neo4j
>> builtin) way to do this. Any hints about this?
>>
>> Thanks,
>> ---
>> balazs
>> ___
>> 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
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] How to copy a complete database?

2011-03-03 Thread Balazs E. Pataki
Thank you all for the replies. I will try Axel's solution.

Regards,
---
balazs

On 3/3/11 12:08 PM, Axel Morgner wrote:
> Hi Balazs,
>
> you have to manually copy all nodes and relationships from one to the
> other database. I have written a tool for that and posted some code here
> [1].
>
> But take care, in the posted version in [1], relationship properties
> were not copied. To fix that, you have to replace
>
>   s.createRelationshipTo(e, r.getType());
>
> by
>
>   Relationship newRelationship =
> s.createRelationshipTo(e, r.getType());
>
>   for (String key : r.getPropertyKeys()) {
> newRelationship.setProperty(key, r.getProperty(key));
>   }
>
> I hope this is useful for you.
>
> Greetings
>
> Axel
>
> [1] http://lists.neo4j.org/pipermail/user/2010-November/005478.html
>
> On 03.03.2011 11:35, Balazs E. Pataki wrote:
>> Hi,
>>
>> I have a big database based on Neo4J 1.2. Now, if I would like to use
>> the "short strings" feature of Neo4j 1.3 M03 I should regenerate my full
>> database, that is all strings should be reset so that it may or may not
>> be stored according to the new "short strings" policy.
>>
>> It seems to me that the easiest way to do this would be to somehow be
>> able to copy the full 1.2 database to a newly created 1.3 M03 database
>> by traversing the 1.2 database. But there maybe a simpler (neo4j
>> builtin) way to do this. Any hints about this?
>>
>> Thanks,
>> ---
>> balazs
>> ___
>> 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
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Clear graph (delete all nodes and relations)

2011-03-03 Thread Alfredas Chmieliauskas
On Wed, Mar 2, 2011 at 12:14 PM, Peter Neubauer
 wrote:
> Well,
> you can set the reference node to anything, so you could do
>
> graph.delete();
> newRoot = neo4j.createNode();
> neo4j.setReferenceNode(newRoot);

I bet this is the problem: the reference node gets deleted. I one of
solving it would be not to delete the ref node at all.
The other way is as you have outlined here, I'm just not sure that
there's a method setReferenceNode() (at least could not find it).

Also - where is Marko? It would be great to have your opinion on whats
happening from the point of view of blueprints neo4j impl.

Alfredas

>
> Cheers,
>
> /peter neubauer
>
> 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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>
>
>
> On Wed, Mar 2, 2011 at 12:10 PM, Craig Taverner  wrote:
>> Is this not because blueprints does not respect the neo4j reference node,
>> and so deletes it (really clears the graph). Is there a way to create the
>> reference node again? Perhaps as simple as db.createNode(), and the first
>> will be node 0?
>>
>> On Wed, Mar 2, 2011 at 12:08 PM, Peter Neubauer <
>> peter.neuba...@neotechnology.com> wrote:
>>
>>> Mmh,
>>> have you committed the transaction after your clear, and How are you
>>> trying to create the Relationship? It seems you are trying to use Node
>>> 0 for it, which you have deleted before? In that case, you need to add
>>> a new node and use that as the starting point for your relationship?
>>>
>>> Cheers,
>>>
>>> /peter neubauer
>>>
>>> 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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
>>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>>
>>>
>>>
>>> On Wed, Mar 2, 2011 at 11:44 AM, Alfredas Chmieliauskas
>>>  wrote:
>>> > Dear all,
>>> >
>>> > a crazy primitive question. How do I clear a graph (without doing rm -f)
>>> ?
>>> > If I delete all the nodes and relationships or use blueprints
>>> > graph.clear() I get a weird error later when adding new nodes:
>>> >
>>> > Caused by: java.lang.IllegalStateException: First node[0] is deleted
>>> > and cannot be used to create a relationship
>>> >        at
>>> org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.relationshipCreate(WriteTransaction.java:1475)
>>> >        at
>>> org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaConnection$RelationshipEventConsumerImpl.createRelationship(NeoStoreXaConnection.java:257)
>>> >        at
>>> org.neo4j.kernel.impl.nioneo.xa.NioNeoDbPersistenceSource$NioNeoDbResourceConnection.relationshipCreate(NioNeoDbPersistenceSource.java:371)
>>> >        at
>>> org.neo4j.kernel.impl.persistence.PersistenceManager.relationshipCreate(PersistenceManager.java:154)
>>> >        at
>>> org.neo4j.kernel.impl.core.NodeManager.createRelationship(NodeManager.java:310)
>>> >        at
>>> org.neo4j.kernel.impl.core.NodeImpl.createRelationshipTo(NodeImpl.java:388)
>>> >        at
>>> org.neo4j.kernel.impl.core.NodeProxy.createRelationshipTo(NodeProxy.java:187)
>>> >        at
>>> org.neo4j.util.GraphDatabaseUtil.getOrCreateSingleOtherNode(GraphDatabaseUtil.java:137)
>>> >        at
>>> org.neo4j.util.GraphDatabaseUtil.getOrCreateSubReferenceNode(GraphDatabaseUtil.java:167)
>>> >        at
>>> org.neo4j.util.GraphDatabaseUtil.getOrCreateSubReferenceNode(GraphDatabaseUtil.java:150)
>>> >        at
>>> org.springframework.data.graph.neo4j.support.GraphDatabaseContext.getOrCreateSubReferenceNode(GraphDatabaseContext.java:275)
>>> >        at
>>> org.springframework.data.graph.neo4j.support.SubReferenceNodeTypeStrategy.obtainSubreferenceNode(SubReferenceNodeTypeStrategy.java:167)
>>> >        at
>>> org.springframework.data.graph.neo4j.support.SubReferenceNodeTypeStrategy.postEntityCreation(SubReferenceNodeTypeStrategy.java:66)
>>> >        at
>>> org.springframework.data.graph.neo4j.support.GraphDatabaseContext.postEntityCreation(GraphDatabaseContext.java:219)
>>> >        at
>>> org.springframework.data.graph.neo4j.fieldaccess.NodeEntityStateAccessors.createAndAssignState(NodeEntityStateAccessors.java:54)
>>> >        at
>>> org.springframework.data.graph.neo4j.fieldaccess.DetachableEntityStateAccessors.createAndAssignState(DetachableEntityStateAccessors.java:113)
>>> >        at
>>> org.springframework.data.graph.neo4j.support.node.Neo4jNodeBacking.ajc$before$org_springframework_data_graph_neo4j_support_node_Neo4jNodeBacking$1$74591ff9(Neo4jNodeBacking.aj:84)
>>> >
>>> > Also I'm u

Re: [Neo4j] How to copy a complete database?

2011-03-03 Thread Axel Morgner
Hi Balazs,

you have to manually copy all nodes and relationships from one to the 
other database. I have written a tool for that and posted some code here 
[1].

But take care, in the posted version in [1], relationship properties 
were not copied. To fix that, you have to replace

s.createRelationshipTo(e, r.getType());

by

 Relationship newRelationship = 
s.createRelationshipTo(e, r.getType());

 for (String key : r.getPropertyKeys()) {
newRelationship.setProperty(key, r.getProperty(key));
 }

I hope this is useful for you.

Greetings

Axel

[1] http://lists.neo4j.org/pipermail/user/2010-November/005478.html

On 03.03.2011 11:35, Balazs E. Pataki wrote:
> Hi,
>
> I have a big database based on Neo4J 1.2. Now, if I would like to use
> the "short strings" feature of Neo4j 1.3 M03 I should regenerate my full
> database, that is all strings should be reset so that it may or may not
> be stored according to the new "short strings" policy.
>
> It seems to me that the easiest way to do this would be to somehow be
> able to copy the full 1.2 database to a newly created 1.3 M03 database
> by traversing the 1.2 database. But there maybe a simpler (neo4j
> builtin) way to do this. Any hints about this?
>
> Thanks,
> ---
> balazs
> ___
> 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] How to copy a complete database?

2011-03-03 Thread Tobias Ivarsson
No there is no simpler way, yet. We've been thinking about creating a "short
string compression tool" for accomplishing this, but haven't done so yet.

Cheers,
Tobias

On Thu, Mar 3, 2011 at 11:35 AM, Balazs E. Pataki wrote:

> Hi,
>
> I have a big database based on Neo4J 1.2. Now, if I would like to use
> the "short strings" feature of Neo4j 1.3 M03 I should regenerate my full
> database, that is all strings should be reset so that it may or may not
> be stored according to the new "short strings" policy.
>
> It seems to me that the easiest way to do this would be to somehow be
> able to copy the full 1.2 database to a newly created 1.3 M03 database
> by traversing the 1.2 database. But there maybe a simpler (neo4j
> builtin) way to do this. Any hints about this?
>
> Thanks,
> ---
> balazs
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



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


Re: [Neo4j] Slow down on insertion as db grow

2011-03-03 Thread Tobias Ivarsson
Hi Massimo,

I'm terribly sorry, I've had a lot of things on my plate, and this sadly
fell off. Thanks for the reminder!

Could you please try lowering the heap size (to somewhere between 512M-1G
with your available RAM). The Neo4j memory mapping is managed outside of the
Java heap. What you want to achieve for ideal performance is to get the
entire nodestore and relationshipstore to fit in the memory mapped file
cache. You might have to tweak the memory mapping settings to make sure that
they are configured to prefer the nodestore and relationship, and have them
fully memory mapped. See documentation here:
http://docs.neo4j.org/chunked/snapshot/configuration-caches.html#_configuration

I didn't see any information on which operating system you are using, so I
assumed linux or some other unix. If you are running on Windows the memory
mapping IS managed in the Java heap, then you should keep your heap settings
at the same size (1.5G) and instead just focus on configuring the memory
mapping so that the nodestore and relationship store are fully memory
mapped.

Cheers,
Tobias

On Thu, Mar 3, 2011 at 11:18 AM, Massimo Lusetti  wrote:

> On Fri, Feb 18, 2011 at 2:31 PM, Tobias Ivarsson
>  wrote:
>
> > WRT the slowdown you've seen, I'll have to investigate that further.
>
> Didn't mean to bother anyone but do you have any news regarding the
> slowdown I'm still experiencing... !?
>
> Cheers
> --
> Massimo
> http://meridio.blogspot.com
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



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


[Neo4j] How to copy a complete database?

2011-03-03 Thread Balazs E. Pataki
Hi,

I have a big database based on Neo4J 1.2. Now, if I would like to use 
the "short strings" feature of Neo4j 1.3 M03 I should regenerate my full 
database, that is all strings should be reset so that it may or may not 
be stored according to the new "short strings" policy.

It seems to me that the easiest way to do this would be to somehow be 
able to copy the full 1.2 database to a newly created 1.3 M03 database 
by traversing the 1.2 database. But there maybe a simpler (neo4j 
builtin) way to do this. Any hints about this?

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


Re: [Neo4j] Slow down on insertion as db grow

2011-03-03 Thread Massimo Lusetti
On Fri, Feb 18, 2011 at 2:31 PM, Tobias Ivarsson
 wrote:

> WRT the slowdown you've seen, I'll have to investigate that further.

Didn't mean to bother anyone but do you have any news regarding the
slowdown I'm still experiencing... !?

Cheers
-- 
Massimo
http://meridio.blogspot.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Release of 1.0.0

2011-03-03 Thread Peter Neubauer
Amazing work Andreas,
the community is truly thankful to both you and all the contributors
and Rubyists out there!

Cheers,

/peter neubauer

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://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Wed, Mar 2, 2011 at 7:58 PM, Andreas Ronge  wrote:
> Hi
>
> Just promoted 1.0.0.beta.32 to version 1.0.0neo4j.rb version 1.0.0
> #neo4j #jruby #rails
> I also have written a blog how to get started with Neo4j/Rails 3
>
> http://blog.jayway.com/2011/03/02/neo4j-rb-1-0-0-and-rails-3/
>
> Thanks a lot for all your feed back and contributions !
>
> /Andreas
>
> --
> You received this message because you are subscribed to the Google Groups 
> "neo4jrb" group.
> To post to this group, send email to neo4...@googlegroups.com.
> To unsubscribe from this group, send email to 
> neo4jrb+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/neo4jrb?hl=en.
>
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] graph coloring

2011-03-03 Thread Craig Taverner
Reading the wikipedia article reminds me of why graph coloring was entirely
*unsuccessful* in solving cellular networks channel assignment problem. Even
though it is an allocation of resources problem, which sounds like it should
suite graph coloring, there are two key differences:

   - The number of resources are fixed (ie. k is constant). Most of the
   theory in graph coloring is about finding the minimum k for a fixed graph,
   which is definitely the wrong problem to solve for fixed resource
   allocation.
   - Edge weights are not considered. I did not fing a single reference to
   edge weighting for vertex coloring problems. Without that consideration, the
   application of graph coloring seems entirely impractical. Even for map
   coloring, two countries could share a large or small border, and that should
   affect the color choices made, but is not considered (as far as I can tell).
   Neither is the difference of the colors. If you have a large color set
   (large k), some colors will be very similar (visually), and this must be
   taken into account.

So much theory, and so impractical :-(

>From what I know, existing cellular channel allocation algorithms use
different approaches. Despite this, I have been thinking of a new algorithm
for this that will use graph theory in two ways, one for identifying loosely
connected cliques (similar to a database partitioning problem), and one for
solving subsets of the resource allocation problem.

It would be nice to have a few graph coloring algorithms in Neo4j to play
with. Are you planning on coding the Sudoku one? :-)

On Wed, Mar 2, 2011 at 10:51 PM, Rick Otten  wrote:

> The proof for the number of colors needed to fill in regions on a planar
> map was solved using graph coloring, so yes, that is what I'm referring
> to.
>
> I was more just thinking about the classic coloring problem of scheduling
> a finite number of resources with minimal conflicts.  A year and a half or
> so ago I got the idea of using Neo4j as project management database.  I
> still think it has a lot of potential even if the market doesn't need any
> more project management tools.  Some project management-type problems
> involve scheduling resources and managing dependencies between activities.
>  Some of those problems might be easily solved using coloring algorithms.
>
> I recall an example from my Graph Theory class (some  20 years ago
> or so), a problem about aligning Ally flight crews, languages, and
> aircrafts they were qualified to work on during WWII operations over
> Europe.  I'm sure these sorts of matching issues come up in practical
> applications often.
>
> I really didn't have anything specific in mind though.
>
>
> FWIW, I saw on Wikipedia just a couple of minutes ago that there is an
> algorithm for solving Sudoku puzzles that uses coloring.  That could make
> a nifty little Neo4j small-graph demo program actually...
>
> https://secure.wikimedia.org/wikipedia/en/wiki/Graph_coloring
>
>
> Thanks for the reply and offer for more help if I need it some day!
>
>
> > Hi Rick,
> >
> > As you say, color is just an integer, so all you need is to index the
> > integer (use lucene, or connect all nodes to a node of the right color).
> >
> > However, since you use the term 'color' I wonder if you are referring to
> > the
> > problem of finding minimal color similarities between related nodes? I
> > mean
> > similar to the problem of coloring adjacent countries on a map with
> > sufficiently different colors to make them visually distinctive. This is
> a
> > well know graph problem, but in some scenarios a 'plain graph' solution
> is
> > not ideal. For example, I deal with mobile network frequency planning,
> > where
> > towers (modeled as nodes) need sufficiently different frequencies as to
> > not
> > interfere with nearby towers (with 'nearby' modeled as weighted
> > relationships). There is no perfect solution, but by modeling a cost
> > weight
> > on the relationships, you can apply an iterative optimization algorithm
> to
> > the graph to find near optimal solutions.
> >
> > If your problem is more like this one, we can discuss it further,
> probably
> > off-list since this is now rather domain specific :-)
> >
> > Regards, Craig
> >
> > On Wed, Mar 2, 2011 at 10:06 PM, Rick Otten  wrote:
> >
> >> There are a number of possible applications for coloring a graph.  I was
> >> poking around in the neo4j documentation, but did not turn up any
> >> examples
> >> or canned routines for this.
> >>
> >> I was imagining finding something like "ColorGraphNodes([color property
> >> name])" which puts a property on each node identifying its color (some
> >> sort of integer) and thus would allow you to then get all nodes of a
> >> similar color.
> >>
> >> Do computer scientists have a different name for a coloring than
> >> mathematicians (ie, am I just looking for the wrong keyword), or is that
> >> something that hasn't really been packaged yet, or maybe it is something
> >>