[xquery-talk] Top N Most Common Mistakes [SEC=UNCLASSIFIED]

Nicholas.Ardlie at ga.gov.au Nicholas.Ardlie at ga.gov.au
Tue Aug 14 11:51:03 PDT 2007


>> I think the interesting thing is that, when I finally figure out what the
>> actual query is and what the schema structures I want to work with are,
>> writing the XQuery query is almost trivial. No idea if this is a common
>> experience, but it does make me like using XQuery.

This has been my experience too Ron.
I developed an encoding tool that auto-generates XML schemas from XMI
representations of UML models.
The XMI model is a beast and to deal with the fragmented/linked nature of the
instance docs (and generic tagged values) I resorted to XQuery.
I anticipated that my XQuery module collection would explode as time went on
but, to my surprise, it remained relatively simple.
Like you say, most of the work was determining XPaths for the input model (in
the absence of documentation). It's quite impressive how compact the code can
be.

My initial hurdles with XQuery were mostly XPath 2 related. A better
understanding of sequence expressions certainly helped.

Debugging mysteriously empty sequences is a pain and a good unit testing
framework would go a long way. (I've tried a few of the xslt unit testing
frameworks but it's like pulling teeth). Has anyone had a better experience
with unit testing for XQuery?

Cheers,
Nick Ardlie.


-----Original Message-----
From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf Of
rpbourret at rpbourret.com
Sent: Tuesday, 14 August 2007 4:24 AM
To: Smith, Donald T.; talk at x-query.com
Subject: RE: [xquery-talk] Top N Most Common Mistakes

On Mon, 13 Aug 2007 13:11:43 -0500, Smith, Donald T. wrote
> Ron,
> 
> Curious if the schemas you are facing are mostly machine generated (that
> is, from some IDE) or if they are hand-crafted. And if hand-crafted, 
> do they show any discernable design patterns (by which I mean XML Schema
> design patterns). Do any of these issues make the schemas easier or
> harder to learn?
> 
> Don

As far as I know, they're hand generated, based on some ISO specs in the
geographic world. I've had two major problems:

1) Learning the subject matter itself (geographic metadata)

2) Working with extremely generic XML of the style:

   <Parameter Name="foo">
      <Value>bar</Value>
   </Parameter>

   It's actually much worse than that, with parameters allowing a choice of
stuff instead of just values. There are a fair number of co-constraints (i.e.
if the parameter is of this type, we always use this form of parameter) but
these aren't documented anywhere.

There are also a number of referential structures (i.e. take the value of
this
element and go look up another element with an attribute having the same
value).

I wouldn't say that the schemas are really all that complex, it's just the
usual learning curve of a consultant getting dumped into an unfamiliar
environment and being expected to know everything at once.

I think the interesting thing is that, when I finally figure out what the
actual query is and what the schema structures I want to work with are,
writing the XQuery query is almost trivial. No idea if this is a common
experience, but it does make me like using XQuery.

-- Ron
_______________________________________________
talk at x-query.com
http://x-query.com/mailman/listinfo/talk



More information about the talk mailing list