Dear BaseX team, I have a question concerning the availability of the JSON-to-XML transformation. Before asking, this remark: I am very glad and grateful that BaseX offers this functionality (json:parse), as it exposes JSON to XPath, which enables important evaluations that otherwise would not even be attempted. And now my question. Is it possible - does it appear reasonable - to access the functionality within a Java application by calling the BaseX code (org.basex.build.json.JsonParser, I suppose)) immediately, without launching XQuery? I expect that one would be treading dangerous ground, relying on internal APIs which may change any time, not being meant for external use. If this is so, a brief confirmation would suffice to make me drop the idea. Thank you, and kind regards -Hans-Jürgen PS: Background of my question - I evaluate alternative possibilities how to validate JSON within Java applications. One (and probably the best) option is validating against JSON schema (json-schema.org), an alternative would be a to-XML transformation followed by XSD validation. A first experiment lettig BaseX via XQJ execute the epic query "json:parse(.)" revealed a performance which would not be sufficient to be competitive. So I wondered if removing the overhead of launching BaseX might be an approach to consider.
Hi Hans-Jürgen,
Sure, that's possible. This is one of the entry points [1]. As you already indicated, it's not based on any well-defined API, so it is subject to change.
Have you already done some testing what's the current bottleneck in terms of performance (e.g. by using the Java flag -Xhrunprof)? Maybe you can already save time by creating instances of the QueryProcessor class (see e.g. [2]).
Cheers, Christian
[1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/ba... [2] https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/or...
On Mon, Sep 28, 2015 at 2:23 PM, Hans-Juergen Rennau hrennau@yahoo.de wrote:
Dear BaseX team,
I have a question concerning the availability of the JSON-to-XML transformation. Before asking, this remark: I am very glad and grateful that BaseX offers this functionality (json:parse), as it exposes JSON to XPath, which enables important evaluations that otherwise would not even be attempted. And now my question.
Is it possible - does it appear reasonable - to access the functionality within a Java application by calling the BaseX code (org.basex.build.json.JsonParser, I suppose)) immediately, without launching XQuery?
I expect that one would be treading dangerous ground, relying on internal APIs which may change any time, not being meant for external use. If this is so, a brief confirmation would suffice to make me drop the idea.
Thank you, and kind regards - Hans-Jürgen
PS: Background of my question - I evaluate alternative possibilities how to validate JSON within Java applications. One (and probably the best) option is validating against JSON schema (json-schema.org), an alternative would be a to-XML transformation followed by XSD validation. A first experiment lettig BaseX via XQJ execute the epic query "json:parse(.)" revealed a performance which would not be sufficient to be competitive. So I wondered if removing the overhead of launching BaseX might be an approach to consider.
basex-talk@mailman.uni-konstanz.de