Roy Walter | 30 Oct 10:46 2014
Picon

Trying to run command line client

Hi,

From bin/client.sh I get an error, See attached.

Thanks,
Roy




------------------------------------------------------------------------------
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open
Birnbaum, David J | 29 Oct 16:25 2014
Picon

contains()

Dear eXistentialists,

Is the following a bug, or is it me? Using the Shakespeare files bundled with eXist (Version: 2.1dev, SVN
Revision: 18374, Build: 20130416, running on Centos 6), trying to find, in a one-line XPath, speeches
(<sp>) in Hamlet with lines (<l>) that contain "king":

No results: doc('/db/apps/shakespeare/data/ham.xml')//*:sp[*:l[contains(.,'king')]]

This looks to me as if it should mean: find all <sp> elements, filter them to keep only the ones that contain
<l> children, but do that only when the <l> children themselves contain the string 'king'.

The following returns 53 results when I run it in <oXygen/> against a local copy of the file:

//sp[l[contains(.,'king')]]

For diagnostic purposes I tried double negation:

53 results: doc('/db/apps/shakespeare/data/ham.xml')//*:sp[*:l[not(not(contains(.,'king')))]]

The following also returns 53 results:

53 results: doc('/db/apps/shakespeare/data/ham.xml')//*:sp/*:l[contains(.,'king')]/..

Is the unexpected return from the "no results" expression my error?

Thanks,

David
djbpitt <at> gmail.com

------------------------------------------------------------------------------
Jens Østergaard Petersen | 27 Oct 17:54 2014
Picon

accessing attribute nodes

Hi,

There seems to be a small difference in the way attribute nodes can be accessed. In an in-memory document, "//descendant-or-self" is required. Since "//" is "short for descendant-or-self:node()/", I don't think this should be necessary.

However, since attributes cannot be accessed by following the child axis, it should not be possible to access them by following the descendant axis. The other implementations I have tested also only work with following the attribute axis, including using the abbreviation " <at> *", and perhaps that is more correct. This would mean that both attribute-count-count-doc-1.1 and attribute-count-count-doc-1.2 are incorrect. 

In fact, with eXist-db, it is to some extent possible to access attributes following the child axis; see attribute-count-count-doc-1.1-x, attribute-count-count-doc-1.2-x and attribute-count-count-2.2-x (why then attribute-count-count-2.1-x gives 0 I don't know). 

I think this is wrong, but it does not hurt: all the code that should work works. The only bad thing is that people like me are tempted to writing bad code … (https://github.com/jensopetersen/tei-compactor/blob/master/compactor.xq#L37).

Jens

#

xquery version "3.0";

declare namespace tei="http://www.tei-c.org/ns/1.0";

let $doc-1 := 
<doc xml:id="x">
    <a>
        <b x="1" n="7">text1<e>text2</e>text3</b>
        <b>text0</b>
    </a>
</doc>

let $doc-2 := doc('/db/test/test-doc.xml') (:$doc-2.xml is $doc-1.xml stored.:)

return 
    <attribute-counts>
        <attribute-count-count-doc-1.1>{count($doc-1/descendant-or-self::attribute())}</attribute-count-count-doc-1.1>
        <attribute-count-count-doc-1.1-x>{count($doc-1/child::attribute())}</attribute-count-count-doc-1.1-x>
        <attribute-count-count-doc-1.2>{count($doc-1//descendant-or-self::attribute())}</attribute-count-count-doc-1.2>
        <attribute-count-count-doc-1.2-x>{count($doc-1//child::attribute())}</attribute-count-count-doc-1.2-x>
        <attribute-count-count-doc-1.3>{count($doc-1//attribute::*)}</attribute-count-count-doc-1.3>
        <attribute-count-count-doc-1.4>{count($doc-1// <at> *)}</attribute-count-count-doc-1.4>
        <attribute-count-count-2.1>{count($doc-2/descendant-or-self::attribute())}</attribute-count-count-2.1>
        <attribute-count-count-2.1-x>{count($doc-2/child::attribute())}</attribute-count-count-2.1-x>
        <attribute-count-count-2.2>{count($doc-2//descendant-or-self::attribute())}</attribute-count-count-2.2>
        <attribute-count-count-2.2-x>{count($doc-2//child::attribute())}</attribute-count-count-2.2-x>
        <attribute-count-count-2.3>{count($doc-2//attribute::*)}</attribute-count-count-2.3>
        <attribute-count-count-2.4>{count($doc-2// <at> *)}</attribute-count-count-2.4>
    </attribute-counts>
------------------------------------------------------------------------------
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open
Christian Moser | 27 Oct 12:28 2014
Picon

request:get-data()

Hi

I am experimenting with XForms/betterform and somehow can't get hold of 
the posted form data.

Test drive:

<div xmlns="http://www.w3.org/1999/xhtml" 
xmlns:ev="http://www.w3.org/2001/xml-events" 
xmlns:xforms="http://www.w3.org/2002/xforms" 
data-template="templates:surround" 
data-template-with="templates/page.html" data-template-at="content">
     <xforms:model>
         <xforms:instance id="test-instance">
             <test xmlns="">
                 <value/>
             </test>
         </xforms:instance>
         <xforms:submission id="save-submission" 
ref="instance('test-instance')" 
resource="http://localhost:8080/exist/rest/db/apps/myapp/modules/abbr.xq" method="post" 
replace="none"/>
     </xforms:model>
     <xforms:input ref="value">
             <xforms:label>Value:</xforms:label>
         </xforms:input>
     <xforms:submit submission="save-submission">
         <xforms:label>Submit</xforms:label>
     </xforms:submit>
</div>

In "abbr.xq":
let $post := request:get-data()//test
return $post

I feel silly, but $post is always empty. Am I using the right path for 
"resource"? (I tried about every possible variant...) Or what am I doing 
wrong here?

Best
Christian

------------------------------------------------------------------------------
Patrick Bernaud | 27 Oct 10:45 2014
Picon
Picon

RESTXQ and binary data as parameter

Hello,

With eXist-db, is it possible to have a RESTXQ resource function 
accepting binary data from a POST request body ?

Regards,

--
Patrick

------------------------------------------------------------------------------
Jens Østergaard Petersen | 27 Oct 10:36 2014
Picon

document-node()

Hi,

I get some puzzling results when running the following script.

#

xquery version "3.0";

let $doc := 
document{
<doc xml:id="x">
<?xml-stylesheet type="text/xsl" href="test"?>
    <a>
        <b x="1">text<e>text</e>text</b>
        </a>
    <a>
        <c><!--comment-->
            <d xmlns="x" y="2" z="3">text</d>
            </c>
    </a>
</doc>
}
let $doc := doc('/db/test/test-document.xml')
return 
    <result>
        <document-node-count>{count($doc//document-node())}</document-node-count>
        <nodes-count>{count($doc//node())}</nodes-count>
        <element-count>{count($doc//element())}</element-count>
        <text-count>{count($doc//text())}</text-count>
        <attribute-count>{count($doc//attribute())}</attribute-count>
        <comment-count>{count($doc//comment())}</comment-count>
        <processing-instruction-count>{count($doc//processing-instruction())}</processing-instruction-count>
    </result>

#

Run on a stored document in eXist-db, with

<indexer caseSensitive="yes" index-depth="5" preserve-whitespace-mixed-content="no"
stemming="no" suppress-whitespace="none"
tokenizer="org.exist.storage.analysis.SimpleTokenizer" track-term-freq="yes">

in conf.xml, I get

<result>
    <document-node-count>18</document-node-count>
    <nodes-count>14</nodes-count>
    <element-count>7</element-count>
    <text-count>5</text-count>
    <attribute-count>4</attribute-count>
    <comment-count>1</comment-count>
    <processing-instruction-count>1</processing-instruction-count>
</result>

As far as I can make out,

the node-count counts element + text + comment + pi nodes, that is, all nodes except attribute nodes
the document-node-count counts node + attribute nodes, that is, all nodes
the text-count counts text nodes, but adds a text nodes if there is space between the document element and the pi node, that is, the whitespace between <doc xml:id="x"> and <?xml-stylesheet type="text/xsl" href="test"?> is counted as a text node.

The last is wrong, but (in my opinion) not all that harmful.

Run on an in-memory document in eXist-db, I get

<result>
    <document-node-count>13</document-node-count>
    <nodes-count>13</nodes-count>
    <element-count>7</element-count>
    <text-count>4</text-count>
    <attribute-count>4</attribute-count>
    <comment-count>1</comment-count>
    <processing-instruction-count>1</processing-instruction-count>
</result>

Here, the text-node-count is correct, but the document-node-count is the same as the node count.

In Saxon, BaseX and Zorba, running on an in-memory document, I get

<result>
   <document-node-count>0</document-node-count>
   <nodes-count>13</nodes-count>
   <element-count>7</element-count>
   <text-count>4</text-count>
   <attribute-count>4</attribute-count>
   <comment-count>1</comment-count>
   <processing-instruction-count>1</processing-instruction-count>
</result>

Except for the document-node-count, this is the same as run on an in-memory document in eXist-db.

Obviously, there is some disagreement about what a document-node() is.

Now, "document-node() matches any document node", it says at <http://www.w3.org/TR/xpath20/#id-matching-item>, but that is a tricky statement, for it can be read as "any node in a document" or as "any instance of a document node". The second is the correct reading, but I think eXist-db is following the first reading. 

A document-node() is what is returned when calling the doc() function on an XML document (<http://www.w3.org/TR/xpath-functions-30/#func-doc>), and, presumably, when calling document-node() on a collection, you get all the document nodes of the XML documents there. Below the document node is the element node of the document element (and optional comments and pis). One can access the document node with root($doc) and the document element with root($doc)/*. And one cannot actually use an expression like $doc//document-node() or $doc/document-node() to do anything useful, for a document node is the only node that can never be selected by following the child axis.

Now, I think it is very practical to be able to select all nodes in a document using document-node(), but is eXist-db's interpretation correct?

Jens


------------------------------------------------------------------------------
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open
Andreas Jung | 26 Oct 17:18 2014

2.2RC2 on Yosemite - jvm 1 | Error: This Java instance does not support a 32-bit JVM.

Hi there,

I installed 2.2RC2 on Mac/Yosemite.

Starting the installation fails.

I installed it directly from the .jar file.
This approach worked without problems on MacOS 10.9

Any idea?

Andreas

Suxmac:eXist-db ajung$ tools/wrapper/bin/exist.sh console
Running eXist-db Native XML Database...
wrapper  | --> Wrapper Started as Console
wrapper  | Java Service Wrapper Community Edition 32-bit 3.5.23
wrapper  |   Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights
Reserved.
wrapper  |     http://wrapper.tanukisoftware.com
wrapper  |
wrapper  | Launching a JVM...
wrapper  | JVM exited while loading the application.
jvm 1    | Error: This Java instance does not support a 32-bit JVM.
jvm 1    | Please install the desired version.
wrapper  | Automatic JVM Restarts disabled.  Shutting down.
wrapper  | <-- Wrapper Stopped

------------------------------------------------------------------------------
Christian Moser | 26 Oct 16:41 2014
Picon

Re: joining x and y with more than one instance of each

Dear Tonya

With the "for" clause you start an iteration through all the elements/values that are returned by the path expression after the "in". In each step the respective element/value is bound to the variable after the "for".

for $n in //respStmt
return
<p>{concat($n/resp, ' by ', $n/name)}</p>

In your example "//respStmt" returns two elements:

<respStmt>
  <resp>Transcription and correction</resp>
  <name>Elizabeth Ricketts</name>
</respStmt>

and

<respStmt>
  <resp>Correction, editorial commentary, and markup</resp>
  <name>Tonya Howe</name>
</respStmt>

This means the rest of your FLOWR is evaluated two times: the first time for $n bound to the "Ricketts-respStmt", and the second time for $n bound to the "Howe-respStmt".

How you name this variable is entirely up to you (it has to be a XML-qualified name though).
So e.g. all of these variants are fine:
for $n in //respStmt
for $i in //respStmt
for $i2 in //respStmt
for $myFancyVariable in //respStmt
for $respStmT in //respStmt

There is a long history in programming languages of using "i" as the variable you iterate with, that's why you see it here too. Another approach is to try to name your variable in a more meaningful way, like $ab for an "abbreviation element" etc.

Hope this helps!

Best
Christian


On 10/26/2014 01:46 PM, Tonya-Marie Howe wrote:
Hi, Christian--

That's very useful! Can you explain the $n variables? I see them (or variables like them--$i, $d) in the book I have, but I can't discover what they are or what they do. I thought all variables had to be declared, but these seem to be special in some way. 

Puzzled,
Tonya

On Sun, Oct 26, 2014 at 4:00 AM, Christian Moser <christian.moser <at> theol.uzh.ch> wrote:
Dear Tonya

I know, in the beginning these FLOWRs can drive you mad.
But there is no nesting needed here (if I understand you correctly):

this:

for $n in //respStmt
return
<p>{concat($n/resp, ' by ', $n/name)}</p>

returns this (given your code snippet):

<p>Transcription and correction by Elizabeth Ricketts</p>
<p>Correction, editorial commentary, and markup by Tonya Howe</p>

Best
Christian



On 10/26/2014 02:55 AM, Tonya-Marie Howe wrote:
Hello, list!

I think I'm making a little progress on this, but I have reached the point where I'm pulling my hair. I have XML files with two (or potentially 3) <resp> and <name> elements--for instance, one person is responsible for transcription, and another is responsible for both transcription and markup. Something like this: 

<respStmt>
  <resp>Transcription and correction</resp>
  <name>Elizabeth Ricketts</name>
</respStmt>
  <resp>Correction, editorial commentary, and markup</resp>
  <name>Tonya Howe</name>
</respStmt>

I want the lines to display as follows:

Transcription and correction by Elizabeth Ricketts
Correction, editorial commentary, and markup by Tonya Howe

Here's what I'm currently trying:

{
                for $respStmt in $header
                let $respCount := count($header//tei:respStmt)
                return 
                    if ($respCount > 1) then
                        <p>{string-join(($titleStmt/tei:respStmt/tei:resp, $titleStmt/tei:respStmt/tei:name), ' by ')}</p>
                    else
                        concat($titleStmt/tei:respStmt/tei:resp, ' by', $titleStmt/tei:respStmt/tei:name)
            }

This gives me:

Transcription and correction by Correction, editorial commentary, and markup by Elizabeth Ricketts by Tonya Howe

And this:

                for $resp in $resps
                return
                    <p>{string-join(($titleStmt/tei:respStmt/tei:resp, $titleStmt/tei:respStmt/tei:name), ' by ')}</p>
               
            }

Gives me:

Transcription and correction by Correction, editorial commentary, and markup by Elizabeth Ricketts by Tonya Howe

Transcription and correction by Correction, editorial commentary, and markup by Elizabeth Ricketts by Tonya Howe

I know the solution has to do with nesting FLOWRs, but I can't seem to make it out. :(

Thank-you, eXist forum, for your generosity and patience,
Tonya






------------------------------------------------------------------------------

_______________________________________________ Exist-open mailing list Exist-open <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/exist-open



------------------------------------------------------------------------------

_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open




--
Associate Professor of Literature
------------------------------------------------------------------------------
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open
Tonya-Marie Howe | 26 Oct 02:55 2014

joining x and y with more than one instance of each

Hello, list!

I think I'm making a little progress on this, but I have reached the point where I'm pulling my hair. I have XML files with two (or potentially 3) <resp> and <name> elements--for instance, one person is responsible for transcription, and another is responsible for both transcription and markup. Something like this: 

<respStmt>
  <resp>Transcription and correction</resp>
  <name>Elizabeth Ricketts</name>
</respStmt>
  <resp>Correction, editorial commentary, and markup</resp>
  <name>Tonya Howe</name>
</respStmt>

I want the lines to display as follows:

Transcription and correction by Elizabeth Ricketts
Correction, editorial commentary, and markup by Tonya Howe

Here's what I'm currently trying:

{
                for $respStmt in $header
                let $respCount := count($header//tei:respStmt)
                return 
                    if ($respCount > 1) then
                        <p>{string-join(($titleStmt/tei:respStmt/tei:resp, $titleStmt/tei:respStmt/tei:name), ' by ')}</p>
                    else
                        concat($titleStmt/tei:respStmt/tei:resp, ' by', $titleStmt/tei:respStmt/tei:name)
            }

This gives me:

Transcription and correction by Correction, editorial commentary, and markup by Elizabeth Ricketts by Tonya Howe

And this:

                for $resp in $resps
                return
                    <p>{string-join(($titleStmt/tei:respStmt/tei:resp, $titleStmt/tei:respStmt/tei:name), ' by ')}</p>
               
            }

Gives me:

Transcription and correction by Correction, editorial commentary, and markup by Elizabeth Ricketts by Tonya Howe

Transcription and correction by Correction, editorial commentary, and markup by Elizabeth Ricketts by Tonya Howe

I know the solution has to do with nesting FLOWRs, but I can't seem to make it out. :(

Thank-you, eXist forum, for your generosity and patience,
Tonya




--
Associate Professor of Literature
------------------------------------------------------------------------------
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open
Andreas Jung | 25 Oct 15:07 2014

Indexes used only for queries?


Hi there,

we have content with like this:

<dghodoc>
   <meta name="XX">
     <value>a</value>
   </meta>
   <meta name="YYY">
     <value>1</value>
     <value>2</value>
   </meta>

For report we have script like this:

<items> {
    let $data-collection := '/db/onkopedia'
    for $doc in collection($data-collection)[ends-with(base-uri(.), '.xml')]
    return
        <item>
            <uri>{base-uri($doc)}</uri>

<title>{local:trim($doc//meta[ <at> name="Titel"]/value/text())}</title>

        </item>
}
</items>

Will exist-db make use of indexes for generating the output (e.g. <meta>
or <value> would be indexed) or are indexes only used
for query purposes?

Andreas

Ari Nordström | 24 Oct 10:07 2014
Picon

XProc package and xsl:formatter step problem

Hi all,

Me again, testing the XProc package in eXist and hoping that Dmitriy and others can help.

I'm trying to run a pipeline to output PDF using XEP as the formatting engine. The xsl:formatter step looks like this:

    <!-- PDF output from FO -->
    <p:xsl-formatter content-type="application/pdf" name="cos-fo">
        <p:input port="source">
            <p:pipe port="result" step="xml2fo"/>
        </p:input>
        <p:with-option name="href" select="$pdf"/>
        <p:with-param name="CONFIG" select="'xmldb:exist:///db/xep.xml'">
            <p:empty/>
        </p:with-param>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:xsl-formatter>

The XQ looks like this:

xquery version "1.0";
import module namespace xproc="http://exist-db.org/xproc";

let $opts2 := (<input type="xml" port="document" url="http://localhost:8080/exist/rest/db/work/docs/pdftest/test-root.xml"/>,
<input type="xml" port="stylesheet" url="http://localhost:8080/exist/rest/db/work/system/cosml/fo/cos-fo-internal.xsl"/>,
<input type="xml" port="stylesheet-norm" url="xmldb:exist:///db/work/system/cosml/xslt/normalize-2.xsl"/>,
<option name="normalized" value="xmldb:exist:///db/work/tests/normalized-test.xml"/>,
<option name="pdf" value="xmldb:exist:///db/work/tests/pdftest-out.pdf"/>)

let $result := xproc:process('xmldb:exist:///db/work/system/cosml/xproc/publish-cosml-pdf.xpl',$opts2)
return
   $result

The pipeline basically normalises a modularised XML file using an XSLT, converts it to FO using another, and finally uses XEP to output PDF. The $pdf option, above, is what's interesting here and tells xsl:formatter where to save the PDF, but when I run the above, I get

exerr:ERROR Don't know how to write p:xsl-formatter output to xmldb:exist:///db/work/tests/pdftest-out.pdf [at line 10, column 16]

If I comment out the xsl:formatter step, the rest of the pipeline does what it's supposed to without a problem. I get a nice FO file.

I've confirmed that XEP is correctly configured in eXist by following Wolfgang's instructions in http://en.wikibooks.org/wiki/XQuery/Generating_PDF_from_XSL-FO_files#Instructions_for_RenderX.

It would seem that the problem is either in the XProc package or in Calabash. If memory serves, Calabash did have a problem with handling URLs in some earlier versions, and I think Jim Fuller ran into this when he updated his Calabash eXist module for my XML Prague presentation earlier this year. He had to do a custom Calabash JAR for me.

I don't know if this is what I'm seeing now, but I remember that Norm Walsh mentioned a fix somebody had done or meant to do and push to git.

Best regards,

/Ari
------------------------------------------------------------------------------
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open

Gmane