Re: [Neo4j] Primary Like ID Across Class Types

2011-10-28 Thread Ramon Buckland
Thanks Tatham,

That is helpful. I do recall now the old SQL way was also to operate in
batch selection to reduce locking.
Nice, I'll make changes this weekend.

Regards
Ramon

On Fri, Oct 28, 2011 at 1:45 AM, Tatham Oddie tat...@oddie.com.au wrote:

 Hi Ramon,

 We faced a similar problem on our current project using neo4j.

 Our requirements were:
  * 64-bit integer
  * mostly-sequential
  * custom scopes so we could have URLs like
 /agencies/1/clients/1/addresses/1
  * web farm friendly
   * mostly decentralized
   * no node-specific configuration
  * guaranteed uniqueness

 Having solved all these problems, we released it as an open source library
 called SnowMaker.

 We are working with .NET and Azure, but you might found our approach useful
 nonetheless.

 I have blogged about it at http://l.tath.am/snowmaker

 Of most interest to you will be the explanation towards the end and the
 sequence diagrams.

 HTH!


 -- Tatham


 -Original Message-
 From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org]
 On Behalf Of rbuckland
 Sent: Thursday, 27 October 2011 10:37 PM
 To: user@lists.neo4j.org
 Subject: Re: [Neo4j] Primary Like ID Across Class Types

 I have posted the relevant code online, interested to see what people
 think.
 like - man you just over-engineered that !


 http://rbtech.blogspot.com/2011/10/neo4j-2nd-look-setting-primary-key-on.html


 --
 View this message in context:
 http://neo4j-community-discussions.438527.n3.nabble.com/Primary-Like-ID-Across-Class-Types-tp3457270p3457359.html
 Sent from the Neo4j Community Discussions mailing list archive at
 Nabble.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

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


[Neo4j] Primary Like ID Across Class Types

2011-10-27 Thread rbuckland
Hi, 

I noted in playing with spring-data-neo4j that the Node's under neo4j Don't
have an ID key like typically we would in an RDBMS scenario.

My use case, in short is the application I will be building out will have, a
really simple Web Interface with REST type URLs. So .. for example, I will
be able to do

http://myservice.co.uk/superwebapp/mySpecialThing/detailedView/55

The 55 there will result in a query to Neo4J to locate the MySpecialThing
object with ID of type 55 and display it.

So to ensure I have a per concrete domain POJO, a set ID, I created a
simple ID manager setup.

The thought (for the alpha version) is, that on invoking getId() for the
object, an aspect wrapper around it looks to see if it has an id (if it's
null) and if not, it goes and creates an ID from a singleton bean manager,
which in turn loads from neo4j Or looks into a cache, for an
IdObject(ClassName) which has getNextId() on it.

It's not beautiful but practical. The unit tests work all good.

I considered using a UUID as the ID, but I know you do get to use the
simpler numbers practically more. I did not want to use NodeId as these
are repository wide. 

Any thoughts ? 

My one thought is that the getId() Aspect probably should be on persist() or
somewhere deeper. Such that the id is actually created on storage. (conjures
up needs to check the Id for clashes etc .. ewww).

you will find the post over at 

http://rbtech.blogspot.com with the suitable code.



--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Primary-Like-ID-Across-Class-Types-tp3457270p3457270.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Primary Like ID Across Class Types

2011-10-27 Thread rbuckland
I have posted the relevant code online, interested to see what people think. 
like - man you just over-engineered that ! 

http://rbtech.blogspot.com/2011/10/neo4j-2nd-look-setting-primary-key-on.html


--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Primary-Like-ID-Across-Class-Types-tp3457270p3457359.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Primary Like ID Across Class Types

2011-10-27 Thread Tatham Oddie
Hi Ramon,

We faced a similar problem on our current project using neo4j.

Our requirements were:
 * 64-bit integer
 * mostly-sequential
 * custom scopes so we could have URLs like /agencies/1/clients/1/addresses/1
 * web farm friendly
   * mostly decentralized
   * no node-specific configuration 
 * guaranteed uniqueness

Having solved all these problems, we released it as an open source library 
called SnowMaker.

We are working with .NET and Azure, but you might found our approach useful 
nonetheless.

I have blogged about it at http://l.tath.am/snowmaker

Of most interest to you will be the explanation towards the end and the 
sequence diagrams.

HTH!


-- Tatham


-Original Message-
From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On 
Behalf Of rbuckland
Sent: Thursday, 27 October 2011 10:37 PM
To: user@lists.neo4j.org
Subject: Re: [Neo4j] Primary Like ID Across Class Types

I have posted the relevant code online, interested to see what people think. 
like - man you just over-engineered that ! 

http://rbtech.blogspot.com/2011/10/neo4j-2nd-look-setting-primary-key-on.html


--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Primary-Like-ID-Across-Class-Types-tp3457270p3457359.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.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