[xquery-talk] XQuery file naming conventions (xq, xqy, xql, xqm, xquery, etc.)

Christian Grün christian.gruen at gmail.com
Mon Jan 7 13:49:44 PST 2013

Hi Joe,

in BaseX, .xq is used for main modules and .xqm for library modules
(including RESTXQ modules). The main motivation for this was similar
to yours: .xq is short, there was some need to distinguish between
main and library modules, and there was no convention what would be
the best choice.

The current solution seems quite intuitive to most of our users, but I
agree that your convention makes some sense, and is closer to the
terminology of the XQuery spec.


On Mon, Jan 7, 2013 at 10:33 PM, Joe Wicentowski <joewiz at gmail.com> wrote:
> Hi all,
> There is quite a profusion of file extensions for XQuery: .xq, .xqy,
> .xql, .xqm, and .xquery.  Perhaps this profusion has happened the spec
> doesn't say anything about the file extensions.  This has opened up
> the choice to each implementation and each community/project.  I'd be
> interested to know which communities use which file naming
> conventions, and if there is any consensus?  What do you use, and why?
> My experience: When I first started learning XQuery I used .xq for
> everything -- I guess because it's short.  oXygen uses .xquery as its
> default file extension for XQuery files but recognizes all of the
> above as XQuery files.  The MarkLogic community seems to use .xqy.
> When I started to write library modules I started to use .xqm, with
> the 'm' indicating module.  I saw yet others in the eXist-db community
> using .xql, though it allows all of the above.  Github doesn't
> currently recognize .xql or .xqm as XQuery [1].  Diversity is fine,
> but the downside is that newcomers are certainly confused, and anytime
> we share code there is no reliable way to know whether a file is a
> library or main module without opening it up.
> The spec does make a distinction that seems to apply to XQuery files.
> It states that there are two kinds of modules: *library* modules and
> *main* modules.  The distinction is that library modules contain only
> functions, whereas main modules contain a single main routine (though
> can also contain function declarations).  (See these two terms defined
> in the spec at http://www.w3.org/TR/xquery/#dt-library-module and
> http://www.w3.org/TR/xquery/#dt-main-module.)
> It seems to me that any good XQuery file naming convention should
> reflect this distinction between *library* and *main* modules.
> After thinking about this, I think .xql and .xqm make good candidates
> for a file naming convention, since they mnemonically reflect the
> distinction between library (L) and main (M).  Where does that leave
> .xq, .xqy, or .xquery?  I guess they're acceptable alternatives to .xq
> for main modules, but in my own new projects I think I'm going to go
> with .xql and .xqm.
> What practices do you use?  What do you think?  Does your
> implementation/community document your practice?
> Joe
> [1] https://github.com/github/linguist/blob/master/lib/linguist/languages.yml.
>  I've submitted a pull request to add .xql and .xqm,
> https://github.com/github/linguist/pull/338.
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk

More information about the talk mailing list