Hi,
Is it right that the current XQJ driver for BaseX doesn't support XQuery 3 syntax? Everytime I try to use a query that includes some of the newer features it barks at me with Invalid XQuery syntax, syntax does not pass static validation. Is there way to get around that, say, when the result would not use these XQuery 3 data types?
Also I am confused why files.basex /maven repo has XQJ driver 1.6.0 and xqj.net has 1.4.0 as the latest or what the difference is.
I'm wondering what the fate is of XQJ in general. Will it remain relevant?
The reason I was looking into XQJ was that it provides ways to get XDM type info with the result. I would like to be able to deal with the result from a query at a higher level than just strings. I've briefly looked into BaseXClient.java which seems to be able to return XDM metadata but then I saw that XQJ could do this out of the box.
In general I would be interested to hear what the best way would be to get a client to deal with query responses as native (client-side) types (including hashmaps and arrays) instead of strings. Would it be better to focus on using BaseXClient and forget about XQJ?
Cheers, --Marc
Hi Marc,
Is it right that the current XQJ driver for BaseX doesn't support XQuery 3 syntax? Everytime I try to use a query that includes some of the newer features it barks at me with Invalid XQuery syntax, syntax does not pass static validation. Is there way to get around that, say, when the result would not use these XQuery 3 data types?
I'm wondering what the fate is of XQJ in general. Will it remain relevant?
I decided to pass on your question directly to Charles Foster; he might be able to give you some outlook!
Also I am confused why files.basex /maven repo has XQJ driver 1.6.0 and xqj.net has 1.4.0 as the latest or what the difference is.
I have sent a pull request to Charles’ repo; it may be included in the next version there.
The reason I was looking into XQJ was that it provides ways to get XDM type info with the result. I would like to be able to deal with the result from a query at a higher level than just strings. I've briefly looked into BaseXClient.java which seems to be able to return XDM metadata but then I saw that XQJ could do this out of the box.
Right, that’s only possible with XQJ.
In general I would be interested to hear what the best way would be to get a client to deal with query responses as native (client-side) types (including hashmaps and arrays) instead of strings. Would it be better to focus on using BaseXClient and forget about XQJ?
From my perspective, it’s good to use XQuery whenever possible and use
our Client Module to address BaseX server instances [1] ;)
Cheers, Christian
Hi Christian,
Thanks. Very curious to hear about XQJ's fate.
I am currently using BaseX for data integration which got me thinking about integration of XQuery in other web applications (node/python/clojure etc.). I was triggered by the recent thread about node-basex[1] and Hans Jürgen and your Balisage paper [2]. I was considering what the most performant way would be to return XQuery results as native types. Eg. function returns an array with maps or XML nodes and it gets converted to the host application's native data types so the application can use the results as if they were native data types.
Maybe the only viable way to tackle this *is* via HTTP and a smart serialization (EDN[3] for example is such a, non-JSON, serialization that includes type info) but I was thinking if there was an existing lower-level way (without the BaseX HTTP layer). XQJ would enable this (at least for XQuery < 3) but I have doubts if it would deserialize non-atomic XDM values (like nested maps/arrays) as this is new to XQuery 3, I didn't check but I figure that the BaseXClient on which it is based also doesn't provide the XDM metadata for each nested item.
Just pondering how to bridge from XQuery to other languages.
[1]: http://www.mail-archive.com/basex-talk%40mailman.uni-konstanz.de/msg07882.ht... [2]: http://www.balisage.net/Proceedings/vol15/html/Rennau01/BalisageVol15-Rennau... [3]: https://github.com/edn-format/edn
On Tue, Apr 5, 2016 at 11:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Marc,
Is it right that the current XQJ driver for BaseX doesn't support XQuery 3 syntax? Everytime I try to use a query that includes some of the newer features it barks at me with Invalid XQuery syntax, syntax does not pass static validation. Is there way to get around that, say, when the result would not use these XQuery 3 data types?
I'm wondering what the fate is of XQJ in general. Will it remain relevant?
I decided to pass on your question directly to Charles Foster; he might be able to give you some outlook!
Also I am confused why files.basex /maven repo has XQJ driver 1.6.0 and xqj.net has 1.4.0 as the latest or what the difference is.
I have sent a pull request to Charles’ repo; it may be included in the next version there.
The reason I was looking into XQJ was that it provides ways to get XDM type info with the result. I would like to be able to deal with the result from a query at a higher level than just strings. I've briefly looked into BaseXClient.java which seems to be able to return XDM metadata but then I saw that XQJ could do this out of the box.
Right, that’s only possible with XQJ.
In general I would be interested to hear what the best way would be to get a client to deal with query responses as native (client-side) types (including hashmaps and arrays) instead of strings. Would it be better to focus on using BaseXClient and forget about XQJ?
From my perspective, it’s good to use XQuery whenever possible and use our Client Module to address BaseX server instances [1] ;)
Cheers, Christian
Hi Marc, like you, I find the integration of XQuery results into other languages a most interesting topic, and I think it is a topic deserving more attention from the XML-community than it receives. I feel that the integration should completely hide the fact that XQuery is a different language than the host language, that is, the query results should be delivered in *exactly* that format which the host language programmer desires. From this perspective, XQuery plays the role of an information service to the host language application. The XQuery programmer is responsible for writing queries which deliver information as an XDM representation of the information desired by the, say, Java programmer. The query is designed to produce a result XDM which the host language infrastructure (high-level API) transforms into the desired "final" format without the application programmer ever being aware of the XDM origin. To achieve an unambiguous correspondance between XDM and non-XDM, the query may augment the result with additional XDM items ("meta items") providing meta data about how to transform the (primary) XDM items into host language items (e.g. meta items defining the mapping of an XML fragment to a host language map via XPath expressions, or segmenting the XDM sequence into subsequences corresponding to distinct host language items.)
The key to all this is a high-level API which completely hides the conversions between host language types and the XDM. Such an infrastructure must be built upon a low-level API like XQJ or the equivalent s9api of Saxon - which bridges the host language type system and the XDM type systems. The higher level API is responsible for *all* conversions between host language type system and XDM. I suggest a long series of XQuery execution functions with known result types, like execQuery2string execQuery2strings (: returns String[] :) execQuery2int execQuery2ints (: returns int[] :) ... execQuery2map_string_string execQuery2map_string_int ... etcera! from which the host language programmer chooses. The choice is dictated by the actual query to be launched: each published query has a known signature described in terms of host language types like integer arrays and string-to-boolean maps. So any given query has to be launched with a particular variant of execQuery, and this query delivers the desired data type.
The approach can be extended in various way, for example by supporting the delivery of complex containers of information ("info trays") consisting of named entries each one of which has its own and independent type ( [1] ).
So in summary I believe there are very interesting possibilities of integrating XQuery seamlessly into other languages, and the foundation is a low-level API preserving XDM type information. All else can be built on that.
Cheers,Hans-Jürgen
[1] http://www.balisage.net/Proceedings/vol5/html/Rennau01/BalisageVol5-Rennau01...
Hi Hans-Jürgen,
Yes, that's what I am looking for. Will read that paper.
Thanks, --Marc
On Tue, Apr 5, 2016 at 5:22 PM, Hans-Juergen Rennau hrennau@yahoo.de wrote:
Hi Marc,
like you, I find the integration of XQuery results into other languages a most interesting topic, and I think it is a topic deserving more attention from the XML-community than it receives.
I feel that the integration should completely hide the fact that XQuery is a different language than the host language, that is, the query results should be delivered in *exactly* that format which the host language programmer desires. From this perspective, XQuery plays the role of an information service to the host language application. The XQuery programmer is responsible for writing queries which deliver information as an XDM representation of the information desired by the, say, Java programmer. The query is designed to produce a result XDM which the host language infrastructure (high-level API) transforms into the desired "final" format without the application programmer ever being aware of the XDM origin. To achieve an unambiguous correspondance between XDM and non-XDM, the query may augment the result with additional XDM items ("meta items") providing meta data about how to transform the (primary) XDM items into host language items (e.g. meta items defining the mapping of an XML fragment to a host language map via XPath expressions, or segmenting the XDM sequence into subsequences corresponding to distinct host language items.)
The key to all this is a high-level API which completely hides the conversions between host language types and the XDM. Such an infrastructure must be built upon a low-level API like XQJ or the equivalent s9api of Saxon
- which bridges the host language type system and the XDM type systems. The
higher level API is responsible for *all* conversions between host language type system and XDM. I suggest a long series of XQuery execution functions with known result types, like execQuery2string execQuery2strings (: returns String[] :) execQuery2int execQuery2ints (: returns int[] :) ... execQuery2map_string_string execQuery2map_string_int ... etcera!
from which the host language programmer chooses. The choice is dictated by the actual query to be launched: each published query has a known signature described in terms of host language types like integer arrays and string-to-boolean maps. So any given query has to be launched with a particular variant of execQuery, and this query delivers the desired data type.
The approach can be extended in various way, for example by supporting the delivery of complex containers of information ("info trays") consisting of named entries each one of which has its own and independent type ( [1] ).
So in summary I believe there are very interesting possibilities of integrating XQuery seamlessly into other languages, and the foundation is a low-level API preserving XDM type information. All else can be built on that.
Cheers, Hans-Jürgen
[1] http://www.balisage.net/Proceedings/vol5/html/Rennau01/BalisageVol5-Rennau01...
basex-talk@mailman.uni-konstanz.de