Re: [basex-talk] Ask about AlterDB

2013-03-26 Thread Christian Grün
Please invest some more time, and send me examples that run out of the
box. In the given case, I had to rename the class constructor to
Case1; next, I was getting the error Event 'event100' is unknown.
More to that, you were talking about databases, but I don’t see
anything related to databases in your tests.

If you create a BaseXServer instance, you should generally use
ClientSession instances whenever you communicate with the server, and
avoid the creation of new Context instances. You may want to have a
look at the EventTest class [1], which demonstrates how multiple
clients can concurrently watch events in the client/server
architecture.

[1] 
https://github.com/BaseXdb/basex/blob/master/src/test/java/org/basex/test/server/EventTest.java
___

On Tue, Mar 26, 2013 at 3:57 AM,  truc@emotive.de wrote:
 Thank you for your answer.
 I give you some cases why I can't use many contexts to store many databases.
 Case1: create only one BaseXServer. In this case, the context of the
 BaseXServer is not related to contexts that I store my databases. Thus, no
 contexts can work with events.
 Case2: create one BaseXServer for each context. In this case, only one the
 first context (and event) can work with events.
 These are the reasons why I have to use ONE context to store many databases.



 Quoting Christian Grün christian.gr...@gmail.com:

 Thanks. I?m not sure what you tried to do with event? Do you have a

 little example or some more information?
 ___

 Thank you for you answer. I have ever used many contexts to store many
 databases but the EVENT coundn't work properly. Dimitar has adviced me
 that
 I should use one context for many databases. It has worked well until I
 used
 AlterDB.
 How should I do to use many databases on one context?



 Quoting Christian Grün christian.gr...@gmail.com:

 Thanks for your response. I use pin so that a context can store many
 databases. If I don't use pin, a newest database will override the
 current
 database (see context.dbs.list.elementData). Please tell me how can I
 use
 many database on one context.



 ?I see. Sounds like a dangerous journey, because the whole
 architecture relies on the concept that only one database is opened in
 the current context. Why do you want to keep more than one database
 opened at the same time?

 Christian
 __

 Quoting Christian Grün christian.gr...@gmail.com:

 Hi,

 it?s probably a better idea to avoid explicit (un)pinning of nodes;

 all commands should correctly do this for you. Out of interest: why
 did you choose to do pinning by yourself?

 Best,
 Christian
 _

 Dear BaseX team,
 I want to ask you how to use the class AlterDB to change a database
 name.
 It
 always throws the exception DB_PINNED_X although I use unpin before
 using
 AlterDB. I found the problem is that the method
 TableDiskAccess.locked(db,
 this) always returns true. Please see the attachment and help me
 solve
 the
 problem.
 Thanks in advance.











___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Ask about AlterDB

2013-03-26 Thread truc . cam

I was getting the error Event 'event100' is unknown.
Response: the event will be created If It doesn't exist. I don't know  
why you get that error.


if (context.events.get(eventName) == null)
{
createEvent.execute(context);
}

More to that, you were talking about databases, but I don?t see  
anything related to databases in your tests.
Reponse: I just try to show you what happens if I use many contexts  
(of course for storing many databases). Events can't work with many  
contexts.


And avoid the creation of new Context instances
Response: That why I asked you how should I need to do when I use more  
than one database on a context.


Quoting Christian Grün christian.gr...@gmail.com:


Please invest some more time, and send me examples that run out of the
box. In the given case, I had to rename the class constructor to
Case1; next, I was getting the error Event 'event100' is unknown.
More to that, you were talking about databases, but I don?t see
anything related to databases in your tests.

If you create a BaseXServer instance, you should generally use
ClientSession instances whenever you communicate with the server, and
avoid the creation of new Context instances. You may want to have a
look at the EventTest class [1], which demonstrates how multiple
clients can concurrently watch events in the client/server
architecture.

[1]  
https://github.com/BaseXdb/basex/blob/master/src/test/java/org/basex/test/server/EventTest.java

___

On Tue, Mar 26, 2013 at 3:57 AM,  truc@emotive.de wrote:

Thank you for your answer.
I give you some cases why I can't use many contexts to store many databases.
Case1: create only one BaseXServer. In this case, the context of the
BaseXServer is not related to contexts that I store my databases. Thus, no
contexts can work with events.
Case2: create one BaseXServer for each context. In this case, only one the
first context (and event) can work with events.
These are the reasons why I have to use ONE context to store many databases.



Quoting Christian Grün christian.gr...@gmail.com:


Thanks. I?m not sure what you tried to do with event? Do you have a

little example or some more information?
___


Thank you for you answer. I have ever used many contexts to store many
databases but the EVENT coundn't work properly. Dimitar has adviced me
that
I should use one context for many databases. It has worked well until I
used
AlterDB.
How should I do to use many databases on one context?



Quoting Christian Grün christian.gr...@gmail.com:


Thanks for your response. I use pin so that a context can store many
databases. If I don't use pin, a newest database will override the
current
database (see context.dbs.list.elementData). Please tell me how can I
use
many database on one context.




?I see. Sounds like a dangerous journey, because the whole
architecture relies on the concept that only one database is opened in
the current context. Why do you want to keep more than one database
opened at the same time?

Christian
__


Quoting Christian Grün christian.gr...@gmail.com:


Hi,

it?s probably a better idea to avoid explicit (un)pinning of nodes;

all commands should correctly do this for you. Out of interest: why
did you choose to do pinning by yourself?

Best,
Christian
_


Dear BaseX team,
I want to ask you how to use the class AlterDB to change a database
name.
It
always throws the exception DB_PINNED_X although I use unpin before
using
AlterDB. I found the problem is that the method
TableDiskAccess.locked(db,
this) always returns true. Please see the attachment and help me
solve
the
problem.
Thanks in advance.


















___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [GUI] Properties window is frozen for a DB with a lot of documents

2013-03-26 Thread Lukas Kircher
Hi Fabrice,

we just uploaded a fix (hopefully) for this problem. The maximum number of
displayed nodes is now limited. Would be nice if you could report your
experience with the current solution, which will be contained in the next
latest stable release.

Cheers,
Lukas

On Fri, Mar 15, 2013 at 9:36 AM, Fabrice Etanchaud
fetanch...@questel.comwrote:

  Dear all,

 ** **

 When dealing with collections containing more than a million documents,***
 *

 The Properties window freezes the entire GUI while  trying to display the
 documents’ list.

 How could I disable the treeview for such collections ?

 ** **

 I have to deal with such collections because XQuery Update on many many
 nodes takes a long long time to complete,

 So add/replace/delete is a good alternative.

 ** **

 Thank you for your continuous help and your great XNDB.

 ** **

 Last : is the new ADDCACHE option the way to add data near the node count
 limit without corrupting the collection ?

 ** **

 Best regards,

 Fabrice

 Questel-Orbit

 ___
 BaseX-Talk mailing list
 BaseX-Talk@mailman.uni-konstanz.de
 https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Ask about AlterDB

2013-03-26 Thread Christian Grün
 Response: That why I asked you how should I need to do when I use more than
 one database on a context.

With XQuery, you can open and process as many databases as you want; see e.g:

   for $c in 1 to 100
   let $dbname := db || $c
   return db:open($dbname)

There will be no need at all to explicitly bind databases to a context.

Hope this helps,
Christian
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [GUI] Properties window is frozen for a DB with a lot of documents

2013-03-26 Thread Fabrice Etanchaud
Dear Lukas, thank you for your help !

Is this fix present in the delivery of this morning ?
The problem is still present.

Best regards,
Fabrice


The heart of fools is in their mouth, but the mouth of the wise men is in 
their heart
-- Siracide

De : Lukas Kircher [mailto:lukaskirch...@gmail.com]
Envoyé : mardi 26 mars 2013 10:26
À : Fabrice Etanchaud
Cc : basex-talk@mailman.uni-konstanz.de
Objet : Re: [basex-talk] [GUI] Properties window is frozen for a DB with a lot 
of documents

Hi Fabrice,

we just uploaded a fix (hopefully) for this problem. The maximum number of 
displayed nodes is now limited. Would be nice if you could report your 
experience with the current solution, which will be contained in the next 
latest stable release.

Cheers,
Lukas
On Fri, Mar 15, 2013 at 9:36 AM, Fabrice Etanchaud 
fetanch...@questel.commailto:fetanch...@questel.com wrote:
Dear all,

When dealing with collections containing more than a million documents,
The Properties window freezes the entire GUI while  trying to display the 
documents' list.
How could I disable the treeview for such collections ?

I have to deal with such collections because XQuery Update on many many nodes 
takes a long long time to complete,
So add/replace/delete is a good alternative.

Thank you for your continuous help and your great XNDB.

Last : is the new ADDCACHE option the way to add data near the node count limit 
without corrupting the collection ?

Best regards,
Fabrice
Questel-Orbit

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.demailto:BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [GUI] Properties window is frozen for a DB with a lot of documents

2013-03-26 Thread Christian Grün
Hi Fabrice,
and thanks Lukas,

I’ve just uploaded another snapshot; could you give it another try?

Best,
Christian
___

On Tue, Mar 26, 2013 at 2:40 PM, Fabrice Etanchaud
fetanch...@questel.com wrote:
 Dear Lukas, thank you for your help !



 Is this fix present in the delivery of this morning ?

 The problem is still present.



 Best regards,

 Fabrice





 “The heart of fools is in their mouth, but the mouth of the wise men is in
 their heart”

 -- Siracide



 De : Lukas Kircher [mailto:lukaskirch...@gmail.com]
 Envoyé : mardi 26 mars 2013 10:26
 À : Fabrice Etanchaud
 Cc : basex-talk@mailman.uni-konstanz.de
 Objet : Re: [basex-talk] [GUI] Properties window is frozen for a DB with a
 lot of documents



 Hi Fabrice,



 we just uploaded a fix (hopefully) for this problem. The maximum number of
 displayed nodes is now limited. Would be nice if you could report your
 experience with the current solution, which will be contained in the next
 latest stable release.



 Cheers,

 Lukas

 On Fri, Mar 15, 2013 at 9:36 AM, Fabrice Etanchaud fetanch...@questel.com
 wrote:

 Dear all,



 When dealing with collections containing more than a million documents,

 The Properties window freezes the entire GUI while  trying to display the
 documents’ list.

 How could I disable the treeview for such collections ?



 I have to deal with such collections because XQuery Update on many many
 nodes takes a long long time to complete,

 So add/replace/delete is a good alternative.



 Thank you for your continuous help and your great XNDB.



 Last : is the new ADDCACHE option the way to add data near the node count
 limit without corrupting the collection ?



 Best regards,

 Fabrice

 Questel-Orbit


 ___
 BaseX-Talk mailing list
 BaseX-Talk@mailman.uni-konstanz.de
 https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk




 ___
 BaseX-Talk mailing list
 BaseX-Talk@mailman.uni-konstanz.de
 https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] [GUI] Properties window is frozen for a DB with a lot of documents

2013-03-26 Thread Fabrice Etanchaud
Dear all,
I'm sorry but I see no difference.

That's not a blocking issue at all.

And once again thank you for your fantastic XNDB.

Best,
Fabrice

-Message d'origine-
De : Christian Grün [mailto:christian.gr...@gmail.com] 
Envoyé : mardi 26 mars 2013 14:50
À : Fabrice Etanchaud
Cc : basex-talk@mailman.uni-konstanz.de
Objet : Re: [basex-talk] [GUI] Properties window is frozen for a DB with a lot 
of documents

Hi Fabrice,
and thanks Lukas,

I've just uploaded another snapshot; could you give it another try?

Best,
Christian
___

On Tue, Mar 26, 2013 at 2:40 PM, Fabrice Etanchaud fetanch...@questel.com 
wrote:
 Dear Lukas, thank you for your help !



 Is this fix present in the delivery of this morning ?

 The problem is still present.



 Best regards,

 Fabrice





 The heart of fools is in their mouth, but the mouth of the wise men 
 is in their heart

 -- Siracide



 De : Lukas Kircher [mailto:lukaskirch...@gmail.com] Envoyé : mardi 26 
 mars 2013 10:26 À : Fabrice Etanchaud Cc : 
 basex-talk@mailman.uni-konstanz.de
 Objet : Re: [basex-talk] [GUI] Properties window is frozen for a DB 
 with a lot of documents



 Hi Fabrice,



 we just uploaded a fix (hopefully) for this problem. The maximum 
 number of displayed nodes is now limited. Would be nice if you could 
 report your experience with the current solution, which will be 
 contained in the next latest stable release.



 Cheers,

 Lukas

 On Fri, Mar 15, 2013 at 9:36 AM, Fabrice Etanchaud 
 fetanch...@questel.com
 wrote:

 Dear all,



 When dealing with collections containing more than a million 
 documents,

 The Properties window freezes the entire GUI while  trying to display 
 the documents' list.

 How could I disable the treeview for such collections ?



 I have to deal with such collections because XQuery Update on many 
 many nodes takes a long long time to complete,

 So add/replace/delete is a good alternative.



 Thank you for your continuous help and your great XNDB.



 Last : is the new ADDCACHE option the way to add data near the node 
 count limit without corrupting the collection ?



 Best regards,

 Fabrice

 Questel-Orbit


 ___
 BaseX-Talk mailing list
 BaseX-Talk@mailman.uni-konstanz.de
 https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk




 ___
 BaseX-Talk mailing list
 BaseX-Talk@mailman.uni-konstanz.de
 https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


[basex-talk] xquery help

2013-03-26 Thread Cerstin Elisabeth Mahlow
Hi,

I got stuck with an XQuery, could you please help?

I have data like this:

collection
entry
  q[text() contains text ('Johann' ftand 'Ballhorn') distance at most 5 words 
ordered][self::*:p or self::*:q]/q
  id12345/id
  pbey welchen die Verbesserungen durch Johann Ballhorn öfter vorkommen als 
man glauben sollte./p
/entry
entry…
/collection

All I want to get back is the p node with the content of the q node applied 
to p using ft:mark, i.e., the node with highlighting like this:

  pbey welchen die Verbesserungen durch markJohann/mark 
markBallhorn/mark öfter vorkommen als man glauben sollte./p

But I don't manage to call ft:mark with the correct parameters.

I tried variants of this:

for $i at $p in //entry
let $q := $i/q
return ft:mark($i $q)

But this gives

Expecting closing bracket for 'ft:mark(…'

I think I have to use concat() in some way, but how?

Thanks in advance

Cerstin
-- 
Dr. phil. Cerstin Mahlow

Universität Basel
Departement Sprach- und Literaturwissenschaften
Fachbereich Deutsche Sprach- und Literaturwissenschaft
Nadelberg 4
4051 Basel
Schweiz

Tel:  +41 61 267 07 65
Fax: +41 61 267 34 40
Mail: cerstin.mah...@unibas.ch
Web: http://www.oldphras.net

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] xquery help

2013-03-26 Thread Alexander Holupirek
Hi Cerstin,

On 26.03.2013, at 16:07, Cerstin Elisabeth Mahlow cerstin.mah...@unibas.ch 
wrote:

 Hi,
 
 I got stuck with an XQuery, could you please help?
 
 I have data like this:
 
 collection
 entry
  q[text() contains text ('Johann' ftand 'Ballhorn') distance at most 5 
 words ordered][self::*:p or self::*:q]/q
  id12345/id
  pbey welchen die Verbesserungen durch Johann Ballhorn öfter vorkommen als 
 man glauben sollte./p
 /entry
 entry…
 /collection
 
 All I want to get back is the p node with the content of the q node 
 applied to p using ft:mark, i.e., the node with highlighting like this:
 
  pbey welchen die Verbesserungen durch markJohann/mark 
 markBallhorn/mark öfter vorkommen als man glauben sollte./p
 
 But I don't manage to call ft:mark with the correct parameters.
 
 I tried variants of this:
 
 for $i at $p in //entry
 let $q := $i/q
 return ft:mark($i $q)
 
 But this gives
 
 Expecting closing bracket for 'ft:mark(…'
 
 I think I have to use concat() in some way, but how?
 
 Thanks in advance

if I got you right you want to evaluate a query, such as

ft:mark(pbey welchen die Verbesserungen durch Johann Ballhorn öfter vorkommen 
als man glauben sollte./p[./text() contains text ('Johann' ftand 'Ballhorn') 
distance at most 5 words ordered][self::*:p or self::*:q])

which you construct from your collection?

pbey welchen .../p is a database node and
q[text() contains text ('Johann' ... ]/q holds a query predicate as string

So you dynamically construct a query string that you like to evaluate?

==

Since ft:mark() operates on database nodes a simply typing

ft:mark(pbey welchen die Verbesserungen durch Johann Ballhorn öfter vorkommen 
als man glauben sollte./p[./text() contains text ('Johann' ftand 'Ballhorn') 
distance at most 5 words ordered][self::*:p or self::*:q])

in BaseXGUi results in 

[BXDB0001] ft:mark(element p { (bey welchen die Verbesserungen durch Johann 
Ballhorn öfter vorkommen als man glauben sollte.) }[text() contains text 
(Johann ftand Ballhorn) ordered distance(0-5 word)][(self::*:p or 
self::*:q)]): database node expected.

==

However, we can create a database from your input data to set up a running 
example:

  db:create('cm', collection
  entry
   q[text() contains text ('Johann' ftand 'Ballhorn') distance at most 5 
words ordered][self::*:p or self::*:q]/q
   id12345/id
   pbey welchen die Verbesserungen durch Johann Ballhorn öfter vorkommen als 
man glauben sollte./p
  /entry
  /collection, cm.xml)

==

Query:

let $in := doc('cm')
let $p := $in//p
let $q := $in//q
return
  ( $p, $q )

yields

pbey welchen die Verbesserungen durch Johann Ballhorn öfter vorkommen als man 
glauben sollte./p
q[text() contains text ('Johann' ftand 'Ballhorn') distance at most 5 words 
ordered][self::*:p or self::*:q]/q

==

let $in := doc('cm')
let $p := $in//p
let $q := $in//q
let $qs := concat('ft:mark($p', $q, ')')
return
  $qs

constructs the query string

ft:mark($p[text() contains text ('Johann' ftand 'Ballhorn') distance at most 5 
words ordered][self::*:p or self::*:q])

==

let $in := doc('cm')
let $p := $in//p
let $q := $in//q
let $qs := concat('ft:mark($p', $q, ')')
return
  xquery:eval($qs)

evaluates the query string ... aehh .. tries to evaluate the query string

[XPST0008] Undefined variable $p.

==

http://docs.basex.org/wiki/XQuery_Module#xquery:eval shows how to pass a 
binding of into the query to be evaluated

let $in := doc('cm')
let $p := $in//p
let $q := $in//q
let $qs := concat('ft:mark($binding', $q, ')')
let $bm := map{ '$binding' := $p }
return
  xquery:eval($qs, $bm)

constructs a query string

ft:mark($binding[text() contains text ('Johann' ftand 'Ballhorn') distance at 
most 5 words ordered][self::*:p or self::*:q])
and a binding of $binding and

results in

pbey welchen die Verbesserungen durch markJohann/mark 
markBallhorn/mark öfter vorkommen als man glauben sollte./p

Which, I hope, is the result you wanted to achieve.

All the best,
Alex
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] xquery help

2013-03-26 Thread Cerstin Elisabeth Mahlow
Hi Alex,

thanks for your answer!

Am 26.03.2013 um 18:43 schrieb Alexander Holupirek 
alexander.holupi...@uni-konstanz.de
:

 
 if I got you right you want to evaluate a query, such as
 
 ft:mark(pbey welchen die Verbesserungen durch Johann Ballhorn öfter 
 vorkommen als man glauben sollte./p[./text() contains text ('Johann' ftand 
 'Ballhorn') distance at most 5 words ordered][self::*:p or self::*:q])
 
 which you construct from your collection?
 
 pbey welchen .../p is a database node and
 q[text() contains text ('Johann' ... ]/q holds a query predicate as string
 
 So you dynamically construct a query string that you like to evaluate?

I already have the complete query stored in the very same collection

 ==
 
 Since ft:mark() operates on database nodes a simply typing
 
 ft:mark(pbey welchen die Verbesserungen durch Johann Ballhorn öfter 
 vorkommen als man glauben sollte./p[./text() contains text ('Johann' ftand 
 'Ballhorn') distance at most 5 words ordered][self::*:p or self::*:q])
 
 in BaseXGUi results in 
 
 [BXDB0001] ft:mark(element p { (bey welchen die Verbesserungen durch Johann 
 Ballhorn öfter vorkommen als man glauben sollte.) }[text() contains text 
 (Johann ftand Ballhorn) ordered distance(0-5 word)][(self::*:p or 
 self::*:q)]): database node expected.

Yes, I tried this :)

[…]

 let $in := doc('cm')
 let $p := $in//p
 let $q := $in//q
 let $qs := concat('ft:mark($p', $q, ')')
 return
  xquery:eval($qs)
 
 evaluates the query string ... aehh .. tries to evaluate the query string
 
 [XPST0008] Undefined variable $p.

And also this.

 
 http://docs.basex.org/wiki/XQuery_Module#xquery:eval shows how to pass a 
 binding of into the query to be evaluated
 
 let $in := doc('cm')
 let $p := $in//p
 let $q := $in//q
 let $qs := concat('ft:mark($binding', $q, ')')
 let $bm := map{ '$binding' := $p }
 return
  xquery:eval($qs, $bm)
 
 constructs a query string
 
 ft:mark($binding[text() contains text ('Johann' ftand 'Ballhorn') distance at 
 most 5 words ordered][self::*:p or self::*:q])
 and a binding of $binding and
 
 results in
 
 pbey welchen die Verbesserungen durch markJohann/mark 
 markBallhorn/mark öfter vorkommen als man glauben sollte./p
 
 Which, I hope, is the result you wanted to achieve.


OK, I now have this:

for $i at $p in //entry
let $q := $i/q
let $text := if ($i/p) then $i/p else $i/l
let $ft := concat(ft:mark($binding, $q,))
let $bm := map{'$binding' := $text}
return xquery:eval($ft, $bm)

The if clause allows to skip the extension [self::*:p or self::*:q] of the 
query.


Thanks for your help!

Cerstin
-- 
Dr. phil. Cerstin Mahlow

Universität Basel
Departement Sprach- und Literaturwissenschaften
Fachbereich Deutsche Sprach- und Literaturwissenschaft
Nadelberg 4
4051 Basel
Schweiz

Tel:  +41 61 267 07 65
Fax: +41 61 267 34 40
Mail: cerstin.mah...@unibas.ch
Web: http://www.oldphras.net

___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk