Re: Morgana and Schematron configuration question

Hi David,
The NullPointer comes from the compilation of Schematron to XSLT, so I would like to see the Schematron document in order to see, what went wrong there.
Is there a change you mail me the "adj-paradigms-in-dictionary.sch"?
Thanks,
Achim
------------------------------------------------
Achim Berndzen
achim.berndzen@xml-project.com

<xml-project /> Achim Berndzen
Kleine Breite 26a
38302 Wolfenbüttel, Germany

http://www.xml-project.com

> Am 03.10.2020 um 16:56 schrieb David Birnbaum <djbpitt@gmail.com>:
> 
> Thank you, Martin and Achim. Raising an error (in the next release) will help. 
> 
> For what it's worth, I did see, in the documentation, the advice that "This is done by using -config=uri-or-path as first element on the command line", but I misunderstood it. I was confused, when I first began using Morgana, by how Morgana expects options to follow the name of the file being processed, e.g., the correct Morgana.sh filename.xpl -xslt-connector=Saxon10 rather than the incorrect Morgana.sh -xslt-connector=Saxon10 filename.xpl. I had initially expected the latter because so many other applications and commands put command-line options (with leading "-" characters) before the target of the operation. Having learned that Morgana wants the filename before the options, when I read the instruction to put the -config option first, I misunderstood it as "the first option, but all options still follow the filename". Allowing options to appear in any order would be helpful, but I understand that parsing command-line options can be a time sink, and that the effort that would require might better be applied to functionality and features.
> 
> In any case, changing the order enabled Morgana to find the SchXSLT XSLT stylesheets, although only to yield a null pointer exception: 
> 
> djb@koala-4 adj % zsh /opt/morgana/MorganaXProc-IIIse-0.9.4.2-beta/Morgana.sh -config=/opt/morgana/MorganaXProc-IIIse-0.9.4.2-beta/config.xml adj.xpl -xslt-connector=Saxon10 -xquery-connector=Saxon10
> =================================
> MorganaXProc-IIIse 0.9.4.2-beta
> Copyright 2011-2020 by <xml-project /> Achim Berndzen
> =================================
> 
> [17:41:26.956] Selecting adjectives from dictionary
> Using Saxon-EE 10.0. XSLT and XQuery processor developed by Saxonica Limited
> [17:41:29.243] Verifying that all paradigms in dictionary are in paradigms file
> Using Saxon-EE 10.0. XSLT and XQuery processor developed by Saxonica Limited
> SchXslt is copyright (c) 2018-2020 by David Maus <dmaus@dmaus.name> and released under the terms of the MIT license.
> <?xml version="1.0" encoding="UTF-8"?>
> <c:errors xmlns:c="http://www.w3.org/ns/xproc-step"><c:error code="err:XC0151" name="!1.4" type="p:validate-with-schematron" href="file:///Users/djb/repos/cz/pos/adj/adj.xpl" line="35" column="31" xmlns:p="http://www.w3.org/ns/xproc" xmlns:err="http://www.w3.org/ns/xproc-error"><message>Error occurred: null [java.lang.NullPointerException]</message></c:error></c:errors>
> 
> It does this both with the real Schematron and with a minimal test Schematron file (that is, one that never matches anything in the document), so I don't think the Schematron file is the source of the problem. I'm not sure where to look next. The beginning of the XProc is:
> 
>   <!-- ================================================================ -->
>   <!-- Set up primary ports                                             -->
>   <!--                                                                  -->
>   <!-- Source is empty because it is read with XQuery set               -->
>   <!-- ================================================================ -->
>   <p:input port="source" sequence="true">
>     <p:empty/>
>   </p:input>
>   <p:output port="result" sequence="true"/>
> 
>   <!-- ================================================================ -->
>   <!-- Read, filter, and wrap adjectives                                -->
>   <!-- ================================================================ -->
>   <p:identity message="Selecting adjectives from dictionary"/>
>   <p:xquery>
>     <p:with-input port="query">
>       <p:inline content-type="application/xml">
>         <words>{{doc("../../dictionary.xml")/words/item[type/@partOfSpeech eq "A"]}}</words>
>       </p:inline>
>     </p:with-input>
>   </p:xquery>
> 
>   <!-- ================================================================ -->
>   <!-- Verify that all paradigms in dictionary are in paradigms file    -->
>   <!-- ================================================================ -->
>   <p:identity message="Verifying that all paradigms in dictionary are in paradigms file"/>
>   <p:validate-with-schematron>
>     <p:with-input port="schema" href="adj-paradigms-in-dictionary.sch"/>
>   </p:validate-with-schematron>
> 
> The files all exist in the designated locations (the Schematron file is in the same directory as the XProc). If I remove the Schematron validation step and move to the next one, which applies an XSLT transformation, it works correctly, which confirms that the input is being read correctly.
> 
> If it looks as if I'm missing something (else) that should be obvious, I would be grateful for a nudge.
> 
> Best,
> 
> David
> 
> On Sat, Oct 3, 2020 at 5:54 AM Achim Berndzen <achim.berndzen@xml-project.com> wrote:
> Hi David,
> I think that Martin is right: The problem raises from the fact, that "-config" is expected to be the first element on the command line. In any other position it is ignored, so MorganaXProc is not configured the way you expect it.
> 
> In the next version of MorganaXProc, I changed the command line behavior: Now either -config is the first element on the command line or an error is raised to tell you about the problem.
> 
> Greetings from Germany,
> Achim
> ------------------------------------------------
> Achim Berndzen
> achim.berndzen@xml-project.com
> 
> <xml-project /> Achim Berndzen
> Kleine Breite 26a
> 38302 Wolfenbüttel, Germany
> 
> http://www.xml-project.com
> 
> > Am 02.10.2020 um 21:22 schrieb David Birnbaum <djbpitt@gmail.com>:
> > 
> > Daer xproc-dev,
> > 
> > I'm stumbling over configuring Schematron validation in MorganaXProc-IIIse 0.9.4.2-beta and I would be grateful if someone could help me track down where I've done astray. All of the Morgana functionality seems to be working except Schematron. I've done the following:
> > 
> >       • Installed Morgana at /opt/morgana/MorganaXProc-IIIse-0.9.4.2-beta/. It runs as expected.
> >       • Copied saxon-ee-10.0.jar into /opt/morgana/MorganaXProc-IIIse-0.9.4.2-beta/MorganaXProc-IIIse_lib. Morgana finds and uses Saxon when I run zsh /opt/morgana/MorganaXProc-IIIse-0.9.4.2-beta/Morgana.sh $1 -xslt-connector=Saxon10 -xquery-connector=Saxon10 on the command line.
> >       • To try to use Schematron I then:
> >               • Copied schxslt-1.5.1.jar into that same Morgana lib subdirectory.
> >               • Downloaded SchXSLT to /opt/schxslt/schxslt-1.5.1/.  That directory contains a subdirectory called 2.0, which contains the SchXSLT XSLT files.
> >               • Edited the config.xml file in my Morgana main directory to include the line <path_to_SchXSLT_2>/opt/schxslt/schxslt-1.5.1/2.0</path_to_SchXSLT_2>.
> >               • Tried running an XProc pipeline from the command line with zsh /opt/morgana/MorganaXProc-IIIse-0.9.4.2-beta/Morgana.sh $1 -config=/opt/morgana/MorganaXProc-IIIse-0.9.4.2-beta/config.xml -xslt-connector=Saxon10 -xquery-connector=Saxon10.
> > 
> > This fails with the following error message::
> > 
> > djb@koala-4 adj % zsh /opt/morgana/MorganaXProc-IIIse-0.9.4.2-beta/Morgana.sh adj.xpl -config=/opt/morgana/MorganaXProc-IIIse-0.9.4.2-beta/config.xml -xslt-connector=Saxon10 -xquery-connector=Saxon10
> > =================================
> > MorganaXProc-IIIse 0.9.4.2-beta
> > Copyright 2011-2020 by <xml-project /> Achim Berndzen
> > =================================
> > 
> > [15:04:43.551] Selecting adjectives from dictionary
> > Using Saxon-EE 10.0. XSLT and XQuery processor developed by Saxonica Limited
> > [15:04:46.102] Verifying that all paradigms in dictionary are in paradigms file
> > Using Saxon-EE 10.0. XSLT and XQuery processor developed by Saxonica Limited
> > SchXslt is copyright (c) 2018-2020 by David Maus <dmaus@dmaus.name> and released under the terms of the MIT license.
> > Unable to find path for SchXSLT for XSLT 2.0.
> > <?xml version="1.0" encoding="UTF-8"?>
> > <c:errors xmlns:c="http://www.w3.org/ns/xproc-step"><c:error code="err:XC0151" name="!1.4" type="p:validate-with-schematron" href="file:///Users/djb/repos/cz/pos/adj/adj.xpl" line="35" column="31" xmlns:p="http://www.w3.org/ns/xproc" xmlns:err="http://www.w3.org/ns/xproc-error"><message>Error occurred: Unable to initialize schematron templates. Reason: Required files for XSLT 2.0 based Schematron not found. Please check your config. [java.lang.Exception] [java.lang.Exception]</message></c:error></c:errors>
> > 
> > It looks as if there must be some configuration step that I've overlooked or implemented incorrectly, but when I read the Morgana documentation at https://www.xml-project.com/files/doc/manual.html, I can't spot the difference between the instructions there and what I've done. Might someone be able to advise? Thank you!
> > 
> > Best,
> > 
> > David
> > 
> > 
> 

Received on Saturday, 3 October 2020 15:24:52 UTC