[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Imbue XML instances with semantics

  • From: Thomas Passin <list1@tompassin.net>
  • Date: Fri, 23 Dec 2016 18:48:43 -0500

Re:  Imbue XML instances with semantics
But now you are thinking in procedural terms instead of in a declarative way.

On 12/23/2016 3:53 PM, Costello, Roger L. wrote:
Hi Folks,

*Problem*: There are N nodes. Create an XML instance so that the nodes
form a ring (cyclic) topology.

Rick Jelliffe solved this problem very elegantly [1].

Here’s Rick’s solution: Arrange the nodes in document order:

<Nodes>
<Nodeid="N1">...</Node>
<Nodeid="N2">...</Node>
     ...
<Nodeid="Nn">...</Node>
</Nodes>

“How does that form a ring topology?” you ask. It doesn’t. Not yet. You
need to define an operator on the nodes and give the operator the
desired behavior (semantics). Allow me to explain.

To traverse from one <Node> element to the next, you _must_ perform an
operation. If you are moving from <Node> to <Node> using your eyes, then
the operator is “physically move your eyes downward (or upward).” If you
are moving from <Node> to <Node> using XPath, then the operator is
following-sibling (or preceding-sibling). Regardless of the technology,
some operator must be used to move from one <Node> element to the next.
Let’s generically denote that operator by /succ/. To achieve our ring
topology goal, then, we need to imbue the /succ/ operator with this
semantic:

The /succ/ of a <Node> is the next node in document order
                except when <Node> is the last node, then the /succ/ is the
                first node.

Now the nodes take on a ring topology, by way of the /succ/ operator.

Awesome! Thanks Rick!

**

*Lesson Learned*: XML has no semantics. When we define operators on the
XML and imbue specific behaviors on the operators, only then we may
_informally_ treat the XML as having semantics.

Comments?

/Roger

[1]
http://xml-dev.markmail.org/message/b3n774tmzqfe5k4d?q=Notable+declarative+expressions%3F+date:201612








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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.