[Neo4j] Batch URIs

2011-11-29 Thread Nigel Small
Following on from the relative URI work that Jim is looking at, I was
wondering if there was any way that the entity URIs used for RESTful batch
requests could be made more discoverable or elegantly derivable? Currently
the only way I'm aware of to calculate a relative node URI, for example, is
to hack around parts of the full URI:

self._relative_uri = .join(self._uri.partition(/node)[1:])

Basically here I'm looking for the substring /node within the full URI
and taking everything from that point onwards as the relative part which I
use to inject into a batch payload. This is obviously somewhat dependent on
this hardcoded part never changing and doesn't feel particularly like the
most elegant way to achieve this.

Thoughts welcomed!

*Nigel Small*
Phone: +44 7814 638 246
Blog: http://nigelsmall.name/
GTalk: ni...@nigelsmall.name
MSN: nasm...@live.co.uk
Skype: technige
Twitter: @technige https://twitter.com/#%21/technige
LinkedIn: http://uk.linkedin.com/in/nigelsmall
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Batch URIs

2011-11-29 Thread Jacob Hansson
On Tue, Nov 29, 2011 at 9:28 AM, Nigel Small ni...@nigelsmall.name wrote:

 Following on from the relative URI work that Jim is looking at, I was
 wondering if there was any way that the entity URIs used for RESTful batch
 requests could be made more discoverable or elegantly derivable? Currently
 the only way I'm aware of to calculate a relative node URI, for example, is
 to hack around parts of the full URI:

 self._relative_uri = .join(self._uri.partition(/node)[1:])

 Basically here I'm looking for the substring /node within the full URI
 and taking everything from that point onwards as the relative part which I
 use to inject into a batch payload. This is obviously somewhat dependent on
 this hardcoded part never changing and doesn't feel particularly like the
 most elegant way to achieve this.

 Thoughts welcomed!


Yeah, I think you mentioned this in the discussion on that ticket as well,
so this has been in my head a bit..

The thinking I had when writing the batch API was that URLs should be
relative as a means of forcing requests to stay inside the /db/data
resource. The reason for that is the transactionality of the batch API. The
idea is that the db part of /db/data at some future point will allow
pointing to other databases inside the same server (e.g. /myfirstdb/data
/myotherdb/data), and the transactionality of the batch API would only
apply within one database.

I do agree that it is an unelegant solution tho.. Perhaps we should allow
full URLs (or at least full paths), and instead throw a securityexception
or something if you don't include the /db/data path.

/jake



 *Nigel Small*
 Phone: +44 7814 638 246
 Blog: http://nigelsmall.name/
 GTalk: ni...@nigelsmall.name
 MSN: nasm...@live.co.uk
 Skype: technige
 Twitter: @technige https://twitter.com/#%21/technige
 LinkedIn: http://uk.linkedin.com/in/nigelsmall
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user




-- 
Jacob Hansson
Phone: +46 (0) 763503395
Twitter: @jakewins
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user