On Thu, Oct 6, 2011 at 3:06 AM, noppanit <[email protected]> wrote:
> For the tests you could use, tx.failure() instead of tx.success() to not
> commit anything to the database. And I think the constraints, they need to be
> checked from the application layer?
>
For a mostly-read database design, I have been indexing the unique
fields and then wrapping createNode functionality with index checking.
if newValue.uniqueProperty in INDEX:
return matching node from store
else:
return newly created node
For a read-mostly database, this method is really not seen in
"production". In any case, for a few million records, this is still
pretty fast. I can also disable the index checking for a sort of
bulk-load operation when I know the data are not going to be
duplicated.
I'm a new user, also, so I'd be curious to hear more about what folks
do in practice.
Sean
> -----Original Message-----
> From: "doubleagent [via Neo4j Community Discussions]"
> <[email protected]>
> Date: Wed, 5 Oct 2011 17:13:33
> To: noppanit<[email protected]>
> Subject: Recommended way to enforce constraints?
>
>
>
> I'm using the old matrix example to learn borneo (the Clojure wrapper), and I
> noticed that if I run unit tests neo4j will simply add new nodes to the
> graph, same signature and all, except that the node id is different.
>
> That makes sense - it's just not what I was expecting.
>
> What I would like to be able to do is add constraints to the graph ie nodes
> must have this property, it must be non-null, and it must be unique ...
> composite keys I suppose. How is this done?
>
> As it is, I need to remove the entire graph database directory and start
> fresh before each test.
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://neo4j-community-discussions.438527.n3.nabble.com/Recommended-way-to-enforce-constraints-tp3398407p3398407.html
> To start a new topic under Neo4j Community Discussions, email
> [email protected]
> To unsubscribe from Neo4j Community Discussions, visit
> http://neo4j-community-discussions.438527.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=438527&code=bm9wcGFuaXQuY0BnbWFpbC5jb218NDM4NTI3fDExOTIzNzAyNjk=
>
>
> --
> View this message in context:
> http://neo4j-community-discussions.438527.n3.nabble.com/Recommended-way-to-enforce-constraints-tp3398407p3398919.html
> Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user