Hierarchical collections via REST

Wednesday, 15 December 2010 · 5 messages · last reply 16 Dec 2010
MD
Mahender Didwania15 Dec 2010 13:36 #
Hi, The changelog for 6.3.1 says: [ADD] REST: support for hierarchical collections added; details will follow I am using 6.3.4, but if I send a post request to /server/collection/subcollection, only the collection gets created (and the document is added to collection, not to subcollection). In view of the above, could you please throw more light on how the subcollections can be created using REST and how documents can be added to subcollections using REST? Thanks, Mahender
CG
Christian Grün15 Dec 2010 17:26 #
Quoted text · Mahender Didwania · 1 line
> I am using 6.3.4, but if I send a post request to /server/collection/subcollection, only the collection gets created (and the document is added to collection, not to subcollection).
Could you provide us with an sscce that allow us to reproduce the issue?
Quoted text · Mahender Didwania · 1 line
> In view of the above, could you please throw more light on how the subcollections can be created using REST and how documents can be added to subcollections using REST?
The documentation will be updated with the upcoming official release. Best, Christian
AW
Andreas Weiler16 Dec 2010 12:00 #
Dear Mahender, your mentioned problem seems to be fixed now. For example in org.basex.examples.jaxrx:
// The java URL connection to the resource
     URL url = new
URL("http://localhost:8984/basex/jax-rx/test/test2/input.xml");
will add the document input.xml to the subcollection test2 in the collection test. Please check out the newest sources. Kind regards, Andreas
Quoted text · Christian Grün · 13 lines
Am 15.12.10 17:26, schrieb Christian Grün: >> I am using 6.3.4, but if I send a post request to /server/collection/subcollection, only the collection gets created (and the document is added to collection, not to subcollection). > Could you provide us with an sscce that allow us to reproduce the issue? > >> In view of the above, could you please throw more light on how the subcollections can be created using REST and how documents can be added to subcollections using REST? > The documentation will be updated with the upcoming official release. > > Best, > Christian > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
MD
Mahender Didwania16 Dec 2010 12:03 #
Hi, sscce below: Sequence1: Action: curl -i -X PUT "http://localhost:8984/basex/jax-rx/abcde" curl -i -X POST -H "Content-Type: text/xml" -d "<HelloWorld/>" "http://localhost:8984/basex/jax-rx/abcde/subA/docA" Expectation: Creation of docA in subcollection subA under collection abcde Actual: Creation of document named subAdocA in collection abcde Sequence2: Action: curl -i -X POST -H "Content-Type: text/xml" -d "<HelloWorld/>" "http://localhost:8984/basex/jax-rx/abcde/subA/docA" Expectation: Two documents with the same name in the same collection (at same hierarchy level) should be disallowed. Actual: Two documents with the same name in the same collection (at same hierarchy level) are allowed. I do not know how things will work later when xquery operations will be invoked using document name (i.e., which one will be fetched out of the two documents, since both have the same name). curl -i -X POST -H 'Content-Type: application/query+xml' -d '<query xmlns="http://jax-rx.sourceforge.net"><text>for $doc in collection("abcde") return base-uri($doc)</text></query>' 'localhost:8984/basex/jax-rx/' HTTP/1.1 200 OK Content-Type: text/xml Content-Length: 246 Server: Jetty(6.1.26)
<jax-rx:results xmlns:jax-rx="http://jax-rx.sourceforge.net"><jax-rx:result>file:(somePath)/subAdocA</jax-rx:result><jax-rx:result>file:(somePath)/subAdocA</jax-rx:result></jax-rx:results>
A delete using document name deletes all documents with the same name at the same hierarchy level: curl -i -X DELETE "http://localhost:8984/basex/jax-rx/abcde/subAdocA" HTTP/1.1 200 OK Content-Type: text/plain Transfer-Encoding: chunked Server: Jetty(6.1.26) 2 document(s) deleted in 1.2 ms. Regards, Mahender
Quoted text · Andreas Weiler · 12 lines
----- Original Message ----- From: "Christian Grün" <christian.gruen at gmail.com> To: "Mahender Didwania" <mahender at didwania.co.uk> Cc: "basex-talk" <basex-talk at mailman.uni-konstanz.de> Sent: Wednesday, December 15, 2010 4:26:41 PM GMT +00:00 GMT Britain, Ireland, Portugal Subject: Re: [basex-talk] Hierarchical collections via REST > I am using 6.3.4, but if I send a post request to /server/collection/subcollection, only the collection gets created (and the document is added to collection, not to subcollection). Could you provide us with an sscce that allow us to reproduce the issue? > In view of the above, could you please throw more light on how the subcollections can be created using REST and how documents can be added to subcollections using REST? The documentation will be updated with the upcoming official release. Best, Christian
MD
Mahender Didwaniain reply to Andreas Weiler, 16 Dec 2010, 12:0016 Dec 2010 12:07 #
Dear Andreas, Many thanks for the speedy reply - I shall check it soon. So, is this updated source made available via updated jars somewhere in Maven, say, as a snapshot revision (I take basex and basex-api.jar from your maven repo for my builds) or do I have to find an alternative way of accomplishing it? Thanks, Mahender.
Quoted text · Andreas Weiler · 30 lines
----- Original Message ----- From: "Andreas Weiler" <andreas.weiler at uni-konstanz.de> To: "Christian Grün" <christian.gruen at gmail.com> Cc: "Mahender Didwania" <mahender at didwania.co.uk>, "basex-talk" <basex-talk at mailman.uni-konstanz.de> Sent: Thursday, December 16, 2010 11:00:51 AM GMT +00:00 GMT Britain, Ireland, Portugal Subject: Re: [basex-talk] Hierarchical collections via REST Dear Mahender, your mentioned problem seems to be fixed now. For example in org.basex.examples.jaxrx: // The java URL connection to the resource URL url = new URL("http://localhost:8984/basex/jax-rx/test/test2/input.xml"); will add the document input.xml to the subcollection test2 in the collection test. Please check out the newest sources. Kind regards, Andreas Am 15.12.10 17:26, schrieb Christian Grün: >> I am using 6.3.4, but if I send a post request to /server/collection/subcollection, only the collection gets created (and the document is added to collection, not to subcollection). > Could you provide us with an sscce that allow us to reproduce the issue? > >> In view of the above, could you please throw more light on how the subcollections can be created using REST and how documents can be added to subcollections using REST? > The documentation will be updated with the upcoming official release. > > Best, > Christian > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

⚡Generated with XQuery