Compiling XQuery modules...

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiling XQuery modules...

Jorge Williams-2
Hello all,

Working on project which is leveraging an XQuery module that’s shared among a number of  XQueries.  Thought I would give separate compilation of the module a try given that I’m running SaxonEE in some scenarios.

I’m using SaxonEE 9.7.0-15. and running into 2 different issues:

1. I’d like to programmatically detect wether the separate module compilation feature is available BUT calling config.isLincensedFeature(ENTERPRISE_XQUERY) always seems to return false even though I have a valid SaxonEE license and other SaxonEE features (high order functions) work fine.  I’ve switched to using ENTERPRISE_XSLT as a stop gap.  Am I missing something here?

2. My library has functions with the same name, but different number of arguments this works fine if I don’t precompile the module, but when compiling the module it gives the following error:

XQST0034: Duplicate definition of function ...

The weird thing is that I don’t get this error when I compile the module itself — I get it when I compile the query that imports the module.

Any ideas?

Thanks,

-jOrGe W.

 
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Compiling XQuery modules...

Michael Kay

> On 15 Mar 2017, at 13:20, Jorge Williams <[hidden email]> wrote:
>
> Hello all,
>
> Working on project which is leveraging an XQuery module that’s shared among a number of  XQueries.  Thought I would give separate compilation of the module a try given that I’m running SaxonEE in some scenarios.
>
> I’m using SaxonEE 9.7.0-15. and running into 2 different issues:
>
> 1. I’d like to programmatically detect wether the separate module compilation feature is available BUT calling config.isLincensedFeature(ENTERPRISE_XQUERY) always seems to return false even though I have a valid SaxonEE license and other SaxonEE features (high order functions) work fine.  I’ve switched to using ENTERPRISE_XSLT as a stop gap.  Am I missing something here?

Whatever you're missing, you've left it out of the email. Try

Processor p = new Processor(true);
System.err.println("Licensed? " + p.getUnderlyingConfiguration().isLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XQUERY));

-- it gives "true" for me.
>

> 2. My library has functions with the same name, but different number of arguments this works fine if I don’t precompile the module, but when compiling the module it gives the following error:
>
> XQST0034: Duplicate definition of function ...
>
> The weird thing is that I don’t get this error when I compile the module itself — I get it when I compile the query that imports the module.
>
> Any ideas?
>

Could you supply a repro please? It looks to me as if for some reason the function in the imported module is being imported twice.

Michael Kay
Saxonica


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Compiling XQuery modules...

Jorge Williams-2
(Inline)

> On Mar 15, 2017, at 10:00 AM, Michael Kay <[hidden email]> wrote:
>
>
>> On 15 Mar 2017, at 13:20, Jorge Williams <[hidden email]> wrote:
>>
>> Hello all,
>>
>> Working on project which is leveraging an XQuery module that’s shared among a number of  XQueries.  Thought I would give separate compilation of the module a try given that I’m running SaxonEE in some scenarios.
>>
>> I’m using SaxonEE 9.7.0-15. and running into 2 different issues:
>>
>> 1. I’d like to programmatically detect wether the separate module compilation feature is available BUT calling config.isLincensedFeature(ENTERPRISE_XQUERY) always seems to return false even though I have a valid SaxonEE license and other SaxonEE features (high order functions) work fine.  I’ve switched to using ENTERPRISE_XSLT as a stop gap.  Am I missing something here?
>
> Whatever you're missing, you've left it out of the email. Try
>
> Processor p = new Processor(true);
> System.err.println("Licensed? " + p.getUnderlyingConfiguration().isLicensedFeature(Configuration.LicenseFeature.ENTERPRISE_XQUERY));
>
> -- it gives "true" for me.
Yea, that returns false for me. On the Scala REPL it looks like this:

scala> val p = new Processor(true)
p: net.sf.saxon.s9api.Processor = net.sf.saxon.s9api.Processor@61957d9c

scala> p.getUnderlyingConfiguration.isLicensedFeature(ENTERPRISE_XSLT)
res0: Boolean = true

scala> p.getUnderlyingConfiguration.isLicensedFeature(ENTERPRISE_XQUERY)
res1: Boolean = false

Maybe we purchased the wrong license, I assumed we have EE, but looking at the license file I see:

Company=SITE Rackspace
Edition=EE
SAT=yes
SAQ=no
SAV=yes

Does this mean we have EE-T?  I’m almost positive we purchased EE (Order 288569), but I could be mistaken I’m checking with my team.

In the meantime, assuming we have EE-T, the module compilation process still appears to function  in that the module compiles with no license errors. Does EE-T still have access to this feature?

>>
>
>> 2. My library has functions with the same name, but different number of arguments this works fine if I don’t precompile the module, but when compiling the module it gives the following error:
>>
>> XQST0034: Duplicate definition of function ...
>>
>> The weird thing is that I don’t get this error when I compile the module itself — I get it when I compile the query that imports the module.
>>
>> Any ideas?
>>
>
> Could you supply a repro please? It looks to me as if for some reason the function in the imported module is being imported twice.

I’m attaching the XQuery and this is the REPL session that illustrates the issue.  If you need access to the actual code, I can make that available to you as well.

scala> val moduleName = "/xq/assert.xq";
moduleName: String = /xq/assert.xq

scala> val moduleLoc = getClass.getResource(moduleName).toString
moduleLoc: String = file:/Users/jorgew/projects/api-checker/core/target/classes/xq/assert.xq

scala> val prefix = "req"
prefix: String = req

scala> val uri = "http://www.rackspace.com/repose/wadl/checker/request"
uri: String = http://www.rackspace.com/repose/wadl/checker/request

scala> val p = new Processor(true)
p: net.sf.saxon.s9api.Processor = net.sf.saxon.s9api.Processor@cde8c6c

scala> val c = p.newXQueryCompiler
c: net.sf.saxon.s9api.XQueryCompiler = net.sf.saxon.s9api.XQueryCompiler@5232e3f1

scala> c.setLanguageVersion("3.1")

scala> c.compileLibrary(getClass.getResourceAsStream(moduleName))

scala> val query = s"""
     |     xquery version \"3.1\" encoding \"UTF-8\";
     |
     |      import module \"$uri\"
     |             at \"$moduleLoc\";
     |
     |      declare namespace $prefix = \"$uri\";
     |
     | $$req:method
     | """
query: String =
"
    xquery version "3.1" encoding "UTF-8";

     import module "http://www.rackspace.com/repose/wadl/checker/request"
            at "file:/Users/jorgew/projects/api-checker/core/target/classes/xq/assert.xq";

     declare namespace req = "http://www.rackspace.com/repose/wadl/checker/request";

$req:method


scala> c.compile(query)
Static error on line 44 at column 3 of file:/Users/jorgew/projects/api-checker/core/target/classes/xq/assert.xq near {...rmalize-space($tv) }; decla...}
  XQST0034: Duplicate definition of function req:headers (see line 38 in null)
Static error on line 48 at column 3 of file:/Users/jorgew/projects/api-checker/core/target/classes/xq/assert.xq near {...rs($name, false()) }; decla...}
  XQST0034: Duplicate definition of function req:headers (see line 46 in null)
Static error on line 52 at column 3 of file:/Users/jorgew/projects/api-checker/core/target/classes/xq/assert.xq near {...($name, $split)[1] }; decla...}
  XQST0034: Duplicate definition of function req:header (see line 50 in null)
Static error on line 56 at column 3 of file:/Users/jorgew/projects/api-checker/core/target/classes/xq/assert.xq near {...req:header($name, false()) ...}
  XQST0034: Duplicate definition of function req:header (see line 54 in null)
Error on line 9 column 2
  XQST0034: Static errors were reported in the imported library module
net.sf.saxon.s9api.SaxonApiException: One or more static errors were reported during query analysis
  at net.sf.saxon.s9api.XQueryCompiler.compile(XQueryCompiler.java:558)
  ... 65 elided
Caused by: net.sf.saxon.trans.XPathException: One or more static errors were reported during query analysis
  at net.sf.saxon.query.XQueryParser.parseQuery(XQueryParser.java:424)
  at net.sf.saxon.query.XQueryParser.makeXQueryExpression(XQueryParser.java:156)
  at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:589)
  at net.sf.saxon.s9api.XQueryCompiler.compile(XQueryCompiler.java:556)
  ... 65 more




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 

assert.xq (3K) Download Attachment
ATT00001.txt (18 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Compiling XQuery modules...

Michael Kay
>>
>> -- it gives "true" for me.
>
> Yea, that returns false for me. On the Scala REPL it looks like this:
>
> ...
> Maybe we purchased the wrong license, I assumed we have EE, but looking at the license file I see:
>
> Company=SITE Rackspace
> Edition=EE
> SAT=yes
> SAQ=no
> SAV=yes
>
> Does this mean we have EE-T?  I’m almost positive we purchased EE (Order 288569), but I could be mistaken I’m checking with my team.
>

Yes, that is a license for EE-T (no schema-aware query). Let's handle the commercial question off-list.

Michael Kay
Saxonica



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help