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] An XML language for describing file attributes of adirectory tree?

Liam Quin wrote:
> Maybe it'd be worth having some sort of micro-spec for this to go
> with XQuery and XSLT 2 and XPath 2, e.g. via expath.org/exquery.org.

There is an I/O module in Active Tags for that purpose.

If $dir is an object that represents a directory of the file system, 
then one can apply an XPath expression like:
$dir/path/to/doc
$dir/doc[1]
$dir//doc
$dir//*[@io:is-file]
$dir//*[@io:size > 1024]
$dir//*[@io:is-file][@io:extension='xml'][name(..)!='WEB-INF']

What is noticeable is that we don't have in RefleX an XML representation 
of the file system, rather we have objects that behave like XML nodes 
and are traversable/queryable with XPath. This is important for 
performance because we don't have to dump the entire file system.

Remember what asked Roger Costello in a recent post:
	"I oftentimes hear of people creating XML in an Object Oriented
	(OO) form, i.e., as classes and subclasses [...] I wonder if
	such forms are appropriate for XML? Does OO serve the same
	purpose as XML?"

It is a current practice to consider OO on top of XML, I'd rather 
consider XML technologies in the Darwinian sense of computer sciences 
evolution, on top of OOP:
	-Active Tags: everything is XML
	-OOP: everything is object
	-Unix: everything is a file
Having an XML representation of data allows to use powerful tools such 
as XPath/XQuery. Unfortunately most people tend to think about XML 
representation as markups only, whereas it is much more valuable to 
think about XML as its data model: markups are intolerant, the data 
model more flexible.

In Active Tags, the file system is not represented with XML markup, but 
it is an object exposed as XML; if you had to represent in pure XML 
markup a file system, and that you had to get (with XPath or XQuery) the 
modification date of the last file (in sequence) of the last directory 
(in sequence) under the root directory, this strategy would be extremely 
inefficient because you'd have to recursively build the markup of the 
entire file system and nowadays they are somewhat huge. It is much more 
better to deal with the data model and just handle the root directory as 
an XML item and navigate inside during the evaluation of the XPath or 
XQuery query. That way you will reach the expected data without having 
to browse the entire tree.
You can have it with XPath like this: 
io:file('file:///')/*[last()]/*[last()]/@io:last-modified

We can go a step further in the discussion about the relationship 
between OO and XML. Rick Jelliffe pointed out:
	"An object-oriented system is merely one where all the
	characteristics of a thing (typically methods and fields) are
	bundled, and where most or all things are objects."
We agree that OO paradimgs do fit bad in XML markups, but some can fit 
well in the XML data model (this is also why I prefer have XML on top of 
OOP).
This is what I tried to achieve with the Active Schema Language (ASL): 
there is no way to express relationships intrinsically to the data 
(first step to the road of semantic); in this example:
http://reflex.gforge.inria.fr/tutorial-schemas.html#psvi
...an XML weather report contains temperatures expressed in °C and in °F 
that is hard to sort correctly (68°F is less than 21°C); with XQuery one 
would have to design traditionally a specific function for that purpose; 
but with ASL (as shown in the example), one can design a type that 
bundles the expected relationship between temperature units; then the 
general-purpose "sort" function can be used to get the right result. 
This is the way things work in Active Tags.

There are lot of other things that we would be able to do with the data 
model; suppose I have a variable $d with an xs:date within, say 
"2009-11-24"; I would be happy to have:
	$d/@year
	$d/@month
	$d/@day
Now, put that date inside an attribute:
<document creation-date="2009-11-24"/>
I still would be happy to have:
	/document/@creation-date/@year
This is the way things work in Active Tags (but not yet with ASL, sorry).

XML does have outstanding capabilities that we still have to invent.

-- 
Cordialement,

               ///
              (. .)
  --------ooO--(_)--Ooo--------
|      Philippe Poulard       |
  -----------------------------
  http://reflex.gforge.inria.fr/
        Have the RefleX !


[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