4

Looking at the implementation of the JSONiq specification (www.jsoniq.org).

Most of them are standalone deployment. e.g. Zorba, VXQuery, etc and are designed to query JSON based databases or process large JSON documents.

I am surprised to find all implementations are trying to solve such problem without modularizing the JSONiq execution as library. It should have been much like Apache Lucene(library) to Apache Solr(Search Server+Rest API) and other indexing solution.

Is there a java library available (similar to Saxon for XQuery), which can be embeded into java apps and can execute the JSONiq specs defined as functions in .xq or .xquery files ? Or How can Saxon be extended to parse and execute the JSONiq specification ?

kiran
  • 223
  • 4
  • 12

2 Answers2

2

JSONiq is an XQuery-like language for processing JSON. Most of its good ideas were incorporated into XQuery 3.1, but in a way that integrated the XML and JSON data models. I don't believe JSONiq offers any functionality that's not in XQuery 3.1, and it's not an open standard, so there would be little point in implementing it in Saxon.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
  • And besides, jsoniq is a bit shit compared to something like the linux `jq` package. – Software Engineer Jul 06 '17 at 21:15
  • 5
    Thank you for that incisive analysis. – Michael Kay Jul 06 '17 at 22:43
  • Work that Strunk and White badge! My analysis is fine, and correct, though I can see why someone with such a pompous writing style wouldn't like things being broken down into terms even a layman could understand ;) – Software Engineer Jul 06 '17 at 22:53
  • 5
    "Breakdown" in my book means analysis and explanation, not reduction to faecal profanities. Hope that's pompous enough for you. – Michael Kay Jul 07 '17 at 09:54
  • @Michael, XQuery 3.1 support for JSON in saxon or other Xquery Engines, does the implementation is still based on parsing and traversing DOM tree ? I believe so....which I feel has higher footprint on memory. – kiran Jul 07 '17 at 16:59
  • Saxon will work on DOM if you give it a DOM, but its native tree representation is much more compact and efficient. By default it does hold the whole source document in memory, but there is also support for streaming and for document projection if required. – Michael Kay Jul 07 '17 at 21:56
  • Thanks Michael for elaborated explanation !! – kiran Jul 10 '17 at 16:44
1

There are currently two released JSONiq implementations in Java, and they can both read data from HDFS or the local filesystem, and process large amounts in parallel on multiple cores/machines:

  • Rumble (Spark) -- supports the JSONiq core language (JSON-friendly syntax), can also read JSON-like formats (Parquet, Avro, CSV, ROOT, ...) from any file system supported by Spark (S3, HDFS, local file system, ...). Rumble also exposes its functionality via a Java API and is available as a Maven dependency.
  • VXQuery (Hyracks) -- supports the JSONiq extension to XQuery
Ghislain Fourny
  • 6,971
  • 1
  • 30
  • 37