I have a single collection of reports. Each report has the same structure
and is stored as its own .xml file (with a name I generate
programmatically when it is stored). What I want is a list of all the
documents (their filename or URI) that have some given feature. If I have
an xquery like this:
for $x in collection("/db/my/collection")//player[@name="Bob"]
Ideally I would finish that off with:
return <docid>{ document-uri($x) }</docid>
Which of course doesn't work. I would greatly appreciate any insight you
might offer. I really appreciate your time.
Aaron

Hi,
I have created a small Python module that wraps the eXist-db REST API.
A short example:
#####
from lxml import etree
from pyexist import ExistDB
# Store a document.
db = ExistDB('localhost:8088', 'mycollection')
db.store_file('/path/to/my.xml', 'mydocument')
# Query.
query = db.query('//myelement[@name="%{foo}"]', foo = 'bar')
for elem in query[5:10]:
print "Element:", etree.tounicode(elem)
# Delete a document.
query = db.remove('mydocument')
#####
Query evaluation is lazy, so the query isn't sent until the slicing
method is called.
The query also happens to integrate well with the Django paginator, so
you can do things such as:
#####
query = existdb.query('//element')
paginator = Paginator(query, 25)
#####
The code is here:
http://github.com/knipknap/pyexist
-Samuel

> Here are slightly different versions of the same question:
>
> What kinds of events and in what sequence are triggered by the browser command http://localhost:8080/exist/index.xml?
This is not an easy question as it involves several components
(including URL rewriting: http://www.exist-db.org/urlrewrite.html). I
started to write an answer, but it did get longer than I thought and
I'm not finished yet. I'll come back to it though.
Wolfgang

> I have just registered to the conference and arranging accommodation
> right now. As I would love to join the eXist users group meeting on
> Friday, it would be nice to know approximately when and where you are
> intending to meet.
Thanks to all who responded so far. We received enough feedback to be
sure that the users group meeting will definitely take place on the
Friday. Jim is now trying to reserve us a room.
I don't think we need to start the meeting too early (10 or 11am), so
if you cannot attend in the morning, you won't miss much. I will go
through all proposals I received and come up with an agenda soon.
Wolfgang

> Hmm, I already did that with the exception of the line
>
> <fulltext default="none" attributes="false"></fulltext>
>
> Is that significant? Let me plug that in and see what happens.
It used to be significant. Since eXist 1.4, the above are the default
settings, so you can just forget about them.
If you enable trace logging, you should get some output in your logs
whenever your index is used. The optimizer should also tell you if it
could rewrite the query or not (example:
http://www.exist-db.org/indexing.html#N10557).
Wolfgang

I've started drafting a tutorial for a minimal version of eXist based on examples and a "just in time and only what you need to know" approach. If you know Spoerl's Feuerzangenbowle, it's a distant relative of the famous explanation of a steam engine:
„Wo simmer denn dran? Aha, heute krieje mer de Dampfmaschin. Also, wat is en Dampfmaschin?
Da stelle mer uns janz dumm. Und da sage mer so:
En Dampfmaschin, dat is ene jroße schwarze Raum, der hat hinten und vorn e Loch.
Dat eine Loch, dat is de Feuerung. Und dat andere Loch, dat krieje mer später.“
It's at http://sites.google.com/site/learningexist/ and will need to through much expansion and revision to be useful. But the basic approach is there.
I notice from your reply that the eXist uses the "lightweight MVC" model that is part of 1.4. Should that be part of a minimal but expandable site? I think so, and there may be some explanatory strategies I can borrow legitimately from the excellent (and very step-wise) "Python Web Development with Django".
On Feb 4, 2010, at 6:53 AM, Wolfgang Meier wrote:
>> Here are slightly different versions of the same question:
>>
>> What kinds of events and in what sequence are triggered by the browser command http://localhost:8080/exist/index.xml?
>
> This is not an easy question as it involves several components
> (including URL rewriting: http://www.exist-db.org/urlrewrite.html). I
> started to write an answer, but it did get longer than I thought and
> I'm not finished yet. I'll come back to it though.
>
> Wolfgang

I could not follow this discussion as closely as I would have liked
to. However, I think you already found the two basic options I would
have thought off: 1) the ngram index, 2) lucene.
As Joe said, you should definitely look through the various analyzers
available for lucene. They can be easily plugged into eXist and if you
need more customizations, you could create your own analyzer class. I
guess we could also find ways to handle boosts and scores once you
know some details.
Implementing your own index module would certainly be more
complicated, though probably not as complicated as it might seem if
you look at the ngram or lucene implementations. A large part of those
implementations deals with searching, not indexing. The main
interfaces you need to implement for an index are Index and
IndexWorker. StreamListener is the interface which will receive the
index events. Once you implemented those interfaces, eXist will take
care of the rest. The following document describes those classes and
how to use them:
http://www.exist-db.org/devguide_indexes.html
Wolfgang

Okay Okay so I have read the article now - really should of done that first!
Regarding - "investigate creating a new serializer for JSON, but this
would mean I dont use existing json.xq library"
I believe that Wolfgang started out on this path but for some reason
some context information was missing, and he then found it was much
easier to implement correct functionality in XQuery as opposed to Java
and the internal API's. Perhaps he could shed some light on the
issues?
Regarding content negotiation, I think you could do this with the
XQuery URLRewrite code as opposed to adjusting the REST server
directly.
However in the longer term, we are envisaging an XML vocabularly for
configuring REST and URL Rewriting. And also the ability to serve up
custom XQuery functions as RESTful services akin to how JAX-RS and
Jersey. Both of these could change your available options...
On 4 February 2010 12:11, Adam Retter <adam@...> wrote:
> On 4 February 2010 11:48, James Fuller <james.fuller.2007@...> wrote:
>> Hiya,
>>
>> yes, I use the json.xq module in the article (this is the xqm you speak of).
>>
>> my feeling is it would be better to respond to HTTP GET with
>> content-type set to application/json versus any other approach but
>> willing to be convinced on its merits ;)
>
> Yeah I like the idea of content negotiation, Could that not be done
> from controller.xql?
>
>> thx, J
>>
>> On Thu, Feb 4, 2010 at 12:40 PM, Adam Retter <adam@...> wrote:
>>> James,
>>>
>>> I believe there is already an XQM module to do this that Wolfgang
>>> wrote. I am pretty sure its in the distribution. With a little XQuery
>>> URLRewrite magic I am sure you could interpret */json or *?json to
>>> have eXist render you a JSON response instead of XML.
>>>
>>> On 4 February 2010 10:29, James Fuller <james.fuller.2007@...> wrote:
>>>> series of short articles I am starting over at XML Today
>>>>
>>>> http://www.xmltoday.org/content/turning-exist-db-json-server-part-i
>>>>
>>>> where I start thinking about the best way of letting eXist expose a
>>>> JSON representation of xml data.
>>>>
>>>> thx, J
>>>>
>>>> ------------------------------------------------------------------------------
>>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>>> Stay online with enterprise data centers and the best network in the business
>>>> Choose flexible plans and management services without long-term contracts
>>>> Personal 24x7 support from experience hosting pros just a phone call away.
>>>> http://p.sf.net/sfu/theplanet-com
>>>> _______________________________________________
>>>> Exist-open mailing list
>>>> Exist-open@...
>>>> https://lists.sourceforge.net/lists/listinfo/exist-open
>>>>
>>>
>>>
>>>
>>> --
>>> Adam Retter
>>>
>>> eXist Developer
>>> { United Kingdom }
>>> adam@...
>>> irc://irc.freenode.net/existdb
>>>
>>
>
>
>
> --
> Adam Retter
>
> eXist Developer
> { United Kingdom }
> adam@...
> irc://irc.freenode.net/existdb
>
--
Adam Retter
eXist Developer
{ United Kingdom }
adam@...
irc://irc.freenode.net/existdb

On 4 February 2010 11:48, James Fuller <james.fuller.2007@...> wrote:
> Hiya,
>
> yes, I use the json.xq module in the article (this is the xqm you speak of).
>
> my feeling is it would be better to respond to HTTP GET with
> content-type set to application/json versus any other approach but
> willing to be convinced on its merits ;)
Yeah I like the idea of content negotiation, Could that not be done
from controller.xql?
> thx, J
>
> On Thu, Feb 4, 2010 at 12:40 PM, Adam Retter <adam@...> wrote:
>> James,
>>
>> I believe there is already an XQM module to do this that Wolfgang
>> wrote. I am pretty sure its in the distribution. With a little XQuery
>> URLRewrite magic I am sure you could interpret */json or *?json to
>> have eXist render you a JSON response instead of XML.
>>
>> On 4 February 2010 10:29, James Fuller <james.fuller.2007@...> wrote:
>>> series of short articles I am starting over at XML Today
>>>
>>> http://www.xmltoday.org/content/turning-exist-db-json-server-part-i
>>>
>>> where I start thinking about the best way of letting eXist expose a
>>> JSON representation of xml data.
>>>
>>> thx, J
>>>
>>> ------------------------------------------------------------------------------
>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>> Stay online with enterprise data centers and the best network in the business
>>> Choose flexible plans and management services without long-term contracts
>>> Personal 24x7 support from experience hosting pros just a phone call away.
>>> http://p.sf.net/sfu/theplanet-com
>>> _______________________________________________
>>> Exist-open mailing list
>>> Exist-open@...
>>> https://lists.sourceforge.net/lists/listinfo/exist-open
>>>
>>
>>
>>
>> --
>> Adam Retter
>>
>> eXist Developer
>> { United Kingdom }
>> adam@...
>> irc://irc.freenode.net/existdb
>>
>
--
Adam Retter
eXist Developer
{ United Kingdom }
adam@...
irc://irc.freenode.net/existdb

Hiya,
yes, I use the json.xq module in the article (this is the xqm you speak of).
my feeling is it would be better to respond to HTTP GET with
content-type set to application/json versus any other approach but
willing to be convinced on its merits ;)
thx, J
On Thu, Feb 4, 2010 at 12:40 PM, Adam Retter <adam@...> wrote:
> James,
>
> I believe there is already an XQM module to do this that Wolfgang
> wrote. I am pretty sure its in the distribution. With a little XQuery
> URLRewrite magic I am sure you could interpret */json or *?json to
> have eXist render you a JSON response instead of XML.
>
> On 4 February 2010 10:29, James Fuller <james.fuller.2007@...> wrote:
>> series of short articles I am starting over at XML Today
>>
>> http://www.xmltoday.org/content/turning-exist-db-json-server-part-i
>>
>> where I start thinking about the best way of letting eXist expose a
>> JSON representation of xml data.
>>
>> thx, J
>>
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the business
>> Choose flexible plans and management services without long-term contracts
>> Personal 24x7 support from experience hosting pros just a phone call away.
>> http://p.sf.net/sfu/theplanet-com
>> _______________________________________________
>> Exist-open mailing list
>> Exist-open@...
>> https://lists.sourceforge.net/lists/listinfo/exist-open
>>
>
>
>
> --
> Adam Retter
>
> eXist Developer
> { United Kingdom }
> adam@...
> irc://irc.freenode.net/existdb
>

James,
I believe there is already an XQM module to do this that Wolfgang
wrote. I am pretty sure its in the distribution. With a little XQuery
URLRewrite magic I am sure you could interpret */json or *?json to
have eXist render you a JSON response instead of XML.
On 4 February 2010 10:29, James Fuller <james.fuller.2007@...> wrote:
> series of short articles I am starting over at XML Today
>
> http://www.xmltoday.org/content/turning-exist-db-json-server-part-i
>
> where I start thinking about the best way of letting eXist expose a
> JSON representation of xml data.
>
> thx, J
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Exist-open mailing list
> Exist-open@...
> https://lists.sourceforge.net/lists/listinfo/exist-open
>
--
Adam Retter
eXist Developer
{ United Kingdom }
adam@...
irc://irc.freenode.net/existdb

On Thu, Feb 4, 2010 at 6:06 AM, Wolfgang Meier <wolfgang@...> wrote:
>> Maybe the line counting is a bit off? Perhaps it only considers \n and
>> misses \r or some such?
>
> If the query was read from a file or resource, the line numbers should
> usually be correct (sometimes 1 or 2 lines off).
> They might be wrong if the query was coming from the sandbox.
>
This is the line I suspect:
let $entries :=
collection("/db/ccl/news")/atom:entry[starts-with(atom:updated,
$date)]
Also:
let $entries :=
collection("/db/news")/atom:entry[starts-with(atom:updated,
$dates[1])]
for $entry in $entries
return
(<div>{$entry/atom:content/node()}</div>,
if ($entry[position() = last()]) then () else <hr />
)
}
I've been sending the queries through Oxygen. I'll try loading them
from the file system, and see if that changes anything.
--
Elliotte Rusty Harold
elharo@...

> Maybe the line counting is a bit off? Perhaps it only considers \n and
> misses \r or some such?
If the query was read from a file or resource, the line numbers should
usually be correct (sometimes 1 or 2 lines off).
They might be wrong if the query was coming from the sandbox.
> That said, the main thing that shows up in my query predicates is
> atom:updated. I've indexed on that (I think) but so far it doesn't
> seem to make a big difference.
Well, can you show a typical predicate expression and what index you created?
Another way to get information on which indexes are used and how is to
enable trace logging in log4j.xml (by changing the priority to trace):
<root>
<priority value="trace"/>
<appender-ref ref="console"/>
</root>
Wolfgang

On Wed, Feb 3, 2010 at 8:24 AM, Wolfgang Meier <wolfgang@...> wrote:
> [147:55] = [line:column]
>
> Source=String means that the executed query was passed in as a string
> and has not been read from a file or resource, so we have no source
> location to show. If you look at the indicated line in your query,
> you'll probably see an XPath predicate expression containing a general
> or value comparison (//a[b = "c"]). This is the expression which could
> be supported by an index. If it's b = "c", you create a range index on
> b:
Hmm. Looking at the reported line what I see is:
<p>
You can also see <a href="readings2010.phtml">previous
recommended reading</a> or subscribe to the <a
href="reading.rss">recommended reading RSS feed</a> if you like.
</p>
Maybe the line counting is a bit off? Perhaps it only considers \n and
misses \r or some such?
That said, the main thing that shows up in my query predicates is
atom:updated. I've indexed on that (I think) but so far it doesn't
seem to make a big difference.
--
Elliotte Rusty Harold
elharo@...

> I would thus like to ask who of the people on this list is going to be
> in Prague or would be interested to be there. We currently plan to
> organize an "eXist users group" meeting on the Friday before the main
> conference starts.
I have just registered to the conference and arranging accommodation
right now. As I would love to join the eXist users group meeting on
Friday, it would be nice to know approximately when and where you are
intending to meet. Travelling from Vienna, it should be possible for me
to arrive round about noon in Prague.
> * if and at what time we could meet at the Friday (whole day,
> afternoon, late afternoon)
>
from noon. If you are planning to start earlier, I could travel on
Thursday, such that i could make it for the whole day. But, I would need
to know pretty soon, as I would have to appoint that with my employer.
In this, or really in any case, it would be nice if it were possible to
have some officially looking acknowledgement of attendence for my
employer, who is going to pay for the expenses.
> * what your interests are: exchange ideas with other users or get some
> information/training on a particular topic
>
XQuery based webapplications
Linguistic analysis using XML databases
extending eXist using UDFs.
best,
Stefan

Hi,
I am trying to install eXist on Unix as a service using the init
script included in the package.
($EXIST_HOME/tools/wrapper/bin/exist.sh). I have changed the port
number in the following files:
1. $EXIST_HOME/bin/functions.d/eXist-settings.sh
I have changed the function to the following:
set_exist_options() {
OPTIONS="-Dexist.home=$EXIST_HOME -Djetty.port=6949"
}
2. $EXIST_HOME/server.xml
<listener protocol="http" port="6949"/>
3. $EXIST_HOME/tools/wrapper/conf/wrapper.conf
I have added the following line:
wrapper.java.additional.5=-Djetty.port=6949
However, none of the changes had any effect; the given port number is
not used (and I am not sure which port actually is used). What is the
right way to change the port number?
-Samuel

Community

Help

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

CountryState

JavaScript is required for this form.

I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details