default database context for collection()

Issues related to W3C XQuery.
piotrb
Posts: 11

default database context for collection()

Wed Jan 25, 2012 3:30 pm

I work with BaseX but would love to be able to edit all my queries with oXygen. However, I do not know how to emulate the "current database context" (which is automatically set by BaseX to the currently open database) inside oXygen.

The immediate problem is that if I run collection() in BaseX, I receive what I need, but collection() executed via Oxygen's Saxon predictably returns an empty sequence. Now, two questions:

1. is there any way to change that and let Saxon know (via oXygen's transformation scenarios or such) that it should treat something as the default context for collection()

and/or

2. is there a way to achieve this effect when using BaseX integrated with oXygen via XQJ? On this scenario, I get a hint about "default collection" -- would that be my way out?

Thanks in advance!

ad.1, my error message is

Code: Select all

System ID: /home/piotr/projects/KorAP/SVN/XML_test_data/tools/xq/tmp/temp3.xq
Scenario: temp3
XQuery file: /home/piotr/projects/KorAP/SVN/XML_test_data/tools/xq/tmp/temp3.xq
XML file: /home/piotr/projects/KorAP/SVN/XML_test_data/WPD/example/00001/metadata.xml
Engine name: Saxon-EE XQuery 9.3.0.5
Severity: error
Description: An empty sequence is not allowed as the value of variable $ms
Start location: 22:0
URL: http://www.w3.org/TR/xpath20/#ERRXPTY0004


ad.2, the error message is

Code: Select all

System ID: /home/piotr/projects/KorAP/SVN/XML_test_data/tools/xq/tmp/temp3.xq
Scenario: XQuery with BaseX-XQJ connection
XQuery file: /home/piotr/projects/KorAP/SVN/XML_test_data/tools/xq/tmp/temp3.xq
Engine name: BaseX connection
Severity: error
Description: FODC0002 Stopped at line 22, column 50:
[FODC0002] No default collection available.
Start location: 22:50
adrian
Posts: 2326

Re: default database context for collection()

Fri Jan 27, 2012 9:42 pm

Hello,

We have not yet tested the latest version of BaseX via XQJ. In the past the BaseX XQJ implementation was limited to the XQuery engine(the database cold not be accessed via XQJ). But, I believe that in more recent versions of BaseX there has been some developement effort to also offer acces to the inner database.
We will have to test the latest version of BaseX with Oxygen and will let you know what we found out.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
adrian
Posts: 2326

Re: default database context for collection()

Wed Feb 01, 2012 4:44 pm

Hello,

1. Regarding Saxon's default collection for collection(). You can set it in a Saxon configuration file and use this configuration file in the transformation scenario(Document > Transformation > Configure Transformation Scenario, Edit) in the Advanced options(button with small cogwheel next to the Transformer combo).
e.g. saxonConfig.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://saxon.sf.net/ns/configuration" edition="PE">
    <global defaultCollection="file:///d:/test"/>
</configuration>

More details about the Saxon configuration file can be found here:
http://www.saxonica.com/documentation/c ... n-file.xml


2. We have tested BaseX 7.02(the XQJ implementation) with Oxygen v13.2.
We did not find a way to set the default collection. You can only configure a username and a password in the XQJ connection parameters.
So, collection() always fails with:

Code: Select all

[FODC0002] No default collection available.

However, if you use the database name as the collection argument, it should work fine: collection('databaseName')

If there's a way to set the default collection for the BaseX XQJ implementation, it might be hidden in the BaseX documentation.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “XQuery”

Who is online

Users browsing this forum: No registered users and 0 guests