Re: [basex-talk] Error in 7.6 !! but not in 7.5

2013-03-14 Thread Christian Grün
 I am storing Dates in MMDD Format as PubDate d=20040608 tag. The
 above query will return
 the Date of the Document published for the searched criteria. Using the
 BaseX 7.5, I was able to run the query
 correctly. But with 7.6, I am getting error

 Single item expected, (20040608, 20040609) found

It looks as if a node in your data has several Publish or PubDate
children; to confirm this, you could try the following queries..

  a) db:open('work')//Doc/Publish[count(PubDate)  1]
  b) db:open('work')//Doc[count(PubDate)  1]/Publish

As you are searching for string theory, I have some guess that it
could also be related to the two-dimensionality of quantum states.

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


[basex-talk] xquery:eval yields NullPointerException

2013-03-14 Thread Marco Lettere

Hi all,
on the way to writing a small DSL I stumbled upon the following BaseX 
7.6 issue.
I'm not able to explain to myself why the first two expressions of the 
following xquery module return correctly whereas the last yields 
NullPointerException (as shown in the appended stacktrace).
What I'm mtrying to do is to wrap up some modification code into 
userfriendly function calls that can be used in mini xquery scripts to 
formalize xml workflow.

Thank you for any help,
Marco.

declare variable $globals := map {
  'change' := local:change#1,
  'generate' := local:gen#0
};

declare function local:gen(){
  b/
};

declare function local:change($doc){
  copy $newdoc := $doc
  modify(
insert node a/ as last into $newdoc
  )
  return $newdoc
};

(
  xquery:eval(copy $newdoc := b/
   modify(
  insert node a/ as last into $newdoc
   )
   return $newdoc,$globals),

  xquery:eval($generate(), $globals),
  xquery:eval($change($doc), map:new( ($globals, map { doc := b/})))
)

The stacktrace and query plan:

Error:
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 7.6
Java: Oracle Corporation, 1.7.0_15
OS: Linux, i386
Stack Trace:
java.lang.NullPointerException
org.basex.query.up.expr.Transform.value(Transform.java:68)
  org.basex.query.QueryContext.value(QueryContext.java:296)
  org.basex.query.func.UserFunc.value(UserFunc.java:175)
  org.basex.query.QueryContext.value(QueryContext.java:296)
org.basex.query.func.BaseFuncCall.value(BaseFuncCall.java:68)
  org.basex.query.QueryContext.value(QueryContext.java:296)
org.basex.query.value.item.FuncItem.invValue(FuncItem.java:104)
org.basex.query.func.DynamicFunc.value(DynamicFunc.java:56)
  org.basex.query.QueryContext.value(QueryContext.java:296)
  org.basex.query.QueryContext.value(QueryContext.java:254)
  org.basex.query.func.FNXQuery.eval(FNXQuery.java:95)
  org.basex.query.func.FNXQuery.eval(FNXQuery.java:71)
  org.basex.query.func.FNXQuery.iter(FNXQuery.java:37)
  org.basex.query.QueryContext.iter(QueryContext.java:285)
  org.basex.query.expr.List$1.next(List.java:100)
org.basex.query.QueryContext.execute(QueryContext.java:524)
org.basex.query.QueryProcessor.execute(QueryProcessor.java:96)
  org.basex.core.cmd.AQuery.query(AQuery.java:77)
  org.basex.core.cmd.XQuery.run(XQuery.java:22)
  org.basex.core.Command.run(Command.java:342)
  org.basex.core.Command.exec(Command.java:321)
  org.basex.core.Command.execute(Command.java:78)
  org.basex.gui.GUI.exec(GUI.java:397)
  org.basex.gui.GUI$7.run(GUI.java:349)
Compiling:
- pre-evaluating map { change:=function($1) as item()* { 
local:change(($1)) }, generate:=function() as item()* { local:gen(()) } }

Optimized Query:
declare function local:change($doc) { copy $newdoc as node() := $doc 
modify insert node element a { () } into $newdoc return $newdoc };

declare function local:gen() { element b { () } };
(xquery:eval(copy $newdoc := $generate()
   modify(
  insert node a/ as last into $newdoc
   )
   return $newdoc, map{ change:=function($1) as item()* 
{ local:change(($1)) }, generate:=function() as item()* { 
local:gen(()) } }), xquery:eval($generate(), map{ 
change:=function($1) as item()* { local:change(($1)) }, 
generate:=function() as item()* { local:gen(()) } }), 
xquery:eval($change($doc), map:new((map{ change:=function($1) as 
item()* { local:change(($1)) }, generate:=function() as item()* { 
local:gen(()) } }, map { doc:=element b { () } }

Query plan:
QueryPlan
  UserFuncs
UserFunc name=local:change arg0=doc
  Transform
Let var=$newdoc as node()
  VarRef
Var name=$doc id=2/
  /VarRef
/Let
Insert
  VarRef
Var name=$newdoc as node() id=3/
  /VarRef
  CElem
QNm value=a type=xs:QName/
  /CElem
/Insert
VarRef
  Var name=$newdoc as node() id=3/
/VarRef
  /Transform
/UserFunc
UserFunc name=local:gen
  CElem
QNm value=b type=xs:QName/
  /CElem
/UserFunc
  /UserFuncs
  VarStack
Var name=$globals id=0/
  /VarStack
  List
FNXQuery name=eval(string[,bindings])
  Str value=copy $newdoc := $generate()#x0A; 
modify(#x0A;  insert node lt;a/gt; as last into 
$newdoc  #x0A; )#x0A;   return $newdoc type=xs:string/

  Map size=2
Str value=change type=xs:string/
FuncItem type=function(item()*) as item()*
  Var name=$1 id=1/
  BaseFuncCall name=local:change(($1))
VarRef
  Var name=$1 id=1/
/VarRef
  /BaseFuncCall
/FuncItem
Str value=generate type=xs:string/
FuncItem type=function() as item()*
  BaseFuncCall name=local:gen(())/
/FuncItem
  /Map
/FNXQuery
FNXQuery name=eval(string[,bindings])
  Str 

[basex-talk] Home, DBPATH etc. when basexserver is started in service mode

2013-03-14 Thread Subash Kalbarga
Hi


a)   I am a new user, so far love basex and I am on Win7. I use the zip 
file (rather than the setup program) and extract

b)   I specifically set -Dorg.basex.path=c:\blah in basexserver.bat and 
basexclient.bat

c)If I now start basexserver.bat from a command prompt and then from 
another command prompt start basexclient.bat and do an info I see DB_PATH, 
REPO_PATH etc. set correctly to c:\blah as it should be.

d)   However if I run basexserver.bat -S (start as service) and then 
connect via  basexclient.bat ,and do a info, the DB_PATH_REPO_PATH etc. are 
completely confused and basexclient thinks they are in its current directory. 
Moreover, if I actually create a database and add a file to it and close and 
then check where the data is stored, it is stored in the place basexclient 
thinks the DBPATH is rather than where it should be as per the server

e)   I am sort of sure that the server is looking at the correct paths even 
when started in -S mode because I see

.basexhistory and .logs being created in C:\blah



Thanks in advance


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


[basex-talk] timezone formatting

2013-03-14 Thread Marco Lettere

Hi again,

when, in Basex 7.6, formatting a datetime with

format-dateTime(current-dateTime(), 
[Y0001][M01][D01][h01][m01][s01][Z])


I was expecting something like

20130314035118+0100

for my area (Central Europe) and instead I get

201303140351180060.

Looks like minutes are not translated to hours and the sign is missing. 
For documentation I'm referring to


http://www.w3.org/TR/xpath-functions-30/#rules-for-datetime-formatting.

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


Re: [basex-talk] re-sort database

2013-03-14 Thread Cerstin Elisabeth Mahlow
Hi,

Am 14.03.2013 um 00:02 schrieb Liam R E Quin l...@w3.org:

 On Wed, 2013-03-13 at 22:29 +0100, Christian Grün wrote:
 
 You could try to export your data and create a new
 database without updatable index structures; this could also speed up
 your updates. Maybe it even allows you to update all nodes in a single
 run.
 
 I already set VM=-Xmx1024m and I use BaseX 7.6.1 Beta from February 14 on a 
 MacBook Air with a 2 GHz processor and 8 GB RAM.
 
 I'd try using VM=-Xmx6000m if you have 8G of RAM.

OK, after combining both tips (using a database without updatable index and 
setting VM=-Xmx6000m) it worked in a single run. Thanks!

After 5'729'855 ms (95 minutes) it updated 35'344 nodes within the 165'000 
entries in the database.

I don't know if this is slow and could be improved, but I'm happy having fixed 
the database :)

Best regards and thanks again

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


[basex-talk] problem with parse-xml function

2013-03-14 Thread Bartosz Marciniak
Hi,

Let me show you a simple example that shows strange behaviour of
parse-xml() function:

---
declare function local:transform($nodes as node()*) as item()* {
for $node in $nodes
return
typeswitch($node)
case text() return parse-xml-fragment($node)
case element(b) return element b {local:transform($node/node())}
 default return local:transform($node/node())
};

let $textdoc :=
doclt;agt;content 1lt;/agt;
  blt;agt;content 2lt;/agt;/b
/doc

let $doc :=
doc{
for $node in $textdoc/node()
return local:transform($node)
}/doc

let $doc2 :=
doc{
for $node in $doc/node()
   return $node
}/doc

return $doc


After running it on baseX 7.6 the result is:

$doc =
doc
  acontent 1/a
  b
acontent 2/a
  /b
/doc

but it differs from doc2:

$doc2 =
doc
  b
acontent 2/a
  /b
  acontent 1/a
/doc


Why does using parse-xml() function change the order of the elements?

I ran this simple code on zorba and eXist (using util:parse() function)
and $doc2 was the same as $doc.


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


[basex-talk] store results of a query in a new database

2013-03-14 Thread Cerstin Elisabeth Mahlow
Hi,

I would like to store the results of an xquery extracting some nodes from an 
existing database into a new database.

So I have the DB 'collect' open and then do:

db:create('annotate-abcdef')

and then

for $i at $p in //entry[phraseme[text() = abcdef] and selected[text() = 
yes]]
let $query := $i/query
let $nodeid := $i/node
let $node := db:open-id('TG-DTA-GerManC-stemming-ws', $nodeid)
let $nodename := name($node)
let $nodecontent := string($node)
return insert node div{$nodeid} {$query} {element {$nodename} 
{$nodecontent}} 
/div as last into db:open('annotate-abcdef')

However, the error message is 

[XUDY0027] Insert target must not be empty.

How would I add a root element to the new DB, as I don't wan't to link it to an 
existing document?  All nodes added to the DB are only results from queries 
over an existing DB. All I can see from the Wiki is using a document as initial 
data for the DB.

How do I set UPDINDEX ON for the new DB?  I will later update the information 
added in the first place by other queries.  To be able to use ft:mark, I would 
have to optimize the DB with db:optimize() after having added nodes, is this 
correct?

Thanks in advance and best regards

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


[basex-talk] How to update db online without closing application ?

2013-03-14 Thread Pratik Kharwade
Hi,

Our application will be a desktop application with data in XML fomrat. The
data is nothing but articles stored as XML and will be displayed in HTML
format with the help of XSLT. For this we are using BaseX as desktop DB.
Just changed to 7.6.

The front-end will have a ListBox displaying the names of the articles, when
selected by user, will display the transformed (HTML) document. Along with
this
functionality, we have given a search tool, which have some common XQuery
features
like; Exact Phrase, Proximity Search, Word1 OR Word, Word1 NOT Word2...

This is what we have done successfully.

Now we are stucked at one point. We have to give an online update facility
through which the user DB will get updated, if not, as soon as he goes
online.
This part is also done but...

While updating, the our application doesnt response till the updates are
done.
The user can't interact with the application.

What we have planned is updating should be done as a background process and
the user can interact with the application while updating.

Also after updating the DB should get optimize and the updates should get
reflected
at the front-end.

I hope I have cleared our needs and now waiting for your answer/suggestions.


Have a nice day
Pratik
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk