Re: XQuery question

From: Costin Cozianu <c_cozianu_at_hotmail.com>
Date: Tue, 13 May 2003 07:56:05 -0700
Message-ID: <b9r0ob$lsfb5$1_at_ID-152540.news.dfncis.de>


Sebastian Schaffert wrote:
> Costin Cozianu wrote:
>
> [transitive relations]
>

>>
>> SQL '99 it's called WITH RECURSIVE. IBM db2 decided that recursive is 
>> superfluous and didn't implement the full options (which are probably 
>> more powerfuil than you need for transitive closure)
>>
>> Here's a DB2 Example:
>>
>> CREATE TABLE Rel (ID integer, Parent integer );
>>
>> WITH MyView ( ID Integer, Ancestor integer)
>> AS ( SELECT  ID , Parent as Ancestor FROM Rel
>>     UNION ALL
>>      SELECT r1.ID, r2.Parent AS Ancestor
>>      FROM Myview r1, Rel r2
>>             WHERE r1.Parent= r2.ID )
>> SELECT * from MyView
>>
>> As you can see MyView is joined recursively with otsel;f in its 
>> definition so that we get the transitive closure.

>
>
> Now, just tell me in which way this is *declarative*, and why SQL is
> less complex than XML query languages...<g>
>

The fact that is declarative is obvious, and if you want me to explain that yo you, I'm at a loss. Either get over it, or else stop the discussion.

Whether or not is simpler than XQuery, let's see. I'm no expert in XQuery or other XML query languages nor do I want to waste my time

Give me the XML query that will give me the trnasitive closure for this one:

	<node id=1 />
	<node id=2 parent_id=1 >
	<!--  ... and so on ... -->

>>>> But in order to do a fair and unbiased comparison I'd like to know if
>>>> XQuery is relationally complete (including the transitive closure of a
>>>> binary relation). 
>>>
>>>

>
> Whether XQuery is relationally complete or not is of no relevance, since
> it is not intended to be so, as the underlying data is not relational,
> it is tree-shaped.
>

That's non-sense. Data is data. It comes from the plural of the latin "datum" which means a "given", therefore data is a collection of (given) facts . "Given facts" are proposition that are true. Relational databases hold a collection of facts and those have no "relational" shape. That's just non-sense good only for marketing brochures.

If you're willing to show me a useful "tree-shaped" logic, I'd be very curious to find out more about that.

>> No, I don't really appreciate that :) Although the rule of XQuery are 
>> quite simple and intuitive, the fact that I have to "encode" my data 
>> model by hanging all data items in a chrsitmas tree, makes me have 
>> very little appreciation if any to XML as a data model (you call that 
>> XML "infoset" or something, I beleive). 

>
>
>
> I prefer encoding my data model as a tree in my data model than encoding
> it in completely ridiculous SQL queries (see above). If the data is
> inherently graph-structured it is much more intuitive to represent it
> graph structured and provide appropriate query languages for it (note: I
> don't think XQuery is appropriate, but this is not the fault of the XML
> data model).
>

You are confused. Graphs and relations are almost indistigusihable from a logical point of view. A tree is a binary relation with certain properties.

>> Plus I don't really see how mixing orthogonal concerns like logical 
>> data structure and physical data encoding (representaition, viz. the 
>> bloody tags) is going to help me in any way shape or form. Dijkstra 
>> told us we can do better decades ago, viz. separtion of concerns, and 
>> Codd was of the same opinion. 

>
>
>
> In fact, XML is all about "logical data structure" and none about
> physical encoding.

This opinion puts you at odds with the honourable XML committee who specified first the encoding, than an inadequate way of representing schema (DTD), later came with XML Schema which is half way to acceptable, as for the XML Infoset which is the abstract "data model" behind XML it is really way behind and probably not official standard at this time.

In any case people when you say XML think about the <xml> </xml> data encoding no matter what you'd like them to think.

> XML is merely a form of tree structured data
> representation which is IMO rather intuitive for the user. How the data
> is stored is a completely different matter. It could be an XML view on a
> relational database. It could also be an XML view on an XML document.
> And it can be a mixture of both (i.e. combined XML view onto multiple,
> heterogeneous databases).
>

Your opinion does not count as long as it is not backed by arguments.

>> This leads in my opinion to way unnecessary complexity. 

>
>
> As for unnecessary complexity, I'd like again to refer to your SQL
> example above.
>

For which you haven't provide a counter example. Show me a general transitive closure (not just recursive descent down the bracnches of a tree) over a binary relation and let's talk after that.

And you also refuse to address the issue whether XQuery is relationally complete and at what cost (viz. query complexity, and runtime performance).

This leaves you currently quite short of any serious arguments other than hand waving. Received on Tue May 13 2003 - 16:56:05 CEST

Original text of this message