XQL Challenge (also, Design for Queryability)
Roger Costello
costello at mitre.org
Mon Jul 5 15:23:31 BST 1999
Hi Folks,
I have created an XML document that contains Cellphone data.
I have organized the data in this XML document similar to how
it might be organized in a database:
- one subtree contains Cellphone hardware data (weight,
battery, etc).
- one subtree contains Cellphone feature data (caller id, one
touch dialing, etc).
- one subtree maps Cellphone hardware data to Cellphone feature
data (in databases this would be called an "association
table").
Why am I organizing the data in this fashion? My hope is that
this approach will facilitate queryability of the data. That
remains to be seen ...
Here's a sample query that I would like to perform:
"What features does the NOKIA 252 Cellphone have?"
If the data were in a database, such a query would be simple:
SELECT features.name
FROM features, cellphones, cellphone-features
WHERE features.id = cellphone-features.feature-id AND
cellphone-features.cellphone-id = cellphones.id AND
cellphones.brand = "NOKIA" AND
cellphone.model = "252"
I am thinking (hoping) that I can perform a similar type of
query using XQL. Here's what I tried (among many other attempts):
cellphone-catalog/features
[cellphone-catalog/cellphone-features/cellphone-feature/@feature-idref
= @id
$and$
cellphone-catalog/cellphone-features/cellphone-feature/@cellphone-idref
= 'NOKIA-252']
This XQL query doesn't work (it returns the empty set).
Below is sample data from my Cellphone XML document. Any thoughts
on how to structure the XQL query? /Roger
<?xml version="1.0"?>
<cellphone-catalog>
<cellphones>
<model brand="NOKIA" name="252" technology="analog"
id="NOKIA-252">
<dimension units="inches">
<height>6 5/8</height>
<width>1 7/8</width>
<thickness>1</thickness>
</dimension>
<weight units="ounces">6</weight>
<battery type="nickel-cadmium">1100 mAh</battery>
<talk-time units="minutes">132</talk-time>
<standby-time units="hours">32</standby-time>
<price currency="$US" with-contract="false">400</price>
<price currency="$US" with-contract="true">180</price>
</model>
</cellphones>
<features>
<Authentication id="Authentication"/>
<RingerAndEarpieceVolumeControl
id="RingerAndEarpieceVolumeControl"/>
<BatteryStrengthIndicator id="BatteryStrengthIndicator"/>
<AudibleKeypadControls id="AudibleKeypadControls"/>
<DTMF-KeytoneSignalling id="DTMF-KeytoneSignalling"/>
<One-YearPartsAndLaborWarranty
id="One-YearPartsAndLaborWarranty"/>
<StoresNamesAndNumbers id="StoresNamesAndNumbers"/>
<OneTouchDialing id="OneTouchDialing"/>
<CallerID id="CallerID"/>
</features>
<cellphone-features>
<cellphone-feature cellphone-idref="NOKIA-252"
feature-idref="OneTouchDialing"/>
<cellphone-feature cellphone-idref="NOKIA-252"
feature-idref="CallerID"/>
</cellphone-features>
</cellphone-catalog>
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list