problems with exist and cocoon - also xquery works dif?

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

problems with exist and cocoon - also xquery works dif?

Sven Wontroba
Hello List

I try to do a project with exist but some things don't work the way I expect them to work. I don't know if they are normal or I don't understand exist the way it works

Ok first installed eXist-1.0b2-build-1107.jar and tried to integrate it into my cocoon 2.1.7 which worked fine on a winXP sp2 machine with j2sdk1.4.2_08

I have to say I'm not a java genius nor a cocoon expert so I installed it like mentioned here: http://wiki.exist-db.org/space/CocoonInstall

Well basic things with xpath work well and I also get knots back but somehow it doesn't work the way I think it should.

Ok if I use the following with exist //LinkElements//@src
I get the result 4 hits an nothing else.
If I do the same within quip and query my xml file I'll get the Elements

Well same happens if I use the XQueryExample.java file in the xmldb example dir.
hits:          4
query time:    2283
retrieve time: 281

Well I thought this might be an error and changed to the eXist-snapshot-20050805.jar version and getting the following Error within cocoon
class "org.xmldb.api.base.CompiledExpression"'s signer information does not match signer information of other classes in the same package
org.apache.cocoon.ProcessingException: XMLDBException occurred: configuration error: org.xmldb.api.base.XMLDBException: configuration error
my be someone has the same experience and is able to help me out ? As mentioned I'm not en expert with this things?
Mhmm the example files also changes and I saw a different use of the sax serializer and my CompiledExpression line didn't work out normal. I changed the jar files,.. and it works
But do get the same results as before.
hits: 4 ?.

An other question is ? I tried this one with quip an it worked without a problem

? cutting namespace def.

declare function local:subElements($nameOfElement) as element()
{
 for $res in document("BMDM.xml")//mpeg21:Description[@id=$nameOfElement]/mpeg21:Statement/*
 return $res
};
for $linkElements in document("BMDM.xml")//LinkElements//@src
let $ergebnisse := local:subElements($linkElements)
return $linkElements  

In exist is seems like I can't return al my elements into my variables to collect the result of  my function??
May be someone could help me how to get around this.

Well I hope someone is able to help me out ? I don't have to much time left to finish my prototype. I don't have time an money to check Tamino.

         
Thanks in advance

And a nice weekend
Sven



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: problems with exist and cocoon - also xquery works dif?

Michael Beddow-2
Sven Wontroba wrote:
[...]
>
> Ok if I use the following with exist //LinkElements//@src
> I get the result 4 hits an nothing else.
> If I do the same within quip and query my xml file I'll get the Elements
>
> Well same happens if I use the XQueryExample.java file in the xmldb
example dir.
> hits:          4
> query time:    2283
> retrieve time: 281
>

Are you saying that the count of 4 is incorrect, or that it's the right
count, but you were expecting to see the actual results, not just the hit
count?

If the former, I don't know what the problem is without seeing some sample
data, but if the latter, then there's nothing wrong here. You just need to
look at the eXist docs and sample code a bit more closely.

I don't know what precisely you mean by "use the following with exist
//LinkElements//@src", but if you mean you queried using that XPath via the
java client in interactive mode, then after getting the initial hit count
response, you have to request the members of the actual result set, eg by
show 1 to see the first member of the set etc. You can make that client
return a serialized result set in a single operation by running it in batch
mode.

As for XQueryExample.java, if you look at the source you'll see that
although it executes the query, it doesn't attempt to return the result
nodes to the console. What you are seeing is all the output it attempts to
produce, via the lines
            System.out.println("hits:          " + result.getSize()
            System.out.println("query time:    " + qtime);
            System.out.println("retrieve time: " + rtime);
You would need to extend the code to see the result set displayed.


> Well I thought this might be an error and changed to the eXist-snapshot-
> 20050805.jar version and getting the following Error within cocoon
> class "org.xmldb.api.base.CompiledExpression"'s signer information
> does not match signer information of other classes in the same package

I don't claim to understand these signing issues, but they have been raised
and resolved here before, so please take a look in the list archives.

> An other question is ? I tried this one with quip an it worked without a
problem
>
> ? cutting namespace def.
>
> declare function local:subElements($nameOfElement) as element()
> {
>  for $res in
document("BMDM.xml")//mpeg21:Description[@id=$nameOfElement]/mpeg21:Statemen
t/*
>  return $res
> };
> for $linkElements in document("BMDM.xml")//LinkElements//@src
> let $ergebnisse := local:subElements($linkElements)
> return $linkElements
>
> In exist is seems like I can't return al my elements into my variables to
collect the result of  my function??
> May be someone could help me how to get around this.

So what are you actually trying to do here? You declare a local function,
then in your FLOWR expression, for each item in the sequence returned by
your XPath, you call that function, passing in the item, then you assign the
return value of the function to $ergebnisse, which you then seem to throw
away. Even if you didn't throw it away, but instead did a return
$ergebnisse, this wouldn't let you accumulate the return values of
successive invocations of the function in a persistent variable $ergebnisse
as you iterate, which is what you seem to be referring to when you talk
about using variables to "collect the result". I think this suggests you
need to look a bit further into how variables work in XQuery. I'm puzzled to
hear that this code as you reproduce it here really does do what you want it
to in quip. But in any case, quip is a partial implementation of the XQuery
WD of April 2002, which is a VERY long time ago. eXist's XQuery
implementation was recently updated in line with the WDs of September 2005.
If you want a reference system, you'd be better off using a recent build of
Saxon.

Michael Beddow





-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re[2]: problems with exist and cocoon - also xquery works dif?

Sven Wontroba
> Are you saying that the count of 4 is incorrect, or that it's the right
> count, but you were expecting to see the actual results, not just the hit
> count?

The count is correct  With quip I just get the strings of all 4
elements. Well I learned xpath query with quip and I know its an older
application. OK it might not be accurate to test things Thanks for the
hint.

> //LinkElements//@src", but if you mean you queried using that XPath via the
> java client in interactive mode, then after getting the initial hit count
> response, you have to request the members of the actual result set, eg by
> show 1 to see the first member of the set etc. You can make that client
> return a serialized result set in a single operation by running it in batch
> mode.

Thanks I'll search for this how to do it.

> As for XQueryExample.java, if you look at the source you'll see that
> although it executes the query, it doesn't attempt to return the result
> nodes to the console. What you are seeing is all the output it attempts to
> produce, via the lines
>             System.out.println("hits:          " + result.getSize()
>             System.out.println("query time:    " + qtime);
>             System.out.println("retrieve time: " + rtime);
> You would need to extend the code to see the result set displayed.

I don't have lots of java experience just a basic class. If I just use
a / in the xpath expression I'll get all outputs. Oother request also
work and I thought it will do the output with this line.
serializer.setOutput(new OutputStreamWriter(System.out),
outputProperties);

OK something I have dive in a little deeper.

-- cut --
> about using variables to "collect the result". I think this suggests you
> need to look a bit further into how variables work in XQuery.
…
> implementation was recently updated in line with the WDs of September 2005.
> If you want a reference system, you'd be better off using a recent build of
> Saxon.

Ok sorry there have been some testing vars in there I don't want to
throw it away I will return it later ergebnisse should be the
return

It seems I vas misleaded and  spoiled with the return in quip in
general now I have to do the iteration if there is more as one element
in the result on my own.

Thanks a lot for the comments. There is everyday something you can learn :)


sven




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open