XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] YPath, ZPath?


Hi,

my Xidel has the oddest syntax

You can write $object/field or $object//field or $object/descendant::field and field might be *.

E.g. {"a": {"b":3}}/a to get {"b":3}

{"a": {"b":3}}/descendant::a returns {"b":3}, too, and there is no descendant-or-self. After all if the a key is treated as child, it has to be a descendant



Cheers,
Benito 


On 11.04.2016 14:48, Hans-Juergen Rennau wrote:
Thank you, Ghislain, that's helpful!
Hans-Jürgen


Ghislain Fourny <g@28.io> schrieb am 9:41 Montag, 11.April 2016:


Hi Hans-Jürgen,

JSONiq supports the descendant axis indirectly with the descendant-objects function. Engines can optimize as they do with XPath.


The following is like $object/descendant-or-self::*

descendant-objects($object)


The following is like $object/descendant::*

descendant-objects(values($object))


The following is like $object//Field:

descendant-objects($object).Field


JSONiq does not have axes going back to parents or ancestors or siblings, because 1) there hasn't been much demand for it or any specific use cases and 2) In the JDM (JSONiq Data Model), objects or arrays don't "belong" to their parents, which allows further optimizations. As Dana says, not all tree structures are alike and requirements are different. For example, JSON trees (in JSONiq and XQuery 3.1) are node-based, while XML trees are edge-based: nodes "know" their name, but JSON fields don't "know" their key.

Kind regards,
Ghislain


On Sun, Apr 10, 2016 at 9:42 PM, Hans-Juergen Rennau <hrennau@yahoo.de> wrote:
Thank you, Dana and Liam.

Does JSONiq support navigation axes apart from the child axis?

Concerning XQuery 3.1, my reading of the spec is that support for JSON navigation (the lookup operator) is restricted to the child axis.

My feeling is that support for other navigation axes besides the child axis is an essential feature of XPath.

With kind regards,
Hans-Jürgen


daniela florescu <dflorescu@me.com> schrieb am 20:54 Sonntag, 10.April 2016:


JSONiq had relatively sophisticated path expressions sublanguage, but designed specially for JSON.

Not all the “tree” structures are alike.

As for path expressions, during the 1990ies there was SO much work on that…..interested 
parties should go back in time and read the literature.

HTH,
Dana


On Apr 10, 2016, at 11:45 AM, Hans-Juergen Rennau <hrennau@yahoo.de> wrote:

Dear colleagues,

the navigation model of XPath - navigation viewed as a sequence of steps, a step viewed as a combination of navigation axis, node test and optional predicates  - enables the expression of item selection in a clear, concise and very readable way. But I do not think that the basic principles of the navigation model depend on XML trees, rather, that variations of the XPath model could be designed for other kinds of tree-structured information.

Yet the only attempt to do so which I am aware of is JSONPath.

I would be interested in learning about other approaches to apply XPath-like navigation to non-XML structures - can you help me discover them?

And do you have thoughts about why one should not - or should - attempt such approaches?

With kind regards,
Hans-Juergen










[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS