/index/node/indexName?unique will create a node if and only if the key/value posted is not already in the index. if it is in the index nothing is done (not even update of the properties). so in order to update the properties another call needs to be made to update that node.
is this a correct understanding of this?
will there be additional interfaces for handling uniqueness in 1.7, such as insertOrUpdate?
thanks
Cheers,
/peter neubauer
G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer
Neo4j 1.6 released - dzone.com/6S4K
The Neo4j Heroku Challenge - http://neo4j-challenge.herokuapp.com/
Cheers,
/peter neubauer
G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer
Neo4j 1.6 released - dzone.com/6S4K
The Neo4j Heroku Challenge - http://neo4j-challenge.herokuapp.com/
http://localhost:7474/db/data/index/node/people?unique
{
"key"
:
"name"
,
"value"
:
"Tobias"
,
"properties"
: {
"name"
:
"Tobias"
,
"sequence"
: 1}}
could be changed to
http://localhost:7474/db/data/index/node/unique
{
"indexes": [ {"index":"indexName1", "key"
:
"uid"
,
"value"
:
"Tobias"},
{"index":"indexName2", "key"
:
"email"
,
"value"
:
"Tob...@mail.com"}
, ... ] ,
"properties"
: {
"name"
:
"Tobias"
,
"sequence"
: 1}}
and this would create a new node if and only if the key/value pairs where not found all of the indexes. The above request InsertOrUpdate would be a little more complicated because you would have to verify that all found name/value pairs pointed to the same node before doing an update, but otherwise it should do insert/update.
does that sound correct to you?
http://localhost:7474/db/data/index/node/people?unique
{
"key"
:
"combined"
,
"value"
:
"Tobias-
Tob...@mail.com"
,
"properties"
: {
"name"
:
"Tobias"
, "email":
"Tob...@mail.com", "sequence"
: 1}}
Cheers,
/peter neubauer
G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer
Neo4j 1.6 released - dzone.com/6S4K
The Neo4j Heroku Challenge - http://neo4j-challenge.herokuapp.com/
http://localhost:7474/db/data/index/node/unique
{
"indexes": [ {"index":"indexName1", "key"
:
"uid"
,
"value"
:
"Tobias"},
{"index":"indexName2", "key"
:
"email"
,
"value"
:
"Tob...@mail.com"}
, ... ] ,
"properties"
: {
"name"
:
"Tobias"
,
"sequence"
: 1}}
would only be for unique indexes because wouldn't this call only be use for unique indexes regardless of how many index/key/value pairs were passed to it?
http://localhost:7474/db/data/index/node/unique
{
"indexes": [ {"index":"indexName1", "key"
:
"uid"
,
"value"
:
"Tobias"},
{"index":"indexName2", "key"
:
"email"
,
"value"
:
"Tob...@mail.com"}
, ... ] ,
"properties"
: {
"name"
:
"Tobias"
,
"sequence"
: 1}
,
"uri"
:
"http://localhost:7474/db/data/node/116"
}