Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Batches and uniqueness
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nigel Small  
View profile  
 More options Oct 12 2012, 6:30 am
From: Nigel Small <ni...@nigelsmall.net>
Date: Fri, 12 Oct 2012 11:30:09 +0100
Local: Fri, Oct 12 2012 6:30 am
Subject: Batches and uniqueness

Hi chaps

I've hit a small feature in REST batch submissions which I can't find a way
around. REST batches obviously allow references to items created within the
same batch so that payloads like the following can create a pair of nodes
with a relationship between them:

[
  { "id": 0, "method": "POST", "to": "/node",
    "body": {"name": "Alice"}
  },
  { "id": 1, "method": "POST", "to": "/node",
    "body": {"name": "Bob"}
  },
  { "id": 2, "method": "POST", "to": "{0}/relationships",
    "body": {"type": "KNOWS", "to": "{1}", "data": {"since" : "1999"}}
  }
]

This is fine until I want the nodes to be uniquely indexed. I then try this
instead...

[
  { "id": 0, "method": "POST", "to": "/index/node/People?unique",
    "body": {"key": "name", "value": "Alice", "properties": {"name":
"Alice"}}
  },
  { "id": 1, "method": "POST", "to": "/index/node/People?unique",
    "body": {"key": "name", "value": "Bob", "properties": {"name": "Bob"}}
  },
  { "id": 2, "method": "POST", "to": "{0}/relationships",
    "body": {"type": "KNOWS", "to": "{1}", "data": {"since" : "1999"}}
  }
]

...and receive a BatchOperationFailedException with an empty message. I
have tested the node creation jobs (ids 0 and 1) from this on their own and
they work fine. This indicates that the issue is with the relationship
creation. I'm guessing that the substitutions {0} and {1} are substituting
the "indexed" URI instead of the "self" URI for each of the nodes and so
the URIs generated behind the scenes are invalid. Not sure though,
something else may be going on...

Incidentally, I'm using curl for these tests to make sure the problem isn't
client side. I've also run against the latest milestone and snapshot builds
with similar results.

Help appreciated... I'm kinda stuck with this one :-/

Cheers
Nige


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Neubauer  
View profile  
 More options Oct 18 2012, 10:54 am
From: Peter Neubauer <peter.neuba...@neotechnology.com>
Date: Thu, 18 Oct 2012 16:54:11 +0200
Local: Thurs, Oct 18 2012 10:54 am
Subject: Re: [Neo4j] Batches and uniqueness
Nigel,
yes, you are right. Just recreated that test, and you are getting back

http://localhost:7474/db/data/index/node/People/name/Alice/1

and

http://localhost:7474/db/data/index/node/People/name/Bob/2

So the question is how to handle this. Any suggestions? Should the
node URL be returned or the URI to the indexed entry?

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j 1.8 GA - http://www.dzone.com/links/neo4j_18_release_fluent_graph_literacy.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
kantube  
View profile  
 More options Oct 18 2012, 11:17 am
From: kantube <mich...@mkanner.com>
Date: Thu, 18 Oct 2012 08:17:36 -0700 (PDT)
Local: Thurs, Oct 18 2012 11:17 am
Subject: Re: Batches and uniqueness

peter,

shouldn't you always return the node uri?  what is the pros/cons of each?  
don't all batch commands need to reference the node not the index?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nigel Small  
View profile  
 More options Oct 18 2012, 11:45 am
From: Nigel Small <ni...@nigelsmall.net>
Date: Thu, 18 Oct 2012 16:44:54 +0100
Local: Thurs, Oct 18 2012 11:44 am
Subject: Re: [Neo4j] Re: Batches and uniqueness

My instinct is that it should carry on returning the indexed URI as
currently, not least because it would break existing code if changed, but
also the "indexed" URI is the only way to perform an index entry removal.
One way around it might be to allow the indexed URI to be used as an alias
for the node URI (for certain operations only maybe?) This way you could
have:

/index/node/People/name/Alice/1/relationships

as an alias for

/index/node/1/relationships

and that way all corresponding operations would be mapped.

WDYT? Not 100% sure about this one myself....
Nige

On 18 October 2012 16:17, kantube <mich...@mkanner.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
kantube  
View profile  
 More options Oct 18 2012, 11:57 am
From: kantube <mich...@mkanner.com>
Date: Thu, 18 Oct 2012 08:57:05 -0700 (PDT)
Local: Thurs, Oct 18 2012 11:57 am
Subject: Re: Batches and uniqueness

nigel

good point.  


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Neubauer  
View profile  
 More options Oct 19 2012, 5:53 am
From: Peter Neubauer <peter.neuba...@neotechnology.com>
Date: Fri, 19 Oct 2012 11:52:59 +0200
Local: Fri, Oct 19 2012 5:52 am
Subject: Re: [Neo4j] Re: Batches and uniqueness
Nigel,
I opened https://github.com/neo4j/community/issues/933 to discuss
this, and have an ignored test that we can fix coming in soon, if you
wanna work on this. Good?

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j 1.8 GA - http://www.dzone.com/links/neo4j_18_release_fluent_graph_literacy.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »