Edirom-Online icon indicating copy to clipboard operation
Edirom-Online copied to clipboard

Make all module imports relative

Open bwbohl opened this issue 1 year ago • 0 comments

As pointed out in #349 we sometimes have absolute db paths, which of course could be problematic, as it depends on the install location.

good first issue

This is a good first issue if you want to get involved in the development of Edirom Online, because:

  • it has to be executed on a defined set of files, namely all those in the directories:

    • add/data/xqm, and
    • add/data/xql
  • there is a defined way of finding the portions to check (at the very beginning of each file), e.g.:

    (: IMPORTS ================================================================= :)
    
    import module namespace kwic = "http://exist-db.org/xquery/kwic";
    import module namespace transform="http://exist-db.org/xquery/transform";
    
    import module namespace eutil = "http://www.edirom.de/xquery/util" at "xmldb:exist://db/apps/Edirom-Online/data/xqm/util.xqm";
    
    
  • You do not need experience with XQuery files

  • You can use it to familiarise with both, the Edirom Online codebase, and the XQuery programming language

  • Here is an example fix for the above codeblock:

    1. spot the import module namespace declarations
    • each of them begins on a new line and ends with ;
    • everything before the =can stay as it is
    • if the portion between " and "; is a absolute URI starting with httpor https it can stay as it is
    • if it starts with something else, e.g. xmldb:exist:// and has Edirom-Online in it, change it to a relative link for the file you're currently editing to the file it’s referencing.
    • so for the above (which is taken from Edirom-Online/add/data/xql/search.xql the correct relative URL would be:
    ../xqm/util.xqm
    
    • the complete corrected lin:
        import module namespace eutil = "http://www.edirom.de/xquery/util" at "../xqm/util.xqm";
      

If you have any questions concerning the ticket feel free to contact @bwbohl

bwbohl avatar Feb 21 '24 08:02 bwbohl