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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: XML-QL Follow up

[ Lists Home | Date Index | Thread Index ]
  • From: Gerald Huck <huck@darmstadt.gmd.de>
  • To: "'xml-dev@ic.ac.uk'" <xml-dev@ic.ac.uk>
  • Date: Wed, 28 Oct 1998 10:59:46 +0100

At GMD-IPSI, we have a tool called Jedi which is able to
perform SQL/OQL like queries based on internal
DOM representations of XML documents.

XML element constructors serve the construction of a new DOM
in the select-clause. Embedding the query result elements within one result 
element and
XML document constructor, this is all what is needed to generate a
new XML document (which can be written to a file, stdout, ...).

The from part defines where the data needs to be fetched from and offers
join functionality. Join predicates or other selection predicates can be 
given in the where clause.

Access to the queried XML document and its content is realized on top of 
DOM methods.
These are either exposed directly or implement short hand operators,
e.g. 'element.attribute' to access element attributes
or 'element["name"]' to access the first child element named "name".

In the following i give a fairly complex query which constructs a new
XML document from three sources, combining local weather forecasts,
traveling information and golfclub information to provide an
'integrated' view on multiple sources.

The XML "records" of the original sources look like:

<golfclub id="platz0001" 
href="http://www.golffuehrer.de/scripts/ab2.idc?CLUBNR=0001">
	<address>
		<club>Golf- und Land-Club Berlin Wannsee e.V.</club>
		<street>Golfweg 22</strasse>
		<zipcode>14109</zipcode>
		<city>Berlin</city>
		<telephone>030-8067060</telephone>
		<fax>-80670610</fax>
	</address>
	<greenfee>
		<normal>100</normal>
		<weekend>120</weekend>
	</greenfee>
	<info>
		<description>Die Anlage liegt in einer idyllischen markischen Landschaft 
und bietet fur Golfer jeder Spielstarke aufgrund des machtigen 
Baumbestandes und teilweise erheblichen Gelandeschwierigkeiten sowohl eine 
hohe sportliche Herausforderung als auch ein landschaftliches Erlebnis. 
Enge Bahnen erfordern einen prazisen geraden Drive.</description>
		<holes>18</holes>
		<length>6088</length>
	</info>
	<policy>Gaste sind willkommen. Clubausweis mit eingetragenem Hdc (34) ist 
erforderlich. Gaste in Mitgliederbegleitung und nach Voranmeldung.</policy>
	<handicap>
		<normal>34</normal>
		<weekend>34</weekend>
	</handicap>
</golfclub>
------------------------------------------
<route>
	<from>53757</from>
	<to>93333</to>
	<distance>481.9</distance>
	<time>274</time>
	<map>5375793333.gif</map>
</route>
------------------------------------------
<weather>
	<zipcode>87724</zipcode>
	<date>980922</date>
	<temperature>15</temperature>
	<rainprob>10</rainprob>
	<wind>9</wind>
	<forecast>11</forecast>
</weather>

------------------------------------------

QUERY:

XML.Document(
<queryresult> // constructor for result element
  select
	// generates XML-Elements containing information about golf-links,
	// current weather information and travel information
	<golfclub  id=golfclub.id  href=golfclub.href> // setting attributes from 
original attributes
		// inserting original golfclub record children as new children
		golfclub.children(),
		// inserting information from other documents
		weather,
		route
	</golfclub>
  from
	route in (
		// all routes which are less than 50km from start city
		select r
		from r in XML.Document("route.xml").descendants("route") // instantiates 
DOM and gets route elements
		where r["from"].text() == "50987"		// Zipcode of city where travel starts
			and route["distance"].double() < 50.0
		),
	golfclub in (
		// all golfclubs with a normal greenfee < 80 DM
		select g
		from g in XML.Document("golf.xml").descendants("golfclub")
		where g["address"]["zipcode"].text()==r["to"].text() // join with route
			and g["greenfee"]["normal"].int() < 80
		),
	weather in (
		select w
		from w in XML.Document("weather.xml").descendants("weather")
		where w["zipcode"].text()==r["to"].text()
		)
</queryresult>
)

------------------------
USAGE
We use this query language within a XML broker architecture.
A Web demo will hopefully be available from our Web server soon
(It requires IE5beta currently to render XML results - not used by everyone 
:-))

------------------------
IMPORTANT NOTE

The presented query facilities have NOT BEEN TAILORED to XML specifics.
Rather, the presented query facilities are part of Jedi's scripting 
capabilities.
Jedi offers flexible means to generate wrappers for arbitrary textual 
sources
(based on a failure tolerant parser), as well as to other sources, e.g. 
accessible
via JDBC.

The query language is only a simple mean to provide (integrated) views.
Therefore, Jedi supports other application scenarios as well:
	- extracting semi-structured data from text documents, modeling them in 
XML
		(used in a BIO-Informatics project)
	- accessing XML docs, storing them in a relational DBMS
	- converting relational data to XML documents
	- accessing Java objects
	- merging different modeling paradigms within one scripting language,
	  offering uniform syntactic access to all of them.

For further information, you can visit Jedi's homepage at:
	http://www.darmstadt.gmd.de/oasys/projects/jedi/index.html

However, the available material concentrates on the built-in failure 
tolerant parser
but detailed descriptions about the scripting facilities are still missing.
( The current language is simple, but proprietary - we try to adapt it to
ECMA-Script as much as possible, but will keep query extensions and
XML constructors for convenience. )

Gerald Huck
German National Research Center for Information Technology (GMD-IPSI)




xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)





 

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

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