OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] XML and XPATH: How do they work?

[ Lists Home | Date Index | Thread Index ]
  • To: Michael Kay <mike@saxonica.com>
  • Subject: Re: [xml-dev] XML and XPATH: How do they work?
  • From: Joe Schaffner <schaffner.joe@gmail.com>
  • Date: Wed, 29 Jun 2005 14:45:12 +0300
  • Cc: xml-dev@lists.xml.org
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=dwe2dYoHH1CwMUknKFnR3Uf7s3ED5ytoWFfr50e8xaFHV6G8wOTCUiu/nVCC3WYuB22+Tf0UtOcUAHbH1k+92hY2A3IKqfJgC2jyx3oTDSYa5uTGfruRv7mf7E1wAP3pWAF0DtsZY7x3vMmGNzR64qEMYBcbUEbHQ1tkz0GCu+M=
  • In-reply-to: <42c13661.479df431.75d6.4f91SMTPIN_ADDED@mx.gmail.com>
  • References: <514a17f5050628033555ee4b93@mail.gmail.com> <42c13661.479df431.75d6.4f91SMTPIN_ADDED@mx.gmail.com>
  • Reply-to: Joe Schaffner <schaffner.joe@gmail.com>

It's funny... After composing my last message I realized I was talking about XLink -not XPath- and that the literature on XLink isn't so bad after all...
 
XPath looks like some kind of expression language for naming objects, as in "pathname", not a "link". (I'm guessing that XML objects, being hierarchical, need some kind of name syntax, like a "pathname".)
 
The 'link' abstraction in XML is a bit more complicated than I expected, so I'll need more time to read the documentation.
 
I was thinking of the web as a network of HTML "pages", each page containing one object, an <html>...</html> which contained links to other pages. These links were called "anchors", href's, etc...
 
In HTML it didn't make sense to have more than one "page" in a page.
 
But an XML document can contain more than one object, an object being anything that can be tagged. It doesn't surprise me that XLinks are more complicated conceptually.
 
You need a way to point to hierarchically defined objects both inside and outside a document.
 
(In HTML, you could label parts of the page, then use the label in an href, but I've never found the result of branching to a label within a page very appealing visually, but essential logically, if the link were being followed by a processing program.)
 
"I'm actually wondering whether this <next> element is needed in your XML at all? Does it hold any information that couldn't be reconstructed from other things in the XML, or is it just a navigation aid? If the latter, it may be better to leave it out entirely."
 
My names <prev> and <next> come from linked list programming in C. They are unidirectional, so you need one for both directions. They serve as navigation.
 
But they are also logical, maintaining either alphabetical order, or the arbitrary order chosen for the models...
 
The verbs on the Type list are not alphabetical.
 
The verbs next to each other on the outermost {Model] list are similar in form, and are not in alphabetical order either. These are the "regular" verbs. I want students to browse patterns of similarly constructed verbs, like:
 
1) λύνω, δηλώνω, διαλύω, σκάβω, παραλείπω etc.
2) αγαπάω, φοράω, κοιτάω, τραβάω etc.
3) θεωρώ, διαρώ, ανακτώ etc.
 
Then, after the regulars, the models become singleton categories representing only one verb (and its compounds), the definition of an "irregular" verb. The irregulars are maintained in alphabetical order.
 
Each entry in the index has an integer-valued category attribue, so the index could be sorted by category yielding the other, non-alphabetical, way of looking at the verbs. A la limite, I suppose the linked lists are not absolutely necessary in XML, which implies an intermediate process to create the viewable HTML.
 
The XML links could be represented by a sorted index, with links only in the HTML output created from from the sorted  index.
 
It looks like there is more than one way to skin a cat.
 
Joe
On 6/28/05, Michael Kay <mike@saxonica.com> wrote:
I'm not sure where XPath comes into this. As far as I can see the task you are engaged in is deciding how to represent your data in XML form. That's a question of data modelling, and then translating the data model into an XML schema or DTD (either explicit or "in your head"). XPath only comes into play when you start processing the data.
 
It seems your concern is how to define relationships between elements in your data. Some people believe strongly that every object in your model should have a URI and all relationships should be expressed using that URI. My personal view is, use whatever name or key arises naturally in the application. So don't do
 
 
instead do
 
<next>agapao</next>
 
since that's a sufficient identifier. You can worry about how to render this as a hyperlink when the time comes to consider transforming the XML into HTML.
 
I'm actually wondering whether this <next> element is needed in your XML at all? Does it hold any information that couldn't be reconstructed from other things in the XML, or is it just a navigation aid? If the latter, it may be better to leave it out entirely.
 
Michael Kay


From: Joe Schaffner [mailto:schaffner.joe@gmail.com]
Sent: 28 June 2005 11:35
To: xml-dev@lists.xml.org
Subject: [xml-dev] XML and XPATH: How do they work?

 
Hello Everybody,
 
I'm writing a dictionary of modern Greek verbs at http://modern-greek-verbs.tripod.com
 
The pages are linked using html anchors, like this:
 
-- from grafo.html
<a href=""agapao.html"><i>Type</i></a>
'αγαπάω' is the next verb on the list of linked pages.
 
'Type' is the name of the list, a singularly-linked, circular list. There are three types, 'λύνω', 'αγαπάω' 'θεωρώ', and therefore three pages in this list.
 
I was wondering how such a list would appear in an xml version of the dictionary.
 
Do I do the lists in XPath?
 
HTML hyperlinks rely on the appearance/layout of the page. They're simply grouped together. A student knows which links to follow by looking at them.. but a processing program must know the name of the list.
 
Within each Type there are Models:
 
[<i>Model</i> <a href=""ginomai.html">Prev</a>" <a href=""diablepo.html">Next</a>]
[<i>Model</i> <a href=""bafo.html">Prev</a>" <a href=""anagrafo.html">Next</a>]

The list is hierarchical. Types are broken down into Models which can be broken down into sub-models.
 
The Models are nested from top to bottom. The definition is recursive...
 
This verb, γράφω, is part of the λύνω Type, and falls between other Models γίνομαι and διαβλέπω, in alphabetical order...
 
γράφω has two sub-models (verbs which are conjugated like γράφω): βάφω, and αναγράφω, the compounds of 'γράφω'...
 
Of course, 'γράφω' is also an instance of itself. It is a real verb, in addition to being a model for others.
 
I'm thinking something like this:
 
-- This file is 'grafo.xml' which is on the 'luno.xml' list
 
<type>
   <next>http://modern-greek-verbs.tripod.com/ agapao.xml</next>
   <model>
      <prev>http://modern-greek-verbs.tripod.com/ ginomai.xml</prev>
      <next>http://modern-greek-verbs.tripod.com/ diablepo.xml</next>
     <model>
     </model>
   </model>
</type>
 
But I don't want to invent my own language. I'm hoping XPath will do the trick. I've been reading the documentation, which is very large, and I haven't really found any good examples.
 
Thanks. I'm sure you can save me a load of time.
 
Signed,
 
xml-newbie
 
 PS
 
(What is XLink?)





 

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

Copyright 2001 XML.org. This site is hosted by OASIS