Loading ...
Sorry, an error occurred while loading the content.

Re: [json] SQL for JSON?

Expand Messages
  • Peter Michaux
    ... More like SQL. Something like SELECT * FROM data WHERE age 30; I don t necessary mean SQL sytnax because that wouldn work well for nested JSON
    Message 1 of 11 , Feb 9, 2007
    • 0 Attachment
      On 2/9/07, Mark Ireland <markincuba@...> wrote:
      >
      > Like so?
      >
      > var data = {[
      > {id:"id1", name:'foo', age:21},
      > {id:"id2", name:'bar', age:35}
      > ]};
      >
      > then data.["id2"].age

      More like SQL. Something like

      SELECT * FROM data WHERE age > 30;

      I don't necessary mean SQL sytnax because that wouldn' work well for
      nested JSON structure. But somethign that can look around the
      structure for matches like a regular expression does for strings to
      pluck out pieces.

      Peter
    • Mark Ireland
      So loop thru data testing for data.[ id2 ].age 35 and create var dataset and add the object. Have you seen Adobe Spry? ...
      Message 2 of 11 , Feb 9, 2007
      • 0 Attachment
        So loop thru data testing for data.["id2"].age > 35

        and create var dataset and add the object.

        Have you seen Adobe Spry?

        >From: "Peter Michaux" <petermichaux@...>
        >Reply-To: json@yahoogroups.com
        >To: json@yahoogroups.com
        >Subject: Re: [json] SQL for JSON?
        >Date: Fri, 9 Feb 2007 15:41:22 -0800
        >
        >On 2/9/07, Mark Ireland <markincuba@...> wrote:
        > >
        > > Like so?
        > >
        > > var data = {[
        > > {id:"id1", name:'foo', age:21},
        > > {id:"id2", name:'bar', age:35}
        > > ]};
        > >
        > > then data.["id2"].age
        >
        >More like SQL. Something like
        >
        >SELECT * FROM data WHERE age > 30;
        >
        >I don't necessary mean SQL sytnax because that wouldn' work well for
        >nested JSON structure. But somethign that can look around the
        >structure for matches like a regular expression does for strings to
        >pluck out pieces.
        >
        >Peter

        _________________________________________________________________
        Advertisement: It's simple! Sell your car for just $20 at carsales.com.au
        http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801577%2Fpi%5F1005244%2Fai%5F838588&_t=757768878&_r=endtext_simple&_m=EXT
      • Peter Michaux
        ... What is id2 and why a dot before the bracket. I don t know what that is supposed to do? ... No. A quick looks says ajax framework what does it have to
        Message 3 of 11 , Feb 9, 2007
        • 0 Attachment
          On 2/9/07, Mark Ireland <markincuba@...> wrote:
          >
          > So loop thru data testing for data.["id2"].age > 35

          What is "id2" and why a dot before the bracket. I don't know what that
          is supposed to do?

          > and create var dataset and add the object.
          >
          > Have you seen Adobe Spry?

          No. A quick looks says "ajax framework" what does it have to inspect a
          JSON structure?

          Peter
        • Matthew Morley
          JSON is a data-interchange format, so unless your talking about building something that does a search through the raw strings, I m pretty sure that doing a
          Message 4 of 11 , Feb 10, 2007
          • 0 Attachment
            JSON is a data-interchange format, so unless your talking about building
            something that does a search through the raw strings, I'm pretty sure that
            doing a search through the native language equivalent would be faster.

            If you are working in an environment where the JSON consumer is a web
            browser, let the server do the heavy lifting and pass you the matches. If
            you really need the local ability to search or are doing non-browser
            exchanges, I am sure there exists generic functions to search through sets
            of data and match criteria. The real question is which language you are
            doing it in, and is it worth the overhead and complication.

            --
            Matthew P. C. Morley
            MPCM Technologies Inc.


            [Non-text portions of this message have been removed]
          • george.jempty
            ... matches. If ... through sets ... Baloney. The real question is the OP s original question: Has anyone played with a way to find parts of a JSON structure
            Message 5 of 11 , Feb 10, 2007
            • 0 Attachment
              --- In json@yahoogroups.com, "Matthew Morley" <WickedLogic@...> wrote:
              > If you are working in an environment where the JSON consumer is a web
              > browser, let the server do the heavy lifting and pass you the
              matches. If
              > you really need the local ability to search or are doing non-browser
              > exchanges, I am sure there exists generic functions to search
              through sets
              > of data and match criteria. The real question is which language you are
              > doing it in, and is it worth the overhead and complication.

              Baloney. The real question is the OP's original question: "Has anyone
              played with a way to find parts of a JSON structure like SQL?" This
              is not an unreasonable question: in fact its been considered by
              renowned Python/XML expert Uche Ogbuji; see
              http://copia.ogbuji.net/blog/2006-12-23/Why_JSON_v
              where he imagines "XQuery for JSON". By the way, a link to this very
              same article can be found at the bottom of json.org.
            • Matthew Morley
              ... Agreed, mostly. But I am not sure the case is as strong for xquery for json as it is with xml, though I can definitely see a use for it. Selectively
              Message 6 of 11 , Feb 10, 2007
              • 0 Attachment
                On 2/10/07, george.jempty <george.jempty@...> wrote:
                > Baloney. The real question is the OP's original question: "Has anyone
                > played with a way to find parts of a JSON structure like SQL?" This
                > is not an unreasonable question: in fact its been considered by
                > renowned Python/XML expert Uche Ogbuji; see
                > http://copia.ogbuji.net/blog/2006-12-23/Why_JSON_v
                > where he imagines "XQuery for JSON". By the way, a link to this very
                > same article can be found at the bottom of json.org.

                Agreed, mostly.

                But I am not sure the case is as strong for xquery for json as it is
                with xml, though I can definitely see a use for it. Selectively
                plucking data from a stream that you do not control or do not want to
                control is very appealing and probably useful. But at that point why
                not just do the same methods on the native language translation?

                One way your search through strings, translate subsections, then
                provide those back as native objects. The other you translate it all,
                then search against native objects to return subset of native objects.

                --
                Matthew P. C. Morley
                MPCM Technologies Inc.
              • Alexey Luchkovsky
                ... you are ... JsonTools included solution for client lookup JSON data, you can find parts of a JSON structure, if you need concrete decision, send e-mail me.
                Message 7 of 11 , Feb 26, 2007
                • 0 Attachment
                  --- In json@yahoogroups.com, "george.jempty" <george.jempty@...> wrote:
                  >
                  > --- In json@yahoogroups.com, "Matthew Morley" <WickedLogic@> wrote:
                  > > If you are working in an environment where the JSON consumer is a web
                  > > browser, let the server do the heavy lifting and pass you the
                  > matches. If
                  > > you really need the local ability to search or are doing non-browser
                  > > exchanges, I am sure there exists generic functions to search
                  > through sets
                  > > of data and match criteria. The real question is which language
                  you are
                  > > doing it in, and is it worth the overhead and complication.
                  >
                  > Baloney. The real question is the OP's original question: "Has anyone
                  > played with a way to find parts of a JSON structure like SQL?" This
                  > is not an unreasonable question: in fact its been considered by
                  > renowned Python/XML expert Uche Ogbuji; see
                  > http://copia.ogbuji.net/blog/2006-12-23/Why_JSON_v
                  > where he imagines "XQuery for JSON". By the way, a link to this very
                  > same article can be found at the bottom of json.org.
                  >

                  JsonTools included solution for client lookup JSON data, you can find
                  parts of a JSON structure, if you need concrete decision, send e-mail me.
                • Anand Sadasivam
                  Hi, Check out this... http://trimpath.com/project/wiki/TrimQuery you can see the demo right here... http://trimpath.com/demos/test1/trimpath/query_demo.html .
                  Message 8 of 11 , Feb 28, 2007
                  • 0 Attachment
                    Hi,

                    Check out this...

                    http://trimpath.com/project/wiki/TrimQuery

                    you can see the demo right here...
                    http://trimpath.com/demos/test1/trimpath/query_demo.html .


                    Hope this helps.

                    Regards,
                    Anand.S


                    On 2/26/07, Alexey Luchkovsky <luchkovsky@...> wrote:
                    >
                    > --- In json@yahoogroups.com <json%40yahoogroups.com>, "george.jempty" <
                    > george.jempty@...> wrote:
                    > >
                    > > --- In json@yahoogroups.com <json%40yahoogroups.com>, "Matthew Morley"
                    > <WickedLogic@> wrote:
                    > > > If you are working in an environment where the JSON consumer is a web
                    > > > browser, let the server do the heavy lifting and pass you the
                    > > matches. If
                    > > > you really need the local ability to search or are doing non-browser
                    > > > exchanges, I am sure there exists generic functions to search
                    > > through sets
                    > > > of data and match criteria. The real question is which language
                    > you are
                    > > > doing it in, and is it worth the overhead and complication.
                    > >
                    > > Baloney. The real question is the OP's original question: "Has anyone
                    > > played with a way to find parts of a JSON structure like SQL?" This
                    > > is not an unreasonable question: in fact its been considered by
                    > > renowned Python/XML expert Uche Ogbuji; see
                    > > http://copia.ogbuji.net/blog/2006-12-23/Why_JSON_v
                    > > where he imagines "XQuery for JSON". By the way, a link to this very
                    > > same article can be found at the bottom of json.org.
                    > >
                    >
                    > JsonTools included solution for client lookup JSON data, you can find
                    > parts of a JSON structure, if you need concrete decision, send e-mail me.
                    >
                    >
                    >
                    >



                    --
                    Anand.S
                    anand.sadasivam@...
                    +91 99804 75305


                    [Non-text portions of this message have been removed]
                  • Alexey Luchkovsky
                    TrimQuery solution is right pretty, but.... not for tree-based structures. Visitor pattern and XPATH on XML realy designed for tree. Before I decide on Visitor
                    Message 9 of 11 , Mar 1, 2007
                    • 0 Attachment
                      TrimQuery solution is right pretty, but.... not for tree-based
                      structures.

                      Visitor pattern and XPATH on XML realy designed for tree.
                      Before I decide on Visitor I have seen JavaScript XPATH library
                      written by Steffen Meschkat <mesch@...>. It's realy titanic
                      solution, but it's designed for XML.

                      Enter Visitor:
                      function visit(aTree, anAcceptor, aVisitProcessor)

                      I proceed from the assumption:
                      - 90% tasks are based on search by equals or like.
                      - 10% tasks can be realized by custom "acceptor" and/or custom "visit
                      processor"

                      Moreover, Visitor allowed to modify tree so well as search from them.
                      For example, I can design code, that removed from JSON data structure
                      all persons whose birth day arrived on full Moon (20 lines of code).

                      Java Visitor on Tree vs. Events named Digester
                      http://jakarta.apache.org/commons/digester/

                      Resume:
                      Of course Visitor is not competed with SQL (especially on server with
                      indexes, cache etc), Visitor is not a rival for XPATH on XML.

                      TrimQuery solution is very good and very helpful, but for JSON
                      JsonTools is preffered more...
                      http://sourceforge.net/projects/jsontools.

                      Regards, Alexey Luchkovsky

                      --- In json@yahoogroups.com, "Anand Sadasivam" <anand.sadasivam@...>
                      wrote:
                      >
                      > Hi,
                      >
                      > Check out this...
                      >
                      > http://trimpath.com/project/wiki/TrimQuery
                      >
                      > you can see the demo right here...
                      > http://trimpath.com/demos/test1/trimpath/query_demo.html .
                      >
                      >
                      > Hope this helps.
                      >
                      > Regards,
                      > Anand.S
                      >
                      >
                      > On 2/26/07, Alexey Luchkovsky <luchkovsky@...> wrote:
                      > >
                      > > --- In json@yahoogroups.com <json%40yahoogroups.com>,
                      "george.jempty" <
                      > > george.jempty@> wrote:
                      > > >
                      > > > --- In json@yahoogroups.com <json%40yahoogroups.com>, "Matthew
                      Morley"
                      > > <WickedLogic@> wrote:
                      > > > > If you are working in an environment where the JSON consumer
                      is a web
                      > > > > browser, let the server do the heavy lifting and pass you the
                      > > > matches. If
                      > > > > you really need the local ability to search or are doing
                      non-browser
                      > > > > exchanges, I am sure there exists generic functions to search
                      > > > through sets
                      > > > > of data and match criteria. The real question is which language
                      > > you are
                      > > > > doing it in, and is it worth the overhead and complication.
                      > > >
                      > > > Baloney. The real question is the OP's original question: "Has
                      anyone
                      > > > played with a way to find parts of a JSON structure like SQL?" This
                      > > > is not an unreasonable question: in fact its been considered by
                      > > > renowned Python/XML expert Uche Ogbuji; see
                      > > > http://copia.ogbuji.net/blog/2006-12-23/Why_JSON_v
                      > > > where he imagines "XQuery for JSON". By the way, a link to this very
                      > > > same article can be found at the bottom of json.org.
                      > > >
                      > >
                      > > JsonTools included solution for client lookup JSON data, you can find
                      > > parts of a JSON structure, if you need concrete decision, send
                      e-mail me.
                      > >
                      > >
                      > >
                      > >
                      >
                      >
                      >
                      > --
                      > Anand.S
                      > anand.sadasivam@...
                      > +91 99804 75305
                      >
                      >
                      > [Non-text portions of this message have been removed]
                      >
                    Your message has been successfully submitted and would be delivered to recipients shortly.