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

Adam Retter adam.retter at googlemail.com
Tue Jan 8 01:19:49 PST 2013


Joe,

I currently do the opposite to you, I adopted this because some eXist
folks were doing it before me.

i.e. .xql for main modules (XQuery Language) and .xqm for library
modules (XQuery Module).

However now I think about it, it does not make as much sense as your
proposal of reversing it.

I think as David says, we first have to think about whether there
should be a distinction in the naming between main modules and library
modules.
However, I would note that David's suggestion to use .x could be
problematic. As .x is already used for DirectX model files.

On 7 January 2013 21:33, 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



-- 
Adam Retter

skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk


More information about the talk mailing list