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

Joe Wicentowski joewiz at gmail.com
Mon Jan 7 13:33:22 PST 2013

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

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?


[1] https://github.com/github/linguist/blob/master/lib/linguist/languages.yml.
 I've submitted a pull request to add .xql and .xqm,

More information about the talk mailing list