You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mrql.apache.org by "Leonidas Fegaras (JIRA)" <ji...@apache.org> on 2013/04/30 17:06:16 UTC

[jira] [Created] (MRQL-8) Overload projections to work on JSON data

Leonidas Fegaras created MRQL-8:
-----------------------------------

             Summary: Overload projections to work on JSON data
                 Key: MRQL-8
                 URL: https://issues.apache.org/jira/browse/MRQL-8
             Project: MRQL
          Issue Type: Improvement
          Components: Query Translation
    Affects Versions: 0.9.0
            Reporter: Leonidas Fegaras
            Assignee: Leonidas Fegaras
            Priority: Minor


To make queries on JSON data easier to write, need to overload projections to work on JSON objects.
If x is the JSON object { "a": 1, "b": 2 }, then x.a must be 1.
If x is the JSON array [ { "a": 1, "b": 2 }, { "c": 3, "a": 4 }, { "b": 5 } ], the x.a nut return [ 1, 4 ].
Example:

select s
from JArray(i) in source(json,"tests/data/file.json",["items"]).items,
       Jstring(s) in i.id;

over the JSON file:

{"menu": {
    "header": "SVG Viewer",
    "items": [
        {"id": "Open"},
        {"id": "OpenNew", "label": "Open New"},
    ... ] } }

must return:

[ "Open", "OpenNew", ... ]

(the JSON file was split over "items").
I am attaching the patch.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira