Adding new doc into existing collection by means of XQuery
Wednesday, 23 February 2011 · 2 messages
JC
Jan Vlčinský (CAD)23 Feb 2011 18:10 #
Hi
Is there any method, how to add new doc into existing collection? I studied XQUF and it seems, like it can only update existing nodes. Options I was thinking about are
-
fn:put() - it is supposed for publishing into external documents, but if I could use uri of collection in BaseX and BaseX would accept it...
- using database functions<http://docs.basex.org/wiki/Database_Functions>, but also here I do not see anything, what would add a doc
The motivation is simple - if I could add docs by XQuery, I can save some roundtrips of data to insert
Workaround is also not so difficult - simply using some sort of container doc in target collection and then modifying its nodes (putting here content of complete logical doc) instead of adding complete doc.
Any comments are welcome.
JanAW
Andreas Weiler23 Feb 2011 18:25 #
Hi Jan,
in BaseX you should use the add command, see http://docs.basex.org/wiki/Commands. XQuery Update has no functionality for adding or deleting documents.
-- Andreas
Quoted text · Jan Vlčinský (CAD) · 16 lines
Am 23.02.2011 um 18:10 schrieb Jan Vlčinský (CAD): > Hi > Is there any method, how to add new doc into existing collection? > I studied XQUF and it seems, like it can only update existing nodes. Options I was thinking about are > fn:put() - it is supposed for publishing into external documents, but if I could use uri of collection in BaseX and BaseX would accept it... > using database functions, but also here I do not see anything, what would add a doc > The motivation is simple - if I could add docs by XQuery, I can save some roundtrips of data to insert > Workaround is also not so difficult - simply using some sort of container doc in target collection and then modifying its nodes (putting here content of complete logical doc) instead of adding complete doc. > > Any comments are welcome. > > Jan > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery