Daniela Florescu
2010-07-24 20:59:00 UTC
Hello everybody,
That was a very interesting discussion, thank you all.
I was trying to learn from the feedback we've got for my question
"What's wrong with XQuery?".
I tried to compile the answers into something that I could understand,
and I thought that
it may be interesting to share it.
I did put together a list of citations from this thread, together with
the author's email address.
Hope that helps, have a good weekend,
Dana
========================================================================
========================================================================
A. Language issues
=================
A.1) General limitations of the language
-------------------------------------------------------
**** If your input xml is in no namespace, and your output xml changes
the default namespace (such as a bog standard xml -> xhtml transform)
then you hit that massive issue of the xpath default namespace change.
andrew.j.welch-***@public.gmane.org
**** In a "process it if its there" scenario which is very common in
xml
transforms, you have to constantly check if the input is there before
creating the output structure:
andrew.j.welch-***@public.gmane.org
**** In XQuery, I have to jump through hoops with
closures to return two sequences from a function
int19h-***@public.gmane.org
**** I can't describe types in XQuery
itself, and XML Schema is such a pain to deal with, with multiple
limitations and quirks, not to mention a completely different syntax.
int19h-***@public.gmane.org
**** dynamic typing on XQuery is even more lax then usual
int19h-***@public.gmane.org
**** the lack of type polymorphism is also limiting for a
language with explicit type declarations.
int19h-***@public.gmane.org
**** lacking virtual function dispatch based on the argument types
sokolov-vDdCxMo47w5Wk0Htik3J/***@public.gmane.org
A.2) Missing useful features from XSLT
------------------------------------------------------
**** It seems that the apply-template and template/@match, so far,
cannot
be done against an XML DB.
rob-/p3dT1ntlUHQT0dZR+***@public.gmane.org
**** you could have something analogous to apply-templates (at least
for element types), even if not the full pattern-matching.
sokolov-vDdCxMo47w5Wk0Htik3J/***@public.gmane.org
**** Even something like a simple "match" statement, analogous to
switch but matching against patterns, would significantly improve
XQuery transformations
int19h-***@public.gmane.org
****The recursive typeswitch is no substitute for XSLT's recursive
descent...
andrew.j.welch-***@public.gmane.org
A.3) Not complete as a programming language
-----------------------------------------------------------------
**** XQuery is turing complete, but other than that, it is not a
complete
programming language
mail-2udWM7XjvTsOyoagqWviFgC/***@public.gmane.org
**** in 1.0 (the stable spec so far) we have a pure, declarative
language which doesn't
have functions as first-class values. So it's neither truly
functional, and not at all imperative.
int19h-***@public.gmane.org
**** For a general-purpose language, that's weak - how am I supposed
to write concise code, or reuse it, to
the same extent I'm used to in other modern languages?
int19h-***@public.gmane.org
**** XQuery isn't a general purpose language - it doesn't
provide a complete programming environment, for example through the
lack of data types.
mail-2udWM7XjvTsOyoagqWviFgC/***@public.gmane.org
**** one very quickly runs into needing to use vendor specific
extensions/hacks
jdmitchell-***@public.gmane.org
B. Architectural Issue.
==================
B.1) Does not satisfy well the semi-structured data /programmatic
data camp.
----------------------------------------------------------------------------------------------------------
**** the need for good languages which support the growth of semi-
structured and what I've been calling ad hoc structured data models
jdmitchell-***@public.gmane.org
**** there is data exchanged for programmatic purposes, where XML
sucks and JSON wins.
mail-2udWM7XjvTsOyoagqWviFgC/***@public.gmane.org
**** XML good (though overcomplicated) for trees, tolerable though
bloated for
linear data, and horrible for free-form graphs.
int19h-***@public.gmane.org
**** XML is great for markup
and semi-structured content, but it's really no good data model to
program against generally. Part of this comes from the difference
between node-labeled trees and edge-labled trees, but mostly it is
that XML exposes a lot of underlying complexity necessary for markup
use cases, and even if you try to abstract that, it will leak.
mail-2udWM7XjvTsOyoagqWviFgC/***@public.gmane.org
B.2. Does not integrate well yet with client software
---------------------------------------------------------------------
**** we need to make XML work better inside of existing Web 2.0 AJAX
frameworks by adding a MVC abstraction
awspyker-***@public.gmane.org
**** With JavaScript getting faster, I reiterate my idea that a
JavaScript library be built.
brettz9-/***@public.gmane.org
B.3. XML and JSON
-------------------------------
**** how to create a XML to JSON reversible lossless translation that
results is "good" markup on both sides
dlee-***@public.gmane.org
**** the future is going to see XQuery as a specialty
technology used in content management applications, and JSON databases
taking market share from relational databases.
mail-2udWM7XjvTsOyoagqWviFgC/***@public.gmane.org
**** how are you going to tweak the xquery language to be json focused
(or at least parity) w.r.t. xml?
jdmitchell-***@public.gmane.org
**** JSON is "good enough" to
generalize XML. And one could reasonably argue that it makes more
sense that way, because there are noticeably fewer concepts in JSON
than there are in XDM (or Infoset).
int19h-***@public.gmane.org
C. Performance
=============
**** I don't think the optimizers are good enough to handle it
automagically on their own in
all cases, either.
int19h-***@public.gmane.org
**** Performance behavior should be predictable over different
implementation
int19h-***@public.gmane.org
**** you are the optimizer, ie fiddle with until you get the best
performance.
sokolov-vDdCxMo47w5Wk0Htik3J/***@public.gmane.org
**** does xquery really lend itself to that sort of optimization?
sokolov-vDdCxMo47w5Wk0Htik3J/***@public.gmane.org
D. Portability
===========
**** You spend the rest of the day massaging it so that it actually
runs with reasonable
performance. And then you switch the backend and find out that your
query plan is totally different.
int19h-***@public.gmane.org
**** some way to explicitly
request eager and - especially! - lazy behavior would be extremely
handy for portable code.
int19h-***@public.gmane.org
**** portability is
important if you want third-party libraries and frameworks to appear
(and not immediately fragment between implementations).
int19h-***@public.gmane.org
E. Existing XQuery-related Software
============================
**** there are still those of us devs who have our own personal sites
and want a toy to play with, that will remain ours and don't need to
pay anything extra for it, especially if we're mostly just learning it
to use it for hobby coding or small existing sites, train ourselves,
etc. I think it would be great to have both options available...
brettz9-/***@public.gmane.org
**** People want stuff that's superfast and scalable but don't want to
have to pay for it.
jdmitchell-***@public.gmane.org
**** the XQuery implementation(s) aren't part of any of the standard,
el-cheapo shared hosting bundles
jdmitchell-***@public.gmane.org
**** so many vendors held various aspects of the language, libraries,
tooling hostage for their own benefit/purposes
jdmitchell-***@public.gmane.org
**** There's the vendor lock-in problems.
jdmitchell-***@public.gmane.org
F. Tools
=======
**** Development tools for other languages are cheap or even free, yet
powerful
and full-featured.
int19h-***@public.gmane.org
G. Libraries
=========
**** Libraries and frameworks? you get an implementation, typically
on top of
an XML database, providing various proprietary frameworks of its own
tied to that implementation. So if you want to write a full-fledged
app, you get vendor lock-in all the way down.
int19h-***@public.gmane.org
*** the development of good libraries/frameworks is hampered
by language limitations
int19h-***@public.gmane.org
H. Marketing, standards, positioning and perception
=========================================
**** XQuery is just *not* an interesting topic. It had it's hype
heyday and it didn't capitalize on that and so its mindshare (and
hypeshare) are low.
jdmitchell-***@public.gmane.org
**** Even if we were to stipulate that technically it is a general
purpose programming language, the perception of basically everybody is
that it's not.
jdmitchell-***@public.gmane.org
**** Nobody submitted a session on xquery.
jdmitchell-***@public.gmane.org
**** XQuery suffers from it being tied so directly with all of the
hype of "XML".
jdmitchell-***@public.gmane.org
**** XQuery suffers from its history in the standardization by
committee hell.
jdmitchell-***@public.gmane.org
**** it took forever for there to be a standard
jdmitchell-***@public.gmane.org
**** The "XML is evil" problem.
jdmitchell-***@public.gmane.org
**** Even with all of the latest updates to xquery, it's 2010 and
frankly it's still a mess.
jdmitchell-***@public.gmane.org
*** The only advantage of XQuery that I see is its concise syntax.
Everything else is mediocre or sub-par.
int19h-***@public.gmane.org
**** XQuery with its strange data model, its mix of syntactic styles,
its odd combination of weak and strong type checking, and its confused
positioning between a database query language, an XML transformation
language, and a general-purpose web programming language.
mike-JkSD5nQpfvpWk0Htik3J/***@public.gmane.org
That was a very interesting discussion, thank you all.
I was trying to learn from the feedback we've got for my question
"What's wrong with XQuery?".
I tried to compile the answers into something that I could understand,
and I thought that
it may be interesting to share it.
I did put together a list of citations from this thread, together with
the author's email address.
Hope that helps, have a good weekend,
Dana
========================================================================
========================================================================
A. Language issues
=================
A.1) General limitations of the language
-------------------------------------------------------
**** If your input xml is in no namespace, and your output xml changes
the default namespace (such as a bog standard xml -> xhtml transform)
then you hit that massive issue of the xpath default namespace change.
andrew.j.welch-***@public.gmane.org
**** In a "process it if its there" scenario which is very common in
xml
transforms, you have to constantly check if the input is there before
creating the output structure:
andrew.j.welch-***@public.gmane.org
**** In XQuery, I have to jump through hoops with
closures to return two sequences from a function
int19h-***@public.gmane.org
**** I can't describe types in XQuery
itself, and XML Schema is such a pain to deal with, with multiple
limitations and quirks, not to mention a completely different syntax.
int19h-***@public.gmane.org
**** dynamic typing on XQuery is even more lax then usual
int19h-***@public.gmane.org
**** the lack of type polymorphism is also limiting for a
language with explicit type declarations.
int19h-***@public.gmane.org
**** lacking virtual function dispatch based on the argument types
sokolov-vDdCxMo47w5Wk0Htik3J/***@public.gmane.org
A.2) Missing useful features from XSLT
------------------------------------------------------
**** It seems that the apply-template and template/@match, so far,
cannot
be done against an XML DB.
rob-/p3dT1ntlUHQT0dZR+***@public.gmane.org
**** you could have something analogous to apply-templates (at least
for element types), even if not the full pattern-matching.
sokolov-vDdCxMo47w5Wk0Htik3J/***@public.gmane.org
**** Even something like a simple "match" statement, analogous to
switch but matching against patterns, would significantly improve
XQuery transformations
int19h-***@public.gmane.org
****The recursive typeswitch is no substitute for XSLT's recursive
descent...
andrew.j.welch-***@public.gmane.org
A.3) Not complete as a programming language
-----------------------------------------------------------------
**** XQuery is turing complete, but other than that, it is not a
complete
programming language
mail-2udWM7XjvTsOyoagqWviFgC/***@public.gmane.org
**** in 1.0 (the stable spec so far) we have a pure, declarative
language which doesn't
have functions as first-class values. So it's neither truly
functional, and not at all imperative.
int19h-***@public.gmane.org
**** For a general-purpose language, that's weak - how am I supposed
to write concise code, or reuse it, to
the same extent I'm used to in other modern languages?
int19h-***@public.gmane.org
**** XQuery isn't a general purpose language - it doesn't
provide a complete programming environment, for example through the
lack of data types.
mail-2udWM7XjvTsOyoagqWviFgC/***@public.gmane.org
**** one very quickly runs into needing to use vendor specific
extensions/hacks
jdmitchell-***@public.gmane.org
B. Architectural Issue.
==================
B.1) Does not satisfy well the semi-structured data /programmatic
data camp.
----------------------------------------------------------------------------------------------------------
**** the need for good languages which support the growth of semi-
structured and what I've been calling ad hoc structured data models
jdmitchell-***@public.gmane.org
**** there is data exchanged for programmatic purposes, where XML
sucks and JSON wins.
mail-2udWM7XjvTsOyoagqWviFgC/***@public.gmane.org
**** XML good (though overcomplicated) for trees, tolerable though
bloated for
linear data, and horrible for free-form graphs.
int19h-***@public.gmane.org
**** XML is great for markup
and semi-structured content, but it's really no good data model to
program against generally. Part of this comes from the difference
between node-labeled trees and edge-labled trees, but mostly it is
that XML exposes a lot of underlying complexity necessary for markup
use cases, and even if you try to abstract that, it will leak.
mail-2udWM7XjvTsOyoagqWviFgC/***@public.gmane.org
B.2. Does not integrate well yet with client software
---------------------------------------------------------------------
**** we need to make XML work better inside of existing Web 2.0 AJAX
frameworks by adding a MVC abstraction
awspyker-***@public.gmane.org
**** With JavaScript getting faster, I reiterate my idea that a
JavaScript library be built.
brettz9-/***@public.gmane.org
B.3. XML and JSON
-------------------------------
**** how to create a XML to JSON reversible lossless translation that
results is "good" markup on both sides
dlee-***@public.gmane.org
**** the future is going to see XQuery as a specialty
technology used in content management applications, and JSON databases
taking market share from relational databases.
mail-2udWM7XjvTsOyoagqWviFgC/***@public.gmane.org
**** how are you going to tweak the xquery language to be json focused
(or at least parity) w.r.t. xml?
jdmitchell-***@public.gmane.org
**** JSON is "good enough" to
generalize XML. And one could reasonably argue that it makes more
sense that way, because there are noticeably fewer concepts in JSON
than there are in XDM (or Infoset).
int19h-***@public.gmane.org
C. Performance
=============
**** I don't think the optimizers are good enough to handle it
automagically on their own in
all cases, either.
int19h-***@public.gmane.org
**** Performance behavior should be predictable over different
implementation
int19h-***@public.gmane.org
**** you are the optimizer, ie fiddle with until you get the best
performance.
sokolov-vDdCxMo47w5Wk0Htik3J/***@public.gmane.org
**** does xquery really lend itself to that sort of optimization?
sokolov-vDdCxMo47w5Wk0Htik3J/***@public.gmane.org
D. Portability
===========
**** You spend the rest of the day massaging it so that it actually
runs with reasonable
performance. And then you switch the backend and find out that your
query plan is totally different.
int19h-***@public.gmane.org
**** some way to explicitly
request eager and - especially! - lazy behavior would be extremely
handy for portable code.
int19h-***@public.gmane.org
**** portability is
important if you want third-party libraries and frameworks to appear
(and not immediately fragment between implementations).
int19h-***@public.gmane.org
E. Existing XQuery-related Software
============================
**** there are still those of us devs who have our own personal sites
and want a toy to play with, that will remain ours and don't need to
pay anything extra for it, especially if we're mostly just learning it
to use it for hobby coding or small existing sites, train ourselves,
etc. I think it would be great to have both options available...
brettz9-/***@public.gmane.org
**** People want stuff that's superfast and scalable but don't want to
have to pay for it.
jdmitchell-***@public.gmane.org
**** the XQuery implementation(s) aren't part of any of the standard,
el-cheapo shared hosting bundles
jdmitchell-***@public.gmane.org
**** so many vendors held various aspects of the language, libraries,
tooling hostage for their own benefit/purposes
jdmitchell-***@public.gmane.org
**** There's the vendor lock-in problems.
jdmitchell-***@public.gmane.org
F. Tools
=======
**** Development tools for other languages are cheap or even free, yet
powerful
and full-featured.
int19h-***@public.gmane.org
G. Libraries
=========
**** Libraries and frameworks? you get an implementation, typically
on top of
an XML database, providing various proprietary frameworks of its own
tied to that implementation. So if you want to write a full-fledged
app, you get vendor lock-in all the way down.
int19h-***@public.gmane.org
*** the development of good libraries/frameworks is hampered
by language limitations
int19h-***@public.gmane.org
H. Marketing, standards, positioning and perception
=========================================
**** XQuery is just *not* an interesting topic. It had it's hype
heyday and it didn't capitalize on that and so its mindshare (and
hypeshare) are low.
jdmitchell-***@public.gmane.org
**** Even if we were to stipulate that technically it is a general
purpose programming language, the perception of basically everybody is
that it's not.
jdmitchell-***@public.gmane.org
**** Nobody submitted a session on xquery.
jdmitchell-***@public.gmane.org
**** XQuery suffers from it being tied so directly with all of the
hype of "XML".
jdmitchell-***@public.gmane.org
**** XQuery suffers from its history in the standardization by
committee hell.
jdmitchell-***@public.gmane.org
**** it took forever for there to be a standard
jdmitchell-***@public.gmane.org
**** The "XML is evil" problem.
jdmitchell-***@public.gmane.org
**** Even with all of the latest updates to xquery, it's 2010 and
frankly it's still a mess.
jdmitchell-***@public.gmane.org
*** The only advantage of XQuery that I see is its concise syntax.
Everything else is mediocre or sub-par.
int19h-***@public.gmane.org
**** XQuery with its strange data model, its mix of syntactic styles,
its odd combination of weak and strong type checking, and its confused
positioning between a database query language, an XML transformation
language, and a general-purpose web programming language.
mike-JkSD5nQpfvpWk0Htik3J/***@public.gmane.org