Re: [basex-talk] missing web.xml from docker image

2020-09-15 Thread Michael Seiferle
Hi Nicholas, 

I think this might be indeed a good chance to re-engineer our docker image. 
We had one user that maintained the image long time ago, but maybe it would be 
good to have it updated. 
We don’t tend to use docker that often, as you might have noticed ;-)

best
Michael


> Am 05.09.2020 um 02:24 schrieb Nicholas Saunders 
> :
> 
> There was an additional response:
> 
> 
> https://devops.stackexchange.com/q/12338/23443
> 
> with remarks about the basex docker image which are a bit over my head
> but should prove useful for the maintainer(s).
> 
> On 9/4/20, Nicholas Saunders  wrote:
>> Certainly, I was able to get the container running.
>> 
>> The web.xml threw me off, and then the docs said to use a deprecated
>> command.
>> 
>> On 9/4/20, Markus Wittenberg  wrote:
>>> Hi there,
>>> 
>>> in fact the web.xml is not missing. You should be able to connect to
>>> basex using the exposed ports. This shouldn't be a problem on localhost.
>>> Depending on your system configuration on a server you might have to
>>> provide access to the ports to the web explicitly.
>>> 
>>> The REST endpoints /rest/* over port 8984 are also activated by default.
>>> 
>>> If you follow the example Running your own Application/DBA in the
>>> documentaton you can also use RESTXQ applications.
>>> 
>>> Best regards,
>>> 
>>>   Markus
>>> 
>>> Am 04.09.2020 um 12:11 schrieb Christian Grün:
 …anyone else around here who uses Docker?
 
 On Fri, Sep 4, 2020 at 11:32 AM Nicholas Saunders
  wrote:
> thanks.  I was able to create the container okay, but how do I connect
> to the database?
> 
> What I've done so far is gain root on the container itself and
> manually copy files in to add to the db.  Can I perhaps connect to the
> db on the container through basex on the host?  Or would that be an
> odd approach?
> 
> On 9/3/20, Christian Grün  wrote:
>> Thanks for the observation. I’ll try to get into contact with the guys
>> who
>> wrote the article and see if this can be updated.
>> 
>> 
>> 
>> Nicholas Saunders  schrieb am Fr., 4.
>> Sep.
>> 2020, 01:19:
>> 
>>> from what I gather, the link command is deprecated:
>>> 
>>>  it sounds like you are using the link feature. This has been
>>> deprecated for years. instead, use a   v2 or v3 docker-compose.yml
>>> file (if using compose) or if using a different system, simply put
>>> both containers on the same│
>>> 
>>> so the documentation is out of date.
>>> 
>>> On 9/3/20, Christian Grün  wrote:
 Hi Nicholas,
 
 Have you already worked through the Docker documentation in our Wiki
 [1]?
 
 Best,
 Christian
 
 [1] https://docs.basex.org/wiki/Docker
 
 
 
 
 On Thu, Sep 3, 2020 at 4:23 PM Nicholas Saunders
  wrote:
> I've just opened an issue:
> 
> https://github.com/BaseXdb/basex/issues/1936
> 
> based on an inability to run the docker image:
> 
> https://devops.stackexchange.com/q/12338/23443
> 
> 
> but thought I'd ask here if there might be something obvious.  I'm
> creating the container from the hub image with:
> 
> docker run -d \
> --name basexhttp \
> --publish 1984:1984 \
> --publish 8984:8984 \
> --volume "$HOME/basex/data":/srv/basex/data \
> --volume "$HOME/basex/repo":/srv/basex/repo \
> --volume "$HOME/basex/webapp":/srv/basex/webapp \
> basex/basexhttp:latest
> 
> 
> and another person reported the missing file.  Is the file missing?
> I'm not sure.
>>> 
>>> --
>>> Markus Wittenberg
>>> 
>>> Tel +49 (0)341 248 475 36
>>> Mail wittenb...@axxepta.de
>>> 
>>> 
>>> 
>>> axxepta solutions GmbH
>>> Lehmgrubenweg 17, 88131 Lindau
>>> 
>>> Amtsgericht Berlin HRB 97544B
>>> Geschäftsführer: Karsten Becke, Maximilian Gärber
>>> 
>>> 
>> 



Re: [basex-talk] RESTXQ path resolution

2020-07-31 Thread Michael Seiferle
Hi Ben, 



> Am 30.07.2020 um 22:23 schrieb Ben Pracht :
> 
> * From testing, it appears that the basexhttp server also starts the database 
> server.  From the options available in .basex, I was under the impression I 
> had to start basexserver separately, but when I tried to run basexserver and 
> subsequently basexhttp, the basexhttp server said the port was already in 
> use.  

Yes that is right; it will start both the HTTP-Server and the BaseX Server
https://docs.basex.org/wiki/Web_Application 

>> An instance of the Jetty Web Server  will be 
>> started, which by default listens to the port 8984. Additionally, the BaseX 
>> Database Server  will be 
>> started, accessible on port 1984. The command-line output will look 
>> something like that (the JSP warning message can be ignored 
>> ):
> 



> * It's probably obvious to people who write RESTXQ code readily, but it seems 
> worthwhile to note that the services run on the basexhttp server JVM, and not 
> the basexserver JVM.  Because I anticipate needing multiple databases, I'm 
> trying to set up the server so that it can fork work over to the appropriate 
> database.  It would be nice if I could have XQUERY code running at the 
> basexserver JVM.

This might be a little more work, you could start multiple BaseXServer 
Instances and use the client module [1] to connect to these instances and run 
queries on them.
https://docs.basex.org/wiki/Client_Module 



So you’d basically have an restxq endpoint, and the endpoint decides which 
query to send to which basexserver via the client module.


> 
> * In my .basex file, I specify 
> HOST=localhost
> PORT=1984
> SERVERPORT=1984
> SERVERHOST=localhost
> 
> Since it's the basexhttp that starts the basexserver, it's not clear to me 
> which is considered the server, but nonetheless, somehow I'm able to get the 
> above to at least partially function, though I'm confident that I did this 
> wrong.  

The options are explained here, 

https://docs.basex.org/wiki/Options#Client.2FServer_Architecture 


basexclient uses these options: 
>> HOST: This host name is used by the client when connecting to a server. 
>> PORT: This port is used by the client when connecting to a server.

basexserver uses these options:
>> SERVERPORT: This is the port the database server will be listening to.
>> SERVERHOST:  This is the host name or ip address the server is bound to

IIRC these Options originated in the times before basexhttp / RestXQ :-)

> 
> * I noticed there's a REST and a RESTXQ, for most part would I always want to 
> use RESTXQ?

RestXQ is way more flexible (in my opinion ;-)) and a lot more developer 
accessible (again in my opinion) for building web applications. 

> 
> I hope those who write the documentation do not take offense to my questions.
Not at all  :)
> I'm not sure I would have thought to document it or how to write it in such a 
> way that it doesn't get asked.
I think the many possibilities and features make it very hard to convey all the 
information needed at any time :-)

> This project is one of the best documented in the OSS community, and even 
> better than some products for which money changes hands.
Thank you very much! :)
> 
> Thanks,
> Ben
Hope this helps!
Michael



Re: [basex-talk] RESTXQ path resolution

2020-07-13 Thread Michael Seiferle
Hi Ben,

Make sure to first read my previous mail, because you need a working 
restxq-Setup ;-)

Theres the „rest:wadl()“ function, that generates a representation of all 
available endpoints.

I added it to my example project, feel free to check it out here:
> https://git.basex.io/basex-public/mailinglist-autocomplete/-/commit/84fda246ca3d1dfe7319ff4a401aa1504feee48a

The result will look something like this: 
[…]









[…]

Hope this helps :-)

Michael 


> Am 13.07.2020 um 00:31 schrieb Ben Pracht :
> 
> 
> 
> In my case, I put the hello-world service in the main project directory, in 
> the modules directory where the RESTXQPATH and in the RESTPATH.  I've tried 
> renaming the hello-world to .xq, .xqm and .xqy.  In all cases, it does not 
> find the .xq file.  
> 
> Best Regards,
> Ben Pracht
> 919.809.2439



Re: [basex-talk] Change static directory for html pages

2020-07-13 Thread Michael Seiferle
Hi Ben, 

Sorry for the belated response — maybe you forgot to update the web.xml file?

RestXQ-Resolution works as follows: 

The .basex file configures **where on disk** the RestXQ-Servlet looks für 
XQuery modules: 

The following options can be set: 

* WEBPATH
> Points to the directory in which all the Web Application 
>  contents are stored, including 
> XQuery, Script, RESTXQ  and configuration 
> files:


In your case: PROJECT_ROOT/webapp

* RESTXQPATH

If this a relative path, it will be relative to your WEBPATH — so setting it to 
„modules“ will resolve to:
PROJECT_ROOT/webapp/modules

Now this summarizes it for your on disk-context ;-)

Switchting to the Servlet-context, you must make sure to tell the Container 
where to server your RESTXQ-Servlet: 
This can be seen in Web.xml here: 
> https://git.basex.io/basex-public/mailinglist-autocomplete/-/blob/main/webapp/WEB-INF/web.xml#L81-84
  
RESTXQ
/api/*
  

So basically you need to tell jetty, or whatever container you have, what’s the 
ROOT-Url for the RESTXQ contents. 
So in my web.xml anything *under* /api/ will be sent to the RESTXQ-Servlet 
which in turn tries to make sense of the URL and resolve it against your XQuery 
annotations :-)

Hope this helps

Michael

> Am 10.07.2020 um 23:28 schrieb Ben Pracht :
> 
> Thanks Michael,
> 
> I cloned your repo and borrowed your .basex file.  It did indeed allow me to 
> specify the page location.  However, I'm not able to get it to find my RESTXQ 
> is my services.  I added the out of the box BaseX ./bin to my PATH and 
> changed to a completely different directory.  Attached is my .basex and 
> database-services.xqm file.  For debugging purposes, I wanted to make sure my 
> services point to the right database.  My setup is like this:  
> 
> PROJECT_ROOT/.basex
> PROJECT_ROOT/.basexhome
> PROJECT_ROOT/modules/database
> PROJECT_ROOT/webapp/modules/database-services.xqm
> PROJECT_ROOT/modules/database-services.xqm
> 
> I duplicated the database-services file because I wasn't sure what folder the 
> RESTXQ was relative to.  
> 
> Vielen Danke!
> 
> Best Regards,
> Ben Pracht
> 919.809.2439
> ben.pra...@gmail.com 


Re: [basex-talk] Handling saving errors

2020-07-06 Thread Michael Seiferle
Hi Ramzi, 

I am not sure whether your are using RestXQ, however if you do, the 
implementation should take care of this by itself.

XQuery update in general either applies the whole updating query, or cancels 
all updates:

Take the following example db containing 5 documents.

> db:create("mailinglist",
>   (1 to 5) ! ,
>   (1 to 5) ! ("doc-"|| . ||".xml")
> )


Now if you ran an update: 
> for $i in 1 to 5
> let $x := if($i > 4) then error() else ()
> return (
>   prof:dump($i, "Inserting "),
>   insert node element _ {
>"Hello World"
>   } as last into db:open("mailinglist", "doc-"||$i||".xml")
> )

You can see in the GUI / Debug View, that the code for inserting the elements 
in the first 4 Documents is executed, and thus the pending update list is 
populated in memory. 

Once the Query throws the error() the whole query is cancelled and the pending 
update list is discarded.

Hence no changes are applied to your databases, if you manage to handle the 
whole update in a single transaction.

Feel free to ask for more information!

Best
Michael
 
> Am 06.07.2020 um 08:38 schrieb Ramzi Hammouda 
> :
> 
> Hello BaseX team,
> We're developing an application where a command can result in saving data on 
> multiple xml documents in the same database. We're using Rest APIs. Now, 
> We're looking on handling saving errors. For example, if there were an error 
> in saving data on a one document, then the saving of data on other documents 
> must be canceled (even if there were successful updates, they must be 
> canceled). How can this be implemented?
>  
> Thanks.
>  
> 
> P Respectons ensemble l'environnement. N'imprimez ce message que si 
> nécessaire. Let's respect the environment together. Only print this message 
> if necessary.



Re: [basex-talk] Change static directory for html pages

2020-07-03 Thread Michael Seiferle
Hi Ben,

Glad you enjoy setting up a restxq project, we use it as a primary driver of 
our Web-applications 

I set up a small project (in response to a related question last week), that 
serves static content from /webapp at „http://localhost/“ and maps all restxq 
endpoints to http://localhost/api

=> https://git.basex.io/basex-public/mailinglist-autocomplete
This might be a good start for you future endeavors :-)

The relevant settings are found in „.basex“ (This file defines where on disk to 
look for static and restxq files) and „ webapp/ WEB-INF/ web.xml“ (defines at 
what path static files and restxq endpoints are served by the Webserver).

These  options are explained here 
 https://docs.basex.org/wiki/Options#HTTP_Services and 
https://docs.basex.org/wiki/Web_Application#Services 

 You should be fine using ant  

Feel free to ask for more information :-)

Best
Michael



Von meinem iPhone gesendet

>> Am 03.07.2020 um 09:19 schrieb Ben Pracht :
> 
> Hi,
> I'd like to serve static content in the same server as the one handling the 
> restxq.  However, I noticed it expects the content to be in some level under 
> the static directory. Then, the URL also needs the static directory. 
> 
> Is it possible to change both the directory the static files live and the 
> URL?  That way I can create a site without requiring the end user to append 
> static to the URL to get to index.html.
> 
> Ultimately, I want to create static pages, restxq services, schemas and a 
> database, but have them isolated from the BaseX distribution.  I've seen some 
> flags to specify some directory locations, but not the static one.
> 
> I'm using Ant so I can take the source distribution, copy that to a target 
> directory, and in another step, copy my source files.  I realize Ant is old, 
> but I have no idea how to do this in Maven.
> 
> By the way, I absolutely love how easy it is to do a site yet it actually 
> seems quite powerful.
> 
> Kind Regards,
> Ben


Re: [basex-talk] Autocomplete with RESTXQ

2020-06-28 Thread Michael Seiferle
You’re welcome.
Glad I could help save some time, I agree it looks simple, yet wrapping ones 
head around those small details can be a real showstopper sometimes :-)
Feel free to ask for more details anytime.

Looking forward to seeing said search portal!


Best from Konstanz
Michael 
Von meinem iPhone gesendet

> Am 27.06.2020 um 14:13 schrieb Imsieke, Gerrit, le-tex 
> :
> 
> This looks quite simple but you probably saved me two to four hours of 
> figuring out which lib to use, how to invoke the completion and how to shape 
> the server response. Will try to use it in my app tomorrow.


Re: [basex-talk] Autocomplete with RESTXQ

2020-06-26 Thread Michael Seiferle
Hi Gerrit, 

I came up with the following example — 
https://git.basex.io/basex-public/mailinglist-autocomplete

Hope this helps — feel free to ask for more. I simply chose the first 
autocomplete library that showed up when asking google for  "autocomplete 
lightweight“ ;-)

Probably the most relevant changes compared to the default BaseX Config files 
are here:

Changed the Servlet mapping, so RESTXQ is output at `/api` (and not /)
> https://git.basex.io/basex-public/mailinglist-autocomplete/-/blob/main/webapp/WEB-INF/web.xml#L83

And static-files are output at: `/` instead of the default `/static`
> https://git.basex.io/basex-public/mailinglist-autocomplete/-/blob/main/webapp/WEB-INF/web.xml#L140


If you simply clone my repo, the relevant parts should be „correct“ — according 
to my personal taste ;-)

Feel free to ask for more help.

Michael

> Am 25.06.2020 um 18:31 schrieb Imsieke, Gerrit, le-tex 
> :
> 
> Hi List,
> 
> Can anyone recommend a lightweight vanilla Javascript autocomplete library 
> that can easily be used together with BaseX RESTXQ? Maybe even a readily 
> cloneable/modifiable example?
> I don’t have a preference for a server response format. The RESTXQ service 
> may be configured to return XML, JSON, or HTML
> No CORS restrictions need to be considered, the query host is the same that 
> delivers the HTML pages.
> 
> Gerrit



Re: [basex-talk] Flat XML fods database

2020-02-14 Thread Michael Seiferle
Hi Thufir, 

I think you might look up the namespaces from the Libre Office File like so: 
> (
>   for $node in $doc//(@*,*)
>   let $nn := node-name($node)
>   let $ns-uri := namespace-uri-from-QName($nn)
>   let $prefix := prefix-from-QName($nn)
>   where $ns-uri
>   return ``[declare namespace `{ $prefix }` = "`{ $ns-uri }`"]``
> ) => distinct-values()
> => string-join(out:nl())
https://git.basex.io/snippets/77 


Other than that you might have to consult the Schema files I guess :)


> Am 14.02.2020 um 09:27 schrieb thufir :
> 
> I think I mainly need to add a namespace for fods:
> 
> 
> thufir@dur:~/fods/flwor$
> thufir@dur:~/fods/flwor$ basex text.xq
> Stopped at /home/thufir/fods/flwor/text.xq, 3/14:
> [XPST0081] No namespace declared for 'text:p'.
> thufir@dur:~/fods/flwor$
> thufir@dur:~/fods/flwor$ cat text.xq
> 
> for $foo  in db:open("foo")
> return $foo//text:p
> 
> thufir@dur:~/fods/flwor$
> 
> 
> https://stackoverflow.com/q/60222478/262852
> 
> 
> 
> how do I know all the namespacess?  from the libre office file?



Re: [basex-talk] Test if basexserver is running?

2019-08-30 Thread Michael Seiferle
Hi Ben, 

I maybe don’t fully get your question right (and I admin I do not know much 
about R), but I’d simply open the socket on the port I expect BaseX to be 
listening on and see whether or not I receive a `BaseX:123456789` response and 
close the connection immediately after.

Best
Michael 

> Am 29.08.2019 um 15:03 schrieb Ben Engbers :
> 
> Hi,
> 
> Last year I have written a R-client for basex
> (https://github.com/BaseXdb/basex/tree/master/basex-api/src/main/r/RbaseXClient.R
>  
> ).
> The present version uses no exception handling and you have to include
> the source-file in your R-code. A much cleaner solution would be catch
> all the errors and to pack the sources in a package. At this moment, I
> am working on such a R-package.
> 
> The first test that should be executed in the package, is to test if a
> basexserver is available.
> 
> How can I test on Linux, Apple and Windows if a baseserver is running?
> 
> Ben



Re: [basex-talk] BaseX Docker logs

2019-08-30 Thread Michael Seiferle
Hi Marie, 

I think the log files should be located inside your container at:
> /srv/basex/data/.logs # for current basex versions

Or for your version:

> /srv/BaseXData/.logs # for BaseX 8.6.4 

Maybe you can check your output for:
>  docker run basex/basexhttp:8.6.4
> a6e…
=> 
>  docker exec -ti a6e ls -la /srv/BaseXData/.logs
> total 12
> drwxr-xr-x 2 basex basex 4096 Aug 30 07:38 .
> drwxr-xr-x 3 basex root  4096 Aug 30 07:38 ..
> -rw-r--r-- 1 basex basex  129 Aug 30 07:38 2019-08-30.log


Hope this helps — sorry to hear your container exits unexpectedly!

Best
Michael
> Am 27.08.2019 um 15:16 schrieb Marie Starck :
> 
> Hello,
> 
> I am currently running a BaseX server with Docker and for the past week, it 
> has exited twice with this message: /usr/local/bin/basexhttp: line 20:25 
> Killed  java -cp "$CP" $BASEX_JVM org.basex.BaseXHTTP "$@"
> 
> I want to debug more but I haven't been able to find the basex .logs in my 
> docker container. I am using basexhttp:8.6.4.
> 
> Any ideas where it could be?
> 
> Thank you very much,
> 
> Marie



Re: [basex-talk] Binary module

2019-08-14 Thread Michael Seiferle
Hi Guiseppe, 

1) You are right, it’s not too obvious what’s happening here: 
In BaseX the default serialization mode is „basex“ which tries to return items 
in a more readable way, hence internally your string is represented as 
xs:base64Binary — but when it is output to the query results panel it will be 
serialized according to whichever serialization is active; we opted for our 
custom serialization as we considered it to be a sane default, as it is able to 
serialize() all kinds of items (i.e. XML serialization won’t serialize maps or 
arrays) and is generally a little more readable than adaptive because we omit 
type information such as xs:base64Binary("c8Ogw6A=")

The following query serializes your value with different serialization 
parameters. 
> let $it := convert:string-to-base64("sàà")
> 
> for $method in (
>   "basex", "xml", "adaptive", "json", "text","html"
> )
> return element { $method } {  
>   serialize( 
> $it,
> map{ "method": $method }
>   )
> }



2) The length method basically tells you how many bytes your string needs to be 
encoded as utf8, you may use the following query and try it yourself:
> let $str := "•"
> let $bin := convert:string-to-base64($str)
> return element _ {
>   element str { $str },
>   element b64 { $bin },
>   element octets {
>attribute length { bin:length($bin) },
>for $byte in $bin => convert:binary-to-integers() 
>return element octet {
>  $byte => convert:integer-to-base(2)
>}
>   }  
> }

Depending on the input string and it’s encoding (i.e. ‚a' will only need one 
byte, but ‚ä' already needs two, ‚•' will even need three in utf8) your string 
is converted to xs:base64Binary and the bin:length() function will count how 
many octets are needed for this representation.

Hope this helps :-)

Best
Michael


> Am 14.08.2019 um 02:22 schrieb Giuseppe G. A. Celano 
> :
> 
> Hi
> 
> I am playing around with the binary module. I have two simple questions:
> 
> 1) convert:string-to-base64("sàà") returns sàà : what does it mean? I see in 
> the documentation that I need to use string() to see the value of 
> xs:base64Binary (c8Ogw6A=), but shouldn't xs:base64Binary already be 
> outputted as c8Ogw6A= ? (This is actually displayed in the Info Panel).
> 
> 2) bin:length(convert:integers-to-base64(x)) always returns one number, no 
> matter how big the number is. In the documentation I read that the output of 
> bin:length should be the size of binary data in octects: how is that possible?
> 
> Thanks,
> Giuseppe
> 
> 



Re: [basex-talk] Connecting the BaseX AppChecker to Visual Studio

2019-07-08 Thread Michael Seiferle
Hi Matt,

Sorry I can’t be of more help, but we at BaseX don’t know too much about the 
AppChecker-Project.

I know we’ve been contacted by Microsoft’s Peter Villadsen and asked whether he 
may use / pre-install BaseX for an X++ project at Microsoft, but since 
confirming that our license would enable Microsoft to use and include BaseX in 
their products we haven’t received any feedback so far. 

Feel free to provide some more context :-)

Best 
Michael



Von meinem iPhone gesendet

> Am 08.07.2019 um 17:31 schrieb Matt Stam :
> 
> Hello, 
> 
> I've been trying to set up and use the "AppChecker" that we are going to need 
> to run our X++ code through. Does anyone have any knowledge on how to run 
> this?
> 
> I've followed everything laid out on their github: 
> https://github.com/microsoft/Dynamics365FO-AppChecker. BaseX and the 
> environmental variables are installed. But I am unsure about how to actually 
> use it to check my code on VS.
> 
> Any help would be appreciated.
> 
> Best,
> Matt


Re: [basex-talk] Using the attribute index to get attribute values

2019-06-12 Thread Michael Seiferle
I am not sure about your data exactly, but, the element hierarchy can be 
preserved:
> (: http://files.basex.org/xml/factbook.xml :)
> index:facets('factbook')//element[@name="continent"]/attribute[@name="id“]
Will return only the id values of elements named continent :-)

Or in your example you might want to change this to „element[@name='country‘]“

One thing to consider, the maximum number of distinct-values that will be added 
to the index is defined by the maxcats option:
http://docs.basex.org/wiki/Options#MAXCATS

Best
Michael


> Am 12.06.2019 um 16:48 schrieb France Baril :
> 
> But facets would return @type values for all @type and I need only those on 
> .
> 
> On Wed, Jun 12, 2019 at 4:34 PM Michael Seiferle  <mailto:m...@basex.org>> wrote:
> Hi France, 
> 
> that’s just a wild guess, but maybe the index:facets() might be of help here?
> It works directly on the index information, so the queries should be 
> sufficiently fast if the results of index:facets() fulfill your needs.
> 
> http://docs.basex.org/wiki/Index_Module#index:facets 
> <http://docs.basex.org/wiki/Index_Module#index:facets>
> 
> 
> The idea of db:attribute-values() is an idea worth discussing as well.
> 
> Best from Konstanz
> 
> Michael
> 
> 
> 
>> Am 12.06.2019 um 09:07 schrieb France Baril > <mailto:france.ba...@architextus.com>>:
>> 
>> Hi, 
>> 
>> I have been implementing more queries that use the attribute indexes lately. 
>> However a lot of my queries require getting values to offer selectable items 
>> in user forms (GUI). I have not found a good way to do that.
>> 
>> For example, I tried changing : 
>>   let $account-types := distinct-values(db:open($db-name)//account/@type)
>> to 
>>   let $account-types := distinct-values(db:attribute-range($db-name, 'a', 
>> 'zz', 'type')[parent::*/name() = 'account'])
>> 
>> I looked for a function that would be more like 
>>   let $account-types := db:attribute-values($db-name, 
>> 'type')[parent::*/name() = 'account]
>> 
>> I'm not getting any performance improvements with the db:attribute-range 
>> compared to the regular db:open($db-name). and I am assuming that the issue 
>> is that since I provide a range, it has to check every value individually as 
>> opposed to just grabbing everything in the named attribute.
>> 
>> Any chance we can get values at some point? Or do you have a suggestion to 
>> improve this type of query?
>> 
>> 
>> 
>> 
>> -- 
>> France Baril
>> Architecte documentaire / Documentation architect
>> france.ba...@architextus.com <mailto:france.ba...@architextus.com>
> 
> 
> 
> -- 
> France Baril
> Architecte documentaire / Documentation architect
> france.ba...@architextus.com <mailto:france.ba...@architextus.com>



Re: [basex-talk] Using the attribute index to get attribute values

2019-06-12 Thread Michael Seiferle
Hi France, 

that’s just a wild guess, but maybe the index:facets() might be of help here?
It works directly on the index information, so the queries should be 
sufficiently fast if the results of index:facets() fulfill your needs.

http://docs.basex.org/wiki/Index_Module#index:facets


The idea of db:attribute-values() is an idea worth discussing as well.

Best from Konstanz

Michael



> Am 12.06.2019 um 09:07 schrieb France Baril :
> 
> Hi, 
> 
> I have been implementing more queries that use the attribute indexes lately. 
> However a lot of my queries require getting values to offer selectable items 
> in user forms (GUI). I have not found a good way to do that.
> 
> For example, I tried changing : 
>   let $account-types := distinct-values(db:open($db-name)//account/@type)
> to 
>   let $account-types := distinct-values(db:attribute-range($db-name, 'a', 
> 'zz', 'type')[parent::*/name() = 'account'])
> 
> I looked for a function that would be more like 
>   let $account-types := db:attribute-values($db-name, 
> 'type')[parent::*/name() = 'account]
> 
> I'm not getting any performance improvements with the db:attribute-range 
> compared to the regular db:open($db-name). and I am assuming that the issue 
> is that since I provide a range, it has to check every value individually as 
> opposed to just grabbing everything in the named attribute.
> 
> Any chance we can get values at some point? Or do you have a suggestion to 
> improve this type of query?
> 
> 
> 
> 
> -- 
> France Baril
> Architecte documentaire / Documentation architect
> france.ba...@architextus.com 



Re: [basex-talk] Docker basex/basexhttp 9.2.2?

2019-06-12 Thread Michael Seiferle
Great! :-)

Von meinem iPhone gesendet

> Am 12.06.2019 um 10:16 schrieb Jörn Willhöft :
> 
> Hi Michael,
> 
> it became available on docker hub tonight. Thanks!
> 
> Cheers,
>  Jörn
> 
> 
> 
>> Michael Seiferle  hat am 11. Juni 2019 um 12:14 geschrieben:
>> 
>> 
>> Hi Jörn,
>> 
>> Sorry for letting you wait!
>> 
>> Seems there was a disconnection between our GitHub Repository and the 
>> Dockerhub AutoBuild — I reconfigured it and the updated image should be 
>> available by this afternoon!
>> 
>> Best & thanks for reporting!
>> 
>> Michael
>> 
>>> Am 05.06.2019 um 18:46 schrieb Jörn Willhöft :
>>> 
>>> Hi BaseX Team, 
>>> 
>>> I just realized, that there is no current docker release for BaseX 9.2. 
>>> Which contains a feature (www-authenticate override) I need. Is it planned 
>>> to be released soon? 
>>> 
>>> As I easily migrated from 9.1.2 it shouldn't be much effort. 
>>> 
>>> Cheers, 
>>>  Jörn
>> 


Re: [basex-talk] Use of xs:hexBinary() comes with strange results

2019-06-11 Thread Michael Seiferle
Hi Andreas,

I think what you are observing is the following: 

UTF-8 encoded stings can optionally denote a multi-byte sequence, with the 
number of leading 1-s defining the multibyte pattern length.
c.f. https://en.wikipedia.org/wiki/UTF-8 

In your example, c3 decodes to: 
> xs:hexBinary("c3")
> => convert:binary-to-integers()
> => for-each(convert:integer-to-base(?,2))
> (: returns: 1111 :)
And the two leading 1s will tell the UTF-8 decoder to read a second byte — 
which is missing — hence decoding fails with an error or if you use the 
fallback-option it will return a �

While decoding ASCII, where only 127 bits are used, this is no problem as UTF-8 
shares the same character positions with the ascii table.

Your „C3“ character however is not in ascii but most probably ISO-8859-1 or 
CP1252? So while a glance at https://tools.ietf.org/html/rfc3986 
 says URI Characters should be encoded in 
UTF-8 in practice 
chances are you encounter values that are encoded using some „local“ encoding.

If your string is not UTF-8 encoded you may only guess what the correct 
encoding is.

You may send a predefined string that is known to be of two bytes length in 
UTF-8, such as: ä that will be either converted to „%C3%A4“  if it is unicode 
or to a well known single byte such as for example „E4“ in ISO-8859-1.
Depending and what you receive by your client for that given string you may 
assume it encodes its data either utf-8 or latin1. 

You can check what your string would be encoded to: 
> string(convert:string-to-hex('ä',"latin1")) 


Sorry for the long mail, hope the explanation is useful for you, even though 
the solution is not sooo simple and involves guessing :-)

Best
Michael 





> Am 09.06.2019 um 17:09 schrieb Andreas Mixich :
> 
> How can I simply get back any character, readable by a human, from a 
> hexadecimal value?
> 



Re: [basex-talk] Docker basex/basexhttp 9.2.2?

2019-06-11 Thread Michael Seiferle
Hi Jörn,

Sorry for letting you wait!

Seems there was a disconnection between our GitHub Repository and the Dockerhub 
AutoBuild — I reconfigured it and the updated image should be available by this 
afternoon!

Best & thanks for reporting!

Michael

> Am 05.06.2019 um 18:46 schrieb Jörn Willhöft :
> 
> Hi BaseX Team, 
> 
> I just realized, that there is no current docker release for BaseX 9.2. Which 
> contains a feature (www-authenticate override) I need. Is it planned to be 
> released soon? 
> 
> As I easily migrated from 9.1.2 it shouldn't be much effort. 
> 
> Cheers, 
>   Jörn



Re: [basex-talk] Health Analyzer registration issue

2019-06-11 Thread Michael Seiferle
Hi Ganesh, 

Sorry, but seems your email somehow got misdirected to us?
We’ll be glad to support your colleagues at VMware however I am not sure what 
caused this bug by just looking at your screenshot ;)

Best
Michael


> Am 11.06.2019 um 08:02 schrieb Ganesh Joshi Regmi (c) 
> :
> 
> Hi Team,
>  
> I am trying to register the VMware Health Analyser OVA with code that I 
> received after registering via my employee email. However, I am unable to 
> complete the registration with below error.
>  
> 
>  
> Can you please look at this and revert back with solution.
>  
>  
> Cheers,
> Ganesh
>  
> Ganesh Joshi Regmi | Senior PSO Consultant
> VCP-4,5,6 | VCP- NV | VCAP-NV | VCAP-DCA
> VMware Australia & New Zealand 
> +61 452 409 609 | gjoshire...@vmware.com   
>  
> Level 8 175 Pitt Street, Sydney NSW 2000
>  
>     
>  
> 
>  
>  



Re: [basex-talk] Improper Use? Potential bug?

2019-06-04 Thread Michael Seiferle
Hi Buddy, 

that looks like a bug. 

Would you mind sharing your XQuery or a SSCE?
I think this is definitely something we might want to have a look at :-)

Best from Konstanz

Michael 

> Am 03.06.2019 um 13:12 schrieb Buddy Kresge :
> 
> I am all of a sudden getting the below error (and things were working just 
> fine – weird).  Works fine in 9.1.2 but not in 9.2.X.  Any guidance would be 
> greatly appreciated.
>  
> Note:  I tried to send you an email with the full stack trace, but the 
> moderator rejected it because the email was too long.  I’ve cut down the 
> size, but you now no longer have the full stack trace.  If you need the full 
> stack trace, please let me know how you’d like that shared with you.
>  
> Thanks,
> Buddy
>  
> Error:
> Improper use? Potential bug? Your feedback is welcome:
> Contact: basex-talk@mailman.uni-konstanz.de 
> 
> Version: BaseX 9.2
> Java: AdoptOpenJdk, 1.8.0_202
> OS: Windows 10, amd64
> Stack Trace: 
> java.lang.ArrayIndexOutOfBoundsException: 1
>at org.basex.query.expr.Preds.simplify(Preds.java:215)
>at org.basex.query.expr.Filter.optimize(Filter.java:82)
>at org.basex.query.expr.Filter.inline(Filter.java:260)
>at org.basex.query.expr.gflwor.ForLet.inline(ForLet.java:66)
>at org.basex.query.expr.gflwor.GFLWOR.inline(GFLWOR.java:804)
>at 
> org.basex.query.expr.gflwor.GFLWOR.inlineLets(GFLWOR.java:339)
>at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:106)
>at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:98)
>at org.basex.query.expr.If.compile(If.java:63)
>at org.basex.query.func.StaticFunc.comp(StaticFunc.java:69)
>at 
> org.basex.query.func.StaticFuncs.compile(StaticFuncs.java:184)
>at 
> org.basex.query.func.fn.FnFunctionLookup.opt(FnFunctionLookup.java:34)
>at 
> org.basex.query.func.StandardFunc.optimize(StandardFunc.java:77)
>at org.basex.query.expr.Arr.compile(Arr.java:43)
>at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43)
>at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:88)
>at org.basex.query.func.StaticFunc.comp(StaticFunc.java:69)
>at 
> org.basex.query.func.StaticFuncCall.compile(StaticFuncCall.java:64)
>at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43)
>at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:88)
>at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43)
>at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:88)
>at org.basex.query.func.StaticFunc.comp(StaticFunc.java:69)
>at 
> org.basex.query.func.StaticFuncCall.compile(StaticFuncCall.java:64)
>at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:94)
>at org.basex.query.func.StaticFunc.comp(StaticFunc.java:69)
>at 
> org.basex.query.func.StaticFuncCall.compile(StaticFuncCall.java:64)
>at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:94)
>at org.basex.query.func.StaticFunc.comp(StaticFunc.java:69)
>at 
> org.basex.query.func.StaticFuncs.compile(StaticFuncs.java:184)
>at 
> org.basex.query.func.fn.FnFunctionLookup.opt(FnFunctionLookup.java:34)
>at 
> org.basex.query.func.StandardFunc.optimize(StandardFunc.java:77)
>at org.basex.query.expr.Arr.compile(Arr.java:43)
>at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43)
>at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:88)
>at org.basex.query.func.StaticFunc.comp(StaticFunc.java:69)
>at 
> org.basex.query.func.StaticFuncCall.compile(StaticFuncCall.java:64)
>at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43)
>at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:88)
>at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43)
>at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:88)
>at org.basex.query.func.StaticFunc.comp(StaticFunc.java:69)
>at 
> org.basex.query.func.StaticFuncCall.compile(StaticFuncCall.java:64)
>at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:94)
>at org.basex.query.func.StaticFunc.comp(StaticFunc.java:69)
>at 
> org.basex.query.func.StaticFuncCall.compile(StaticFuncCall.java:64)
>at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:94)
>at org.basex.query.func.StaticFunc.comp(StaticFunc.java:69)
>at 
> org.basex.query.func.StaticFuncs.compile(StaticFuncs.java:184)
> 

Re: [basex-talk] XML in HTTP request body

2019-06-03 Thread Michael Seiferle
Hi Jerome, 


If I understand correctly, you want to create a hash value for the string 
serialization of the document you sent to restxq right?

Currently inside RESTXQ your document is treated as an XML Document, hence: 

$body will be of type document-node(): 
> 
>   
> Hello
> World
>   
> 

where as crypto:hmac requires a string-type $message:
> crypto:hmac($message as xs:string, 
Hence your $body will be converted like so: 
> string(
>   
> Hello
> World
>   
> )


Turning it into: 
> „HelloWorld“


In order to actually compute a hash on the bytes your document contains, do as 
follows:

Working example here: https://git.basex.io/snippets/63


Treat your document as binary:
> %rest:consumes("application/octet-stream“)
And then decode that binary to a string and then compute the hash for the 
string, using: bin:decode-string#2:

>   let $str-doc  := bin:decode-string($body,'utf-8') (: xs:string :)
>   let $sig-cand := crypto:hmac($str-doc,$secret,'sha1','base64')


Hope this helps :-)

Michael

> Am 03.06.2019 um 12:17 schrieb Jerome Chauveau :
> 
> Hi,
> 
> I am trying to check XML content (HTTP posted) with an hmac function in a 
> RESTXQ webapp.
> 
> My Java client sends an HTTP post request where XML data looks like :
> 
> doe xsi:schemaLocation="http://www.tei-c.org/ns/1.0;
> xml:id="idtest"
> > > > > >Test > xml:id="authortest"
> >XXX > > > > > > xml:space="preserve"
> > > type="lieu"
> > xml:lang="la"
> >Burgunvilla > > > > > >
> 
> This content is HMAC encrypted and the signature is added to the HTTP  header 
> :
> 
> [...]
> String secret = "1234";
> StringEntity entity = new StringEntity(xml, ContentType.create("text/xml", 
> Consts.UTF_8));
> String signature = HTTPUtils.hmacSHA1(xml, secret);
> httppost.setHeader("Authorization", signature);
> httppost.setEntity(entity);
> [...]
> 
> 
> Here is my RESTXQ function :
> 
> declare
> %rest:POST("{$body}")
> %rest:consumes("application/xml", "text/xml")
> %rest:header-param("Authorization", "{$signature}", "none")
> %rest:path("/sf/testpost")
> function sf.test:testPost($signature,$body){
>   let $secret := 1234
>   crypto:hmac($body,$secret,'sha1','base64') = $signature
> }
> 
> Equality check always fails with such an XML sequence but works fine when XML 
> does not contain any carriage return :
> doeThis is a 
> test
> 
> It seems to come when "The body of a POST or PUT request is converted to an 
> XQuery item".
> 
> I tried to set serializer's options without any success !
> 
> How could I retrieve xml (in $body) exactly serialized as sent by the client 
> ? 
> 
> Tests are running on BaseX922.
> Thank you for your time.
> 
> Jérôme



Re: [basex-talk] Update of arbitrarily selected elements?

2019-06-03 Thread Michael Seiferle
Hi Josh, 

I think the most widely used approach would be addressing items via ID — just 
as you would in a traditional database approach — this might involve adding IDs 
to all elements.

>> (as in, not selectable with a query)
With XPath you can select arbitrary parts of your document, maybe using XPath 
expressions would be helpful?


Hope this helps a bit, feel free to ask for more specific information  :)

Best 

Michael 







> Am 31.05.2019 um 20:14 schrieb Joshua Kordani 
> :
> 
> Greetings all.
>  
> I am curious about how basex supports the idea of modifying any given (or set 
> of given) elements, say a user makes a query to select a bunch of elements 
> for editing and wishes to add an attribute to an arbitrary subset (as in, not 
> selectable with a query), how do I reference a particular element for later 
> updating?
>  
> Sincerely,
> Josh



Re: [basex-talk] Database lock during RESTXQ operation

2019-05-15 Thread Michael Seiferle
Hi Martin, 

hard to tell what went wrong then without looking at your setup.
Did it happen again or has it been a one-time issue?

Best
Michael

--
Michael Seiferle, BaseX GmbH, http://www.basexgmbh.de
|-- Firmensitz: Obere Laube 73, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Tel: +49 7531 916 82 77

> Am 15.05.2019 um 08:40 schrieb Martin Iggulden 
> :
> 
>  
> Thanks for your feedback. I’m pretty sure that the database is only 
> accessible to a single JVM, but I’ll check it again to be 100% sure. Is there 
> any other possible explanation? I don’t think we’re doing anything too 
> complicated…
> 



Re: [basex-talk] Database lock during RESTXQ operation

2019-05-13 Thread Michael Seiferle
Hi Martin,

This error may happen if (1) two different instances of basex try to 
open/update the very same database.
As BaseX uses standard JVM functionality to acquire the Lock it is very likely 
that indeed to different processes tried to access the very same file.

Maybe there is some kind of shared database between your instances that you are 
trying to access?




Best from Konstanz

Michael



> Am 10.05.2019 um 09:17 schrieb Martin Iggulden 
> :
> 
> the same Java VM because the RESTXQ server is the only active interface to 
> the database.
>  
> We have seen this error before, but it’s difficult to reproduce.
>  
> Do you know how this might have happened? And is there a procedure for 
> clearing down an erroneous database lock if it happens?
>  
> We are running BaseX version 9.1.2.
>  



Re: [basex-talk] HTTP POST as xml

2019-05-06 Thread Michael Seiferle
Hi Robert, 

Yeah, that’s not necessarily obvious, but the type of the document you post is 
„document-node()“ not element() — so simply change the function & argument 
types to document-node() and you will be fine.


Usually the the in-browser debugging > Network view helps with identifying such 
„low-level“ errors, yet I tend to use the command-line more often since I 
discovered httpie[1]

> echo ""|http POST http://localhost:8984/test Content-Type:text/xml
> HTTP/1.1 400 Bad Request
> Stopped at /Users/michael/tmp/ml/webapp/foo.xqm, 5/10:
> [XPTY0004] Cannot convert document-node() to element(): document-node {''}.


Hope this helps & best from Konstanz 

Michael


[1] https://httpie.org



> Am 06.05.2019 um 14:09 schrieb Robert Kirkpatrick :
> 
> Hello,
> 
> I am trying to implement an XForm for posting data via:
> 
> http://localhost:8984/test 
> " method="post" 
>   serialization="application/xml" replace="all" />
> 
> It should invoke the following query (in webapp):
> 
> module namespace page = 'http://basex.org/examples/web-page 
> ';
> declare
>   %rest:path("/test")
>   %rest:POST("{$data}")
> function page:hello ( $data as element() ) 
>   as element() { $data };
> 
> But I get this instead:
> 
> TIA for any help,
> Robert.



Re: [basex-talk] inspect:functions#1 on XPath funcs errors out with [XPST0003] and returns an XHTML file

2019-05-06 Thread Michael Seiferle
Hi Andreas, 

I think you are calling the inspect function function on the following HTML 
Page: 
https://www.w3.org/2005/xpath-functions/ 

Per documentation, the function does the following:
> If a $uri is specified, the addressed module will be compiled, and its 
> functions will be added to the query context and returned to the user


As the URI contains no XQuery module, the function will error.

Currently inspect:functions only works on user-defined modules.



Hope this helps!

Michael 

> Am 06.05.2019 um 02:47 schrieb Andreas Mixich :
> 
> Hi,
> 
> opening a new sheet in the GUI I just executed:
> 
> inspect:functions("http://www.w3.org/2005/xpath-functions 
> ")
> 
> and this is what I got:
> 
> Error:
> Stopped at http://www.w3.org/2005/xpath-functions 
> , 1/6:
> [XPST0003] Processing instruction has illegal name: xml.
> 
> Optimized Query:
> inspect:functions("http://www.w3.org/2005/xpath-functions 
> ")
> 
> The Query itself is, as returned by BaseX, interestingly, an XHTML file, 
> which seems to have been produced via Saxon, here are the first lines:
> 
> 
> 
> http://www.w3.org/1999/xhtml " 
> lang="EN">
>   
> 
> XQuery, XPath, and XSLT Functions and Operators Namespace Document 
> 
> 
>  
>  href="http://www.w3.org/StyleSheets/TR/base.css 
> "/>
>   
>   
> 
>   
> http://www.w3.org/ ">
>   http://www.w3.org/Icons/w3c_home 
> " alt="W3C" height="48" width="72"/>
> 
>   
>   XQuery, XPath, and XSLT Functions and 
> Operators Namespace Document 
>   21 March 2017
> 
> 
>   Table of Contents 
>   
> 
>   
> 1 
> Introduction
>   
>   
> 
> 
> 
> And here is the QueryPlan:
> 
> Query Plan:
> 
>   
> http://www.w3.org/2005/xpath-functions 
> 
>   
> 
> 
> -- 
> Minden jót, all the best, Alles Gute,
> Andreas Mixich



Re: [basex-talk] A Tail Call, that runs (not) if different numeric values are being used as parameter

2019-05-02 Thread Michael Seiferle
Hi Andreas, 

maybe you might want to share your `string`-Module with us?
I don’t think the swapped version is end-recursive either (due to the concat) 
but it would be interesting to see what happens either way!

Best from Konstanz
Michael

Re: [basex-talk] my first baseX db

2019-04-18 Thread Michael Seiferle
Hi Robert,
are you sure your XML file is valid?
Does it work if you move that particular file out of your google drive 
temporarily?

Best
Michael

Von meinem iPhone gesendet

> Am 18.04.2019 um 21:36 schrieb Robert Kirkpatrick :
> 
> Hello,
> 
> Novice, newbie request: GUI snapshot:
> 
> Command:
> CREATE DB science C:/Users/rober/Google Drive/science/
> Error:
> "Configurations2/accelerator/current.xml" (Line 1): Premature end of file.
> 
> TIA,
> Robert.


Re: [basex-talk] Write functions in sequence

2019-03-12 Thread Michael Seiferle
Hi Guiseppe,


actually the file-operations are non-deterministic and thus (1) never executed 
out of order and (2) even executed if you would not return their results ($o, 
$o2, $o3) and thus might be removed by the compiler.
(Christian might correct me if I am wrong ;-))

I came up with the following example that waits 2 seconds before actually 
writing to $o2:
> let $o :=  file:create-dir("foo")
> let $o2 := file:write("foo/file1.xml", 
>   (function(){
> prof:sleep(2000),
> "Written to File1.xml"
>   })()
>  )
> let $o3 := file:write("foo/file2.xml", file:read-text("foo/file1.xml"))
> 
> return file:read-text("foo/file2.xml“)
So most probably your example does not fully reflect what’s actually happening 
— maybe you could provide some more context?
If you want to, you may even send your query to me directly so you won’t have 
disclose it on this mailing list. 


Best from Konstanz

Michael 



> Am 12.03.2019 um 11:44 schrieb Giuseppe G. A. Celano 
> :
> 
> let $o :=  file:create-dir("/Users/mycomputer/prova")
> let $o2 := file:write("/Users/mycomputer/prova/file1.xml", "ciao")
> let $o3 := file:write("/Users/mycomputer/prova/file2.xml", 
> file:read-text("/Users/mycomputer/prova/file1.xml"))
> return
> ($o, $o2, $o3)
> 
> This actually works. In my real example the writing of $o2 requires e few 
> seconds. It might be that $o3 is evaluated while $o2 is still running?
> 
> Dr. Giuseppe G. A. Celano
> DFG-project leader <http://gepris.dfg.de/gepris/projekt/408121292>
> Universität Leipzig
> Institute of Computer Science, NLP
> Augustusplatz 10
> Tel: +4934132223
> 04109 Leipzig
> Deutschland
> 
> E-mail: cel...@informatik.uni-leipzig.de 
> <mailto:cel...@informatik.uni-leipzig.de>
> Web site 1: http://asv.informatik.uni-leipzig.de/en/staff/Giuseppe_Celano 
> <http://asv.informatik.uni-leipzig.de/en/staff/Giuseppe_Celano> 
> Web site 2: https://sites.google.com/site/giuseppegacelano/ 
> <https://sites.google.com/site/giuseppegacelano/>
> 
>> On Mar 12, 2019, at 11:27 AM, Michael Seiferle > <mailto:m...@basex.org>> wrote:
>> 
>> Hi Guiseppe, 
>> 
>> The following pattern is supposed to / does work:
>>> file:write("1.txt", "Written to 1.txt"),
>>> file:write("2.txt", file:read-text("1.txt")),
>>> "Read from 2.txt: " || file:read-text('2.txt')
>> 
>> 
>> Could you maybe elaborate a bit more on your code?
>> 
>> Best from Konstanz
>> 
>> Michael 
>> 
>>> Am 12.03.2019 um 11:19 schrieb Giuseppe G. A. Celano 
>>> >> <mailto:cel...@informatik.uni-leipzig.de>>:
>>> 
>>> Hi
>>>  
>>> I wrote a single script which should do: write a file -> open this file -> 
>>> write another different file. I put the write expressions in the right 
>>> sequence, but it seems that the second one cannot happen because the file 
>>> created by the first write function has not yet been created at the time 
>>> the second function is invoked. Does anyone have a suggestion about this? 
>>> Thanks.
>>> 
>>> Best,
>>> Giuseppe
>> 
> 



Re: [basex-talk] Write functions in sequence

2019-03-12 Thread Michael Seiferle
Hi Guiseppe, 

The following pattern is supposed to / does work:
> file:write("1.txt", "Written to 1.txt"),
> file:write("2.txt", file:read-text("1.txt")),
> "Read from 2.txt: " || file:read-text('2.txt')


Could you maybe elaborate a bit more on your code?

Best from Konstanz

Michael 

> Am 12.03.2019 um 11:19 schrieb Giuseppe G. A. Celano 
> :
> 
> Hi
>  
> I wrote a single script which should do: write a file -> open this file -> 
> write another different file. I put the write expressions in the right 
> sequence, but it seems that the second one cannot happen because the file 
> created by the first write function has not yet been created at the time the 
> second function is invoked. Does anyone have a suggestion about this? Thanks.
> 
> Best,
> Giuseppe



Re: [basex-talk] Class 'BaseXHTTP' missing?

2019-02-28 Thread Michael Seiferle
Hi Jan, 

I think it would be best to use the ZIP distribution, if you check out the 
sources you have to make sure to compile all maven projects (BaseXHTTP is part 
of the bases-api package).

The ZIP distribution will contain a script to call basexhttp that will load 
both BaseX & basex-api in the classpath  :-)
Hope this helps!

Best from Konstanz

Michael 

Re: [basex-talk] Activating gzip compression

2019-02-27 Thread Michael Seiferle
Hi Omar, 

I can not get it to work either, yet: 
>> * No content-encoding is specified by the resource
>> 
>> I found no way to not specify an encoding for whatever I return in RESTXQ. 
>> If I don't specify anything it's UTF-8. it shows up as "; 
>> character-set=UTF-8"I did not find a way to specify no encoding. Maybe 
>> unrelated but perhaps that is a problem.
>> 
>> 

Content-Encoding denotes how the content has been encoded (gzip, deflate, etc.) 
=> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding 
 
that’s not the character encoding (such as UTF8).
So the GZIP handler not working correctly is most probably not due to the UTF8 
Encoding you are seeing.


Actually I did not get the GzipHandler working, even using the DefaultServlet ( 
=> requests to /static) instead of BaseX’ RestXQServlet and I found this 
comment that states:
> https://stackoverflow.com/questions/38635262/jetty-9-and-gziphandler 
> The 
> implementation of Gzip support in Jetty is now based on a Container HTTP 
> Output Interceptor pattern. This means GzipHandler has to be defined at a 
> point in the Jetty Handler tree before your WebApp and its WebAppContext even 
> exists.
> 
> 

I’m by no means an expert on servlets, so my conclusions might be wrong! 

Best
Michael



> Am 26.02.2019 um 18:27 schrieb Omar Siam :
> 
> Hi,
> 
> I tried both ways of enabling gzip compression for JSON and js (and others). 
> I can't see it actually working. The GzipFilter method from the web.xml 
> sample seems to be deprecated with a warning of "it is bug ridden" ... But 
> then in a browser debugger I cannot see it actually zipping anything.
> 
> I trief to enable this in my BaseX 9.1.2 instance using
> 
>   
> GzipFilter
> org.eclipse.jetty.servlets.GzipFilter
> 
>   mimeTypes
>   
> text/html,text/xml,text/ecmascript,application/xhtml+xml,application/json,application/javascript,image/svg+xml
> 
>   
>   
> GzipFilter
> /*
>   
> The GzipHandler method seems to get loaded but then also in a browser 
> debugger I cannot see it actually zipping anything.
> 
> For the GzipHandler the documentation 
> https://www.eclipse.org/jetty/documentation/current/gzip-filter.html 
>  talks 
> about when it actually gets invoked and mentions:
> 
> * No content-encoding is specified by the resource
> 
> I found no way to not specify an encoding for whatever I return in RESTXQ. If 
> I don't specify anything it's UTF-8. it shows up as "; character-set=UTF-8"I 
> did not find a way to specify no encoding. Maybe unrelated but perhaps that 
> is a problem.
> 
> I modified webapp/WEB-INF/jetty.xml like this so it uses the GzipHandler 
> (copied from the current jetty distribution):
> 
> 
>   
>   
> ...
>   
>   
> 
>class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
>  deprecated="gzip.minGzipSize" default="2048"/>
>  deprecated="gzip.checkGzExists" default="false"/>
>  name="jetty.gzip.compressionLevel" deprecated="gzip.compressionLevel" 
> default="-1"/>
>  name="jetty.gzip.inflateBufferSize" default="0"/>
>  name="jetty.gzip.deflaterPoolCapacity" default="-1"/>
>  default="false" />
> 
> 
>   
>  deprecated="gzip.excludedUserAgent" default=".*MSIE.6\.0.*"/>
>   
> 
> 
>  name="jetty.gzip.includedMethodList" default="GET" />
>  name="jetty.gzip.excludedMethodList" default="" />
> 
>   
> 
>   
> 
> I hope there is a way to get this to work.
> 
> Best regards
> 
> Omar Siam
> 
> 
> 



Re: [basex-talk] following-sibling axis

2019-02-27 Thread Michael Seiferle
Hi Mark, 

as Martin already stated, the '-w‘-Option has to be active at import time, 
otherwise the whitespace will be chopped. 

If I were to do it, I’d reindex all data and explicitly mark all elements that 
should preserve whitespace, if this is not an option I’d reindex all data with 
whitespace chopping set to off.

Looking forward to your example, I am sure we can figure this out :-)

Best
Michael




> Am 26.02.2019 um 18:52 schrieb Mark Bordelon :
> 
> A follow-up:  starting basex -w does NOT seem to solve completely my issue 
> after all. Real data (more complicated than the simplified example) still 
> does not query correctly: text nodes from after later elements are displayed 
> in the place of null text nodes.
> I’ll try to get a better example, still simplified, that shows this.



Re: [basex-talk] supporting XML Catalog files in xslt:transform() (patch)

2019-02-27 Thread Michael Seiferle
Dear Liam, 

Thanks a lot for this Patch, this issue has been open for quite some time ;-)
As Christian is currently on holidays and will only return next week, I added a 
Pull Request on GitHub https://github.com/BaseXdb/basex/pull/1667 
 so the patch won’t be lost.


Feel free to resubmit that PR if you’d like to have the correct author info in 
the git history, currently it is misattributed to me!


Thanks again!

Best from Konstanz

Michael

Re: [basex-talk] following-sibling axis

2019-02-26 Thread Michael Seiferle
Hi Mark, 
Hi Martin,

yes Martin is right, the whitespace will be chopped by default leading to the 
observed behavior.

If you wanted to preserve whitespace globally, you can do that when creating 
your database. 
If you only want to preserve whitespace for a given element you may do this as 
well:

> let $db := 
> '
>   
> Aa
> B
> Cc
>   
> ' => parse-xml() (: have to actually parse it for the whitespace 
> preserve to have a an effect :)
> 
> return $db//word/concat(text(), ' ', 
> normalize-space(./following-sibling::text()[1]))

Which returns: 
> A a
> B 
> C c


Best
Michael

> 
> Am 26.02.2019 um 09:48 schrieb Martin Honnen :
> 
> 
> I think the result you get is caused by whitespace chopping during XML 
> parsing, seems to be the default, 
> seehttp://docs.basex.org/wiki/Command-Line_Options 
> 
> -wToggles whitespace chopping of XML text nodes. By default, whitespaces 
> will be chopped.
> 
> 
> 



Re: [basex-talk] geo:distance() return units

2019-02-26 Thread Michael Seiferle
Hi Jacob, 

well — the geo distance computes the distance of the direct line between the 
two coordinates:
>52.519881,13.407338
and
>51.507351,-0.12766

Which happens to be 13.57281797796  <=> 
https://en.wikipedia.org/wiki/Euclidean_distance

Yet, the earth is spherical, so you need to take that into account, 
https://en.wikipedia.org/wiki/Geographical_distance 
<https://en.wikipedia.org/wiki/Geographical_distance>

I think what you are actually looking for is the great-circle distance — the 
length of a line traveling along the surface between two points on a circle.

A somehow good approximation for that distance can be computed using the 
haversine formula:
http://www.movable-type.co.uk/scripts/latlong.html 
<http://www.movable-type.co.uk/scripts/latlong.html>

I rewrote the Javascript as XQuery and the result seems to be about right.

> import module namespace geo = "http://expath.org/ns/geo;;
> declare namespace gml='http://www.opengis.net/gml';
> 
> 
> (: formula taken from here: 
>   https://www.movable-type.co.uk/scripts/latlong.html
> :) 
> declare function local:haversine(
>   $point1 as element(gml:Point),
>   $point2 as element(gml:Point)
> ) as xs:double {
>   let $r:= 6371  (: earth radius in KM :)
>   let $lat1 := geo:x($point1)
>   let $lat2 := geo:x($point2)
>   let $lon1 := geo:y($point1)
>   let $lon2 := geo:y($point2)
>   let $φ1   := $lat1 => local:radians()
>   let $φ2   := $lat2 => local:radians()
>   let $Δφ   := ($lat2 - $lat1) => local:radians()
>   let $Δλ   := ($lon2 - $lon1) => local:radians()
> 
>   let $a:= math:pow(math:sin($Δφ div 2), 2) +
>math:cos($φ1) * math:cos($φ2) *
>math:pow(math:sin($Δλ div 2), 2)
>   let $c   := 2 * math:asin(math:sqrt($a))
>   
>   return $c * $r
> };
> 
> 
> declare function local:radians(
>   $deg as xs:double
> ) as xs:double {
>   $deg * (math:pi() div 180)
> };
> 
> 
> let $berlin :=
>  
>52.519881,13.407338
>  
> let $london :=
>  
>51.507351,-0.12766
>  
> return local:haversine($berlin, $london)
> (: returns 931.7188794140812 :)



Maybe you should make yourself comfortable with the maths behind that formula 
to better understand its shortcomings, nevertheless, here’s what I came up with 
in a more readable version:

https://gist.github.com/micheee/e47166d0947f925e395504c1e220fbea 
<https://gist.github.com/micheee/e47166d0947f925e395504c1e220fbea>

Best
Michael






> Am 26.02.2019 um 13:19 schrieb Jacob Borisov :
> 
> Hi! For example, it's need to get the distance between Berlin and
> London, which is 934 km.
> 
> So I've put the coordinates as they can be found in Google Maps, etc.:
> 
> let $berlin :=
>  
>52.519881,13.407338
>  
> let $london :=
>  
>51.507351,-0.12766
>  
> return geo:distance($berlin, $london)
> 
> And the result is 13.57281797796
> 
> Also I had trying to change srsName attribute of gml:Point's to
> different values like "3857", "EPSG:3857" (it's uses meter units as
> mentioned here https://epsg.io/3857), but practically this changes
> nothing. Thanks.
> 
> вт, 26 февр. 2019 г. в 19:33, Michael Seiferle :
>> 
>> Hi Jacob,
>> 
>> I’ve never really used the geo:module but according to the documentation:
>>> in the units of the spatial reference system of geometry1
>> If I understand it correctly, you would have to convert your coordinates to 
>> map them to miles or kilometers for example.
>> 
>> Maybe you can provide an example?
>> 
>> Given this very simple query:
>>> import module namespace geo = "http://expath.org/ns/geo;;
>>> declare namespace gml='http://www.opengis.net/gml';
>>> let $point1 :=1,1
>>> let $point2 := 2,2
>>> return geo:distance($point1, $point2)
>> 
>> The result is math:sqrt(2),  the length of a straight line from P(1,1) — 
>> P’(2,2) but this length does not contain any unit of measurement.
>> 
>> 
>> 
>> Best
>> Michael
>> 
>> 
>> 
>>> Am 26.02.2019 um 12:12 schrieb Jacob Borisov :
>>> 
>>> Hello. Could anybody explain how to get a result from geo:distance()
>>> in kilometers or miles? Thanks.
>> 



Re: [basex-talk] geo:distance() return units

2019-02-26 Thread Michael Seiferle
Hi Jacob,

I’ve never really used the geo:module but according to the documentation:
> in the units of the spatial reference system of geometry1
If I understand it correctly, you would have to convert your coordinates to map 
them to miles or kilometers for example.

Maybe you can provide an example? 

Given this very simple query: 
> import module namespace geo = "http://expath.org/ns/geo;;
> declare namespace gml='http://www.opengis.net/gml';
> let $point1 :=1,1
> let $point2 := 2,2
> return geo:distance($point1, $point2)

The result is math:sqrt(2),  the length of a straight line from P(1,1) — 
P’(2,2) but this length does not contain any unit of measurement. 



Best
Michael



> Am 26.02.2019 um 12:12 schrieb Jacob Borisov :
> 
> Hello. Could anybody explain how to get a result from geo:distance()
> in kilometers or miles? Thanks.



Re: [basex-talk] Stack Overflow: Try tail recursion

2019-02-19 Thread Michael Seiferle
Hi Guiseppe, 


unfortunately the example won’t be tail-call optimized as your last statement 
is not the function call itself but a sequence construction that happens to 
contain the function call.

Your function must be of the form:

> f(x) => s(x)if your termination condition is met (i.e. no more books)
> f(x) => f(g(x))

Your function is defined (more or less) as something like:
> f(x) => s(x)if your termination condition is met (i.e. no more books)
> f(x) =>  something  +  f(g(x))

So you have to get that something (i.e. the sequence concatenation) part inside 
your g-function, here’s what I think you might want:

Cross-posted as gist for better readability 
https://gist.github.com/micheee/ef75c9f30449c2de3406182ff2fdce50 
 
>   declare variable $bookstore := {
> for $i in 1 to 30
> return element book {
>   element name {
> "Book " || $i
>   },
>   element price {
> 1
>   },
>   element author {
> "Author "|| $i
>   }
> }
>   }
>   ;
>   
>   (:~ 
>   Rolling total of prices
>   @param $prices, accumulates the book prices.
>  $prices[$n] contains the sum of prices for $book[position() <= $n]
>   @param $books sequence of books not yet added to $prices
>   :)
>   declare function local:sum($prices, $books)
>   {
>   let $book   := head($books)   (: Get first book in sequence :)
>   let $prices := if(count($prices) = 0) (: if empty, initialize prices 
> with first price :)
> then ($book/price )   
> else ((: add the current rolling total to the 
> list of rolling totals :)
>   (: that’s the concatenation part :)
>   $prices,
>   element price { $prices[count($prices)] + $book/price } 
> )  
>   return (
> if(count($books) > 1) then 
>   local:sum($prices, tail($books))  (: here's the tail call :)
> else $prices
>   )
>   };
>   
>   
>   {
>   local:sum((), $bookstore/book) 
>   }
>   

You can check if your query is tail-call optimized using the query info panel: 
> - mark as tail call: local:sum(if(empty($prices_2)) then (hea...



Hope this helps!

Best from Konstanz

Michael

> Am 18.02.2019 um 19:12 schrieb Giuseppe G. A. Celano 
> :
> 
> Hi Jonathan, 
> 
> Thanks for that. However, it returns the same stack overflow error as the 
> other script, when  are 38000.  Encreasing the JVM size does not help 
> either.
> 
> E-mail: cel...@informatik.uni-leipzig.de 
> 
> Web site 1: http://asv.informatik.uni-leipzig.de/en/staff/Giuseppe_Celano 
>  
> Web site 2: https://sites.google.com/site/giuseppegacelano/ 
> 
> 
>> On Feb 18, 2019, at 4:51 PM, Jonathan Robie > > wrote:
>> 
>> To make it tail-recursive, make the recursive call the last operation in the 
>> function.
>> 
>> https://en.wikipedia.org/wiki/Tail_call 
>> 
>> 
>> The else() clause is what keeps it from being tail recursive.  Something 
>> like this should work:
>> 
>> declare variable $bookstore := 
>>   
>> story
>> 50.00
>> smith
>>   
>>   
>> history
>> 150.00
>> kelly
>>   
>>   
>> epic
>> 300.00
>> jones
>>   
>> ;
>> 
>> declare function local:sum($books, $sum)
>> {
>> let $sum :=  $sum + $books[1]/price
>> return (
>> { $sum },
>> $books[2] ! local:sum(tail($books), $sum)
>> )
>> };
>> 
>> 
>> {
>> local:sum($bookstore/book, 0)
>> }
>> 
>> 
>> 
>> Jonathan
>> 
>> On Mon, Feb 18, 2019 at 10:24 AM Giuseppe G. A. Celano 
>> mailto:cel...@informatik.uni-leipzig.de>> 
>> wrote:
>> I am writing a recursive function which is similar to the one here:
>> 
>> https://stackoverflow.com/questions/27702718/to-add-values-in-cumulative-format
>>  
>> 
>> 
>> Interestingly, local:sum() works if there are not many . However with 
>> 38000 book element I get the error "Stack Overflow: Try tail recursion".
>> 
>> Any idea?
>> 
>> Ciao,
>> Giuseppe
>> 
>> 
> 



Re: [basex-talk] Docker Volumes Permission denied

2019-02-19 Thread Michael Seiferle
Hi Marie, 

thanks a lot for the follow up.
Happy to hear it’s working!

Best
Michael

Re: [basex-talk] Docker Volumes Permission denied

2019-02-14 Thread Michael Seiferle
Hi Marie, 

thanks for your observations!

The explanation for this behavior is, that the `basexhttp` Process inside the 
container runs as non-privileged user `basex` with an UID of 1984 & GID 0.
Usually processes inside docker containers will run as root and as such will be 
able to read & write from all volumes you mount *inside* your container.
Currently `basexhttp` does not do that.
It mounts your directory from your host OS as a volume insider your container, 
yet the fie/folder it still belongs to its original user (in your case UID 
1000) but from inside the running docker image, a USER with UID 1984 wants to 
write to it. This fails.

Basically: 
>  chown -R 1984 ~/Projects/Architextus/basex-xquery-server/data

Should make your data directory writable to that process — and if it were group 
writable it is still writable by your host OS.
As you write repo & webapp  from the host os only, there is no need to change 
ownership on those folders.

* Another approach I/we usually take is building my own docker image derived 
from basexhttp and ADD my project to the image.

> FROM basex/basexhttp
> ADD ./webapp /srv/basex/webapp
> ADD ./repo /srv/basex/repo
> ADD ./data /srv/basex/data



Any thoughts on this by other docker users? Lot’s of containers run privileged, 
but I am not sure if we really want this.




Let me know if you  need any more help!

Michael






> Am 12.02.2019 um 14:42 schrieb Marie Starck :
> 
> Hello everyone,
> 
> So I am looking to add Docker to a BaseX webapp that is currently running 
> properly on my local. In order to do that, I ran
> docker run -ti -d
> --publish 1984:1984
> --publish 8984:8984
> --volume ~/Projects/Architextus/basex-xquery-server/data:/srv/BaseXData
> --volume ~/Projects/Architextus/basex-xquery-server/webapp:/srv/BaseXWeb
> --volume ~/Projects/Architextus/basex-xquery-server/repo:/srv/BaseXRepo
> basex/basexhttp:8.6.4
> 
> And while localhost:8984 shows me the regular BaseX introduction page, none 
> of the rest endpoints work and I get this error when I try to access the 
> webapp from my localhost:
> 
> Stopped at /srv/BaseXWeb/xqm/g-holismo.xqm, 136/24:
> [bxerr:BXDB0002] Resource "/srv/BaseXData/DITA-AppResources/tbl.basex 
> (Permission denied)" not found.
> 
> Stack Trace:
> - /srv/BaseXWeb/xqm/g-holismo.xqm, 11/10
> 
> I checked the permissions on my docker container and it seems that the basex 
> user only has permissions on WEB-INF but none of the volumes, BaseXData, 
> BaseXRepo and BaseXWeb, those are shown as belonging to user 1000.
> 
> Has anyone experienced this before?
> 
> Thank you for any help or tip you could provide,
> 
> Marie
> 



Re: [basex-talk] ubuntu 18.04 (bionic)

2019-01-31 Thread Michael Seiferle
Hi,

feel free to use the ZIP-file provided at
http://files.basex.org/releases/9.1.2/ it should be up to date :)


Best
Michael


On Thu, Jan 31, 2019 at 10:23 AM Ветошкин Владимир 
wrote:

> Hi!
>
> There is only 8.5.1 version for Ubuntu 18.04 at url
> https://launchpad.net/basex/+packages
> <https://launchpad.net/basex/+packages)>
> Is there 9 version for that Ubuntu ?
>
> Thx
>
> --
> С уважением,
> Ветошкин Владимир Владимирович
>
>


-- 
--
Michael Seiferle, BaseX GmbH, http://basex.org
|-- Firmensitz: Obere Laube 73, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Fon: +49 7531 28 28 676, Fax: +49 7531 20 05 22


Re: [basex-talk] Strange response from Docker BaseXDBA

2018-12-07 Thread Michael Seiferle
Hi Huib, 

Thanks for the pointer to stackoverflow, I missed that one!
I added an answer over there: 
https://stackoverflow.com/questions/53462688/docker-basex-dba/53667345#53667345 

 — his problem somehow unrelated to your problem as the question refers to an 
older DBA version.

However the solution presented there should work well.
The docker build in our root folder will not add the DBA, so that’s most 
probably the issue?
> I did a "docker build -t basexdba ." in de root of the source folder of BaseX 
> as per the DBA example in http://docs.basex.org/wiki/Docker.

You may validate if the dba folder is present in your running container via 
`docker exec $CONTAINER-ID` — you can find the container id using `docker ps`:

Below I have to containers, one contains  the dba folder, the other does not.

> michael@mbp:~/tmp|⇒  docker exec 99f650b42036 ls '/srv/basex/webapp'
>> WEB-INF
> michael@mbp:~/tmp|⇒  docker exec 3a4eb9927c90 ls '/srv/basex/webapp'
>> WEB-INF
>> chat
>> dba
>> restxq.xqm
>> static


Hope this helps! Let me know if I can shed some more light on this issue!

Best
Michael

> Am 06.12.2018 um 13:29 schrieb Christian Grün :
> 
> Hi Huib,
> 
> I’ve never tried our docker images, but as far as I know, the last DBA
> docker images are based on 8.5.4. Are you still working with BaseX 8?
> 
> Best,
> Christian
> 
> 
> 
> On Thu, Nov 29, 2018 at 5:29 PM Huib Verweij  wrote:
>> 
>> Hi,
>> 
>> I have a strange case of receiving a “No function found that matches the 
>> request” message from BaseXDBA.
>> 
>> I did a "docker build -t basexdba ." in de root of the source folder of 
>> BaseX as per the DBA example in http://docs.basex.org/wiki/Docker.
>> 
>> I got a basexdba:latest image and started it with “docker run -p 8984:8984 
>> basexdba:latest”.
>> 
>> According to the documentation I should get the dba page with: 
>> http://localhost:8984/dba but the server returns "No function found that 
>> matches the request.".
>> 
>> There’s also a recent question on Stackoverflow about this: 
>> https://stackoverflow.com/questions/53462688/docker-basex-dba/53543130#53543130
>> 
>> Regards,
>> 
>> Huib.



Re: [basex-talk] Strategies for using BaseX & friends as XML CMS?

2018-08-14 Thread Michael Seiferle
Hi Andreas,

I don’t think there are many out of the box solutions to this, despite 
document-level locking in our webdav-implementation.

We have however worked on an oxygen-based solution, together with axxepta GmbH, 
called Argon Author: http://argon-author.com 
There is support for checkout/checkin/locking as well as a per file history all 
implemented in plain XQuery that might serve as a starting point for 
implementation/discussion :-)

Best from Lake Constance
Michael





> Am 09.08.2018 um 17:54 schrieb Andreas Jung :
> 
> Hi there,
> 
> we are currently investigating options for using XML database as a backend in 
> a publishing project
> related to technical documentation - DITA in particular. The broad customer 
> requirements are
> checkin and checkout of documents, locking of documents and versioning. Has 
> anyone worked with
> an XML database in similar scenarios? Any pointers?
> 
> Andreas



Re: [basex-talk] Nugets?

2018-06-08 Thread Michael Seiferle
Hi Radim, hi Dirk, hi Peter,

in my opinion  offering nuget packages might at least be worth investigating, 
if we were able to automate their creation I sure don’t have any objections! 

After (briefly) reading the documentation at 
https://docs.microsoft.com/en-us/nuget/what-is-nuget 
 I think shipping a 
precompiled version of our c# client (including version information, license 
information etc.)
would already help Peter, Radim and their teams in using our client, right?

If there is mutual interest we could move the discussion to GitHub, I’d be 
grateful if s/o with more .net platform expertise was willing to join the 
actual process or at least provide some pointers in the right direction :-)

Best from Konstanz

Michael



> Am 08.06.2018 um 15:37 schrieb  
> :
> 
> Hello,
> 
> it would be nice to have BaseX as a Nuget package, but I can live without 
> that. It's quite easy to integrate it as-is.
> Regads,
> 
> Radim Havlicek
> C# developer
> 
> -- Původní e-mail --
> Od: Kirsten, Dirk 
> Komu: Peter Villadsen 
> Datum: 8. 6. 2018 12:45:53
> Předmět: Re: [basex-talk] Nugets?
> 
> Hello Peter,
> 
> just my thoughts, and Christian for sure will answer you more politely, but I 
> am quite confused by your email. First of, I (and I am sure many others…) 
> have never heard of Nuget before and saying “engineers expect that” is 
> certainly wrong. It might be true for the C# community, but there are other 
> engineers out there… 
> 
> And given that C# is not a focus of BaseX, but instead only provides a client 
> for your convenience I am not surprised the BaseX team does not support that.
> 
> Also, I have a hard time believing the trivial 302 lines of code of the C# 
> client are that expensive and time consuming to check. Also, the Microsoft 
> internal pre-shipping legal audits seem to be neither the fault nor the 
> responsibility of BaseX. Hey, BaseX is even under the most liberal open 
> source licence, something which can not be said about many Microsoft products 
> (although I appreciate the improvements Microsoft have done in their actions 
> and think regarding open source).
> 
> Given that BaseX is an open source product you are more than welcome to 
> contribute these nuget packages. It is even super-easy, because the BaseX 
> repository is hosted on this Microsoft webplatform GitHub.
> 
> Best regards
> Dirk
> 
> 
> Senacor Technologies Aktiengesellschaft - Sitz: Eschborn - Amtsgericht 
> Frankfurt am Main - Reg.-Nr.: HRB 105546
> Vorstand: Matthias Tomann, Marcus Purzer - Aufsichtsratsvorsitzender: Daniel 
> Grözinger
> 
> On 7. Jun 2018, at 18:55, Peter Villadsen  > wrote:
> 
>  
> Hello,
> I am building a system that relies on a Basex backend, and for that I have 
> chosen to use the TCP protocol. My system is built in managed code, so I went 
> ahead and copied the code provided here: 
> https://github.com/BaseXdb/basex/tree/master/basex-api/src/main/c%23 
>  which 
> satisfied my needs very nicely. However, since I have not written this code 
> myself, it is subject to expensive and time consuming pre-shipping legal 
> audits where it is checked that the code does not contain references to other 
> public domain code. 
>  
> Engineers developing managed code today expect APIs to be shipped as Nuget 
> packages. This has the advantages that it is extremely easy to uptake, you 
> can regard it as a black box (but get the source if you need to), and it 
> supports dependencies (none, in your case) and you can go back and use 
> previously shipped versions (which is important in your case, since you have 
> just changed the authentication scheme I believe). Could  you consider 
> offering the API as both Nugets and source on Github?
>  
>  
> Best Regards
>  
> Peter Villadsen
> Principal Architect
> Microsoft Business Applications Group
> 



Re: [basex-talk] XInclude and Catalog resolution

2018-05-02 Thread Michael Seiferle
Hi Andreas, 

I hope I get your question right, I am no export on catalog resolvers ;-)

1) the doc()-function resolves (relative) paths relative to the base-uri of the 
static context, that explains why your `doc()` call fails.

> BaseX tries to load the 'fragments/xhtml5-page.xhtml' from
> 'example.com/restxq-framework/src/'


=> basex won’t find that document at example.com <http://example.com/>.

> am I right, that both XML catalogs and XIncludes get only evaluated at
> document import, not at XQuery execution?

XIncludes and catalog resolving will happen at document parse time, hence: only 
if `basex` successfully found your document it will pass it on to the parser 
and the parser will try to resolve entities and uris w.r.t. to your catalog 
file.

The doc function will initiate parsing, but it will not look for a catalog by 
default.
To overcome this you may either use the command: `set catfile 
/path/to/catalog.xml`, `declare option db:catfile „path/to/catalog.xml“` or   
or you may want to use the `fetch:xml` function, which imho is the most 
flexible approach.

The following worked for me:

1. Remove the static-base-uri() from your query, as this will affect how doc 
tries to resolve URLs, but the doc function is not aware of XML catalogs

2. Create a catalog.xml 

http://example.com/restxq-framework/src/;
rewritePrefix="file:///Users/michael/ml/catalog-resolver/"/>


3. XInclude: 
 http://www.w3.org/2001/XInclude; 
href="http://example.com/restxq-framework/src/fragments/hello.xml"/>

4. Tell the XML parser to make use of your catalog:
fetch:xml(
  "/Users/michael/ml/catalog-resolver/fragments/xhtml5-page.xhtml",
  map {
"catfile": "/Users/michael/ml/catalog-resolver/catalog.xml“
  }
)

This is what I came up with: https://git.dev.basex.org/snippets/53 
<https://git.dev.basex.org/snippets/53> 

Hope this helps!
Best from Konstanz, 

Michael






--
Michael Seiferle, BaseX GmbH, http://www.basexgmbh.de
|-- Firmensitz: Obere Laube 73, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Tel: +49 7531 916 82 77

> Am 01.05.2018 um 21:43 schrieb Andreas Mixich <mixich.andr...@gmail.com>:
> 
> Hello,
> 
> am I right, that both XML catalogs and XIncludes get only evaluated at
> document import, not at XQuery execution?
> 
> If I do
> 
>  declare base-uri "http://example.com/restxq-framework/src/;;
> 
>  let $file := doc("fragments/xhtml5-page.xhtml")
>  return $file
> 
> and I have an XML Catalog entry like this:
> 
>  name="http://example.com/restxq-framework/src/;
> uri="file:///S:/projects/restxqfr/src/"/>
> 
> or this:
> 
>  systemIdStartString="http://example.com/restxq-framework/src/;
> rewritePrefix="file:///S:/projects/restxqfr/src/" />
> 
> BaseX tries to load the 'fragments/xhtml5-page.xhtml' from
> 'example.com/restxq-framework/src/'
> 
> -- 
> Goody Bye, Minden jót, Mit freundlichen Grüßen,
> Andreas Mixich



Re: [basex-talk] Big Surprise from outputs in version 7.3.1 and 8.6.7 ?

2018-02-02 Thread Michael Seiferle
Hi Bang,

If you export a database its contents will be written to the folder given as an 
argument to the EXPORT command:

EXPORT [path]
> Exports all documents in the database to the specified file path


The `basex.*`-files you are seeing in your data folder are database files.
This is what exporting a database might look like: 
https://asciinema.org/a/QzLcXX93nJIUaOAcjfp94rOOQ 


Step 1: put your database in the `data/${database-name}` folder 
Step 2: OPEN ${database-name}
Step 3: EXPORT ${path}
Step 4: find your (XML)-files in ${path}

(Replace ${foo} with the actual names).

Apart from that http://docs.basex.org/wiki/Databases 
 might be a good read =) 

Best
Michael




> Am 02.02.2018 um 14:03 schrieb Bang Pham Huu :
> 
> Yes, I opened the document
> (http://files.basex.org/releases/7.3/BaseX73.pdf) and it said "EXPORT
> writes all resources to the specified target directory • GUI: Go to
> Database → Export, choose the target directory and press OK".
> 
> But as the BaseX GUI tool cannot open .basex file as database (that is
> why I asked you by listing all the files I have) so the export button in
> drop down database menu is disable.
> 
> Thanks,
> 
> 
> On 02/02/2018 01:56 PM, Christian Grün wrote:
>> Have you found and opened the documentation PDF for BaseX 7.3? Looking
>> for the term "export" should give you some hints.
>> 
>> Best,
>> Christian
>> 
>> 
>> 
>> On Fri, Feb 2, 2018 at 1:36 PM, Bang Pham Huu
>>  wrote:
>>> Hi Christian,
>>> 
>>> I'd do as your suggestion, but I'm stuck with how to export old database
>>> to XML file. I only have these files (no XML):
>>> 
>>> atv.basex   atvr.basex  tbl.basex   txt.basex   txtr.basex
>>> atvl.basex  inf.basex   tbli.basex  txtl.basex
>>> 
>>> and from your link, I tried to download BaseX GUI application
>>> http://files.basex.org/releases/7.3/BaseX73.jar. But this tool seems can
>>> open from XML file only. How can I open these .basex file and convert
>>> to  a XML file?
>>> 
>>> Thanks,
>>> 
>>> 
>>> On 02/02/2018 12:55 PM, Christian Grün wrote:
 Hi Bang,
 
 The general answer on your initial question: BaseX is
 backward-compatible. Older databases can be opened and queried with
 newer versions of BaseX.
 
 This seems to conflict with the experiences you made. But I agree with
 Dirk: It’s difficult to understand what is going wrong in your testing
 environment. It’s not possible to tell why a query should yield
 results that is not contained in the data you provide.
 
 Maybe you could try to proceed step by step and give feedback:
 
 1. Export the database with BaseX 7.3.1. Note that you cannot use all
 the BaseX 8.x syntax with older versions of the software. Please check
 out our documentation history to learn how to proceed [1].
 2. Export the same database with BaseX 8.x.
 3. Compare the resulting output.
 
 If the output of BaseX 7 and 8 differs, then:
 
 4. Ensure that your database directories are really identical.
 5. Report back to us which output you believe is correct: If the
 output of BaseX 7.x is wrong, it may even be due to a bug in the old
 version, or due to some corrupt data that can successfully restored by
 BaseX 8. If the output of BaseX 8.x is wrong, tell us what is missing.
 
 If the output is identical, then:
 
 4. Create a new database from this data with BaseX 8.x.
 5. Run your query and compare the results.
 
 Best,
 Christian
 
 [1] http://docs.basex.org/wiki/Documentation
 
 
 
 
 On Fri, Feb 2, 2018 at 11:48 AM, Bang Pham Huu
  wrote:
> What I tried to say is: I'm using input (old database) which has lot of
> modifications since version 7.3.1 and I could use this database for both
> applications (BaseX 8.6.7 and BaseX 7.3.1 on different systems). But
> application in 8.6.7 can export database (with some missing data),
> application in 7.3.1 cannot export database (error).
> 
> If it is hard to understand, sorry about it. I shouldn't have asked this
> question if one database is queried with same queries on both version 
> BaseX
> 8.6.7 and BaseX 7.3.1 could return different results.
> 
> So, now, actually I couldn't provide you a valid test input ("Your input 
> XML
> (using BaseX 8.6.7)") because as you saw that in exported db from an
> application using BaseX 8.6.7 on this olddatabase, the data is missing and
> you questioned about it.
> 
> "The expected result and how it differs from what you expect", I'd say it
> should be the same from application using BaseX version 7.3.1 as my first
> email (it can be replaced from "\n" to " ", it is ok).
> 
> I asked because I just want to 

Re: [basex-talk] xml element beginning and end space loss

2018-02-01 Thread Michael Seiferle
Hi Stefania,

Sorry for the delay.

If I run you example, I **think** it behaves as intended, all -Elements but 
the one marked with xml:space are chopped.

This is what it looks like here: 
> https://asciinema.org/a/4v1FtkeE1QsEByHe1S2BAZP9W

> michael@mbp:~/tmp/ml|⇒  cat example.xq
> db:create('test',
> "
> stefy  
> stefy  
> stefy  
> ",
> "doc.xml"
> )
> michael@mbp:~/tmp/ml|⇒  basex example.xq
> michael@mbp:~/tmp/ml|⇒  basex "db:open('test')"
> 
>   stefy
> stefy  
>   stefy
> %

…if I add CHOP=false, the whitespace will be kept on all elements:
https://asciinema.org/a/IqUHE2hrhk0afjbPDi3jMgNVq 
<https://asciinema.org/a/IqUHE2hrhk0afjbPDi3jMgNVq>

I am sure we will eventually be able to solve this mystery :-)

Best
Michael

> Am 30.01.2018 um 23:36 schrieb Stefania Axo <st...@us.ibm.com>:
> 
> thanks  Michael
> 
> I run your suggestion and it seems to affect all the elements on my BaseX.
> I also verified that the 'chop' property was still true after the execution 
> of the xquery 
> (> open test
> Database 'test' was opened in 7.29 ms.
> > get chop
> CHOP: true)
> 
> db:create('test',
> "
> stefy  
> stefy  
> stefy  
> ",
> "doc.xml"
> ) 
> >>>>>
>stefystefy  
> stefy 
> 
> 
> 
> 
> db:replace("test", "doc1.xml",
> "
> stefy  
> stefy  
> ")
> >>>>>
>stefy 
> stefy 
> 
> 
> Am i missing something?
> thanks
> Stefania
> 
> 
> 
> From:Michael Seiferle <m...@basex.org>
> To:Gerrit Imsieke <gerrit.imsi...@le-tex.de>, st...@us.ibm.com
> Cc:BaseX <basex-talk@mailman.uni-konstanz.de>
> Date:01/29/2018 11:22 AM
> Subject:Re: [basex-talk] xml element beginning and end space loss
> 
> 
> 
> Hi & thanks Gerrit,
> Hi Stefania,
> 
> You may even decide to chop-or-not on a per-element basis:
> db:create('test',
> "
> stefy  
> stefy  
> ",
> "doc.xml"
> )
> 
> Will preserve whitespace in the second -Element while chopping in the 
> first one.
> => http://docs.basex.org/wiki/Options#CHOP 
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Options-23CHOP=DwMFAg=jf_iaSHvJObTbx-siA1ZOg=oRDtJNjvHAlLIcU_p2eWUQ=AIHTeBAo5MBiXhmnxUdQi_GxNJ60DZKWMN9ThNZO0J4=LdABq3glFtOe8YafyHOrMcDLENoIHMUkyZuepDsyamQ=>
> 
> 
> Best from Konstanz :-]
> 
> Michael
> 
> Am 27.01.2018 um 01:06 schrieb Imsieke, Gerrit, le-tex 
> <gerrit.imsi...@le-tex.de <mailto:gerrit.imsi...@le-tex.de>>:
> 
> Luckily you can switch it off.
> 
> 
> 



Re: [basex-talk] xml element beginning and end space loss

2018-01-29 Thread Michael Seiferle
Hi & thanks Gerrit,
Hi Stefania,

You may even decide to chop-or-not on a per-element basis:
> db:create('test',
> "
> stefy  
> stefy  
> ",
> "doc.xml"
> )

Will preserve whitespace in the second -Element while chopping in the 
first one.
=> http://docs.basex.org/wiki/Options#CHOP 



Best from Konstanz :-]

Michael

> Am 27.01.2018 um 01:06 schrieb Imsieke, Gerrit, le-tex 
> :
> 
> Luckily you can switch it off.



Re: [basex-talk] Special Character Search - @, $,#

2018-01-24 Thread Michael Seiferle
Hi Navin,

these characters are not searchable by the full-text-index.
@$# and other special-characters are treated as word-breakers[1] and can’t be 
searched for.

If you ran for example the following query:
> ft:tokenize("f...@bar.de#test$baz“)
You will see which tokens will be added to the full-text-index.
The full-text-index is usually used to search in natural language texts, so 
punctuation und special characters are generally ignored.

Maybe a naïve approach already helps: 
> db:open(‚database')//text()[contains(., "@")]/..


Best from Konstanz,

Michael


[1] https://www.w3.org/TR/xpath-full-text-10/ 
<https://www.w3.org/TR/xpath-full-text-10/>

--
Michael Seiferle, BaseX GmbH, http://www.basexgmbh.de
|-- Firmensitz: Obere Laube 73, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Tel: +49 7531 916 82 77

> Am 24.01.2018 um 10:42 schrieb Navin Rawat <nrawat2...@gmail.com>:
> 
> Hi Team,
> 
> Could I search @, $, # by full text API of bases?
> 
> I am using following query but unable to get any success:
> 
> let $query := '@'
> let $options := map {
> "mode": "any",
> "fuzzy": "off",
> "wildcards": true(),
> "ordered": "false"
> }
> return ft:search("database", $query, $options)
> 
> Please suggest.
> 
> Regards,
> Navin



Re: [basex-talk] XML + HTML to JSON

2017-12-14 Thread Michael Seiferle
Hi Max, 

I am not aware of any direct way, but you might consider the following:

https://gist.github.com/micheee/c5a55ca8b49435934c006cfc5df7ba0f


What it does: 

1. Replace the contents of xhtml with its string serialization
2. Wrap the info node in an element named json, according to our own JSON 
serialization format
3. Serialize the contents as JSON.
…to go back:
4. Serialize the JSON as XML
5. Remove our JSON-Mapping Attributes
6. Replace the value of the element with its (parse:html() in case it is a 
valid document with a single root node) parse-xml-fragment() contents.


Hope this kind of helps ;)

Michael


--
Michael Seiferle, BaseX GmbH, http://www.basexgmbh.de
|-- Firmensitz: Obere Laube 73, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Tel: +49 7531 916 82 77

> Am 14.12.2017 um 16:16 schrieb Maximilian Gärber <mgaer...@arcor.de>:
> 
> Hi,
> 
> we've content similar to:
> 
> 
> Foo
> 
>Some para 
> 
> 
> 
> How can I tell the JSON serializer to treat the content of  as html?
> 
> 
> Br,
> 
> Max



Re: [basex-talk] Loading data

2017-11-19 Thread Michael Seiferle
Dear Wray,

I tried to come up with a sketch of what–I think–might help you:
https://gist.github.com/micheee/8a8734a1713a7121cab15eb3dfb389d9

Basically it boils down to:
1. Fetch the JSON
2. Convert that JSON to an XQuery item
3. Iterate over each array entry and explicitly construct the XML 
representation you want


So in a nutshell, in XQuery 3.1, something like the following:
>   
> fetch:text('https://gist.githubusercontent.com/Miserlou/c5cd8364bf9b2420bb29/raw/2bf258763c704f8ffd3ea9a3e81d25e2c6f6/cities.json')
>   => parse-json()  (: Convert to XQuery item representation :)
>   => array:for-each(function($map){ (: For each entry in that array, do :)
> element item { (: Construct an XML element named item :)
>   $map => map:keys()
>   => for-each(function($key){  (: For each key in the map, do: :)
> element { $key } { (: Return an element named $key :)
>   $map($key)   (: …and the value of $map($key) :)
> }
>   })
> }
>   })
>   => array:flatten() (: Converts the array to a sequence :)


I assume you are using BaseX, so maybe the json:parse() function might be 
another option, that is based on our own implementation and will create an XML 
representation right away:
>   
> fetch:text('https://gist.githubusercontent.com/Miserlou/c5cd8364bf9b2420bb29/raw/2bf258763c704f8ffd3ea9a3e81d25e2c6f6/cities.json')
>   => json:parse()
For more info on our BaseX JSON-Module see: 
http://docs.basex.org/wiki/JSON_Module


As I can only guess what your XQuery code actually looks like I hope this comes 
somewhat close to what you want.


Hope this helps ;-)

Best from Konstanz

Michael

> Am 19.11.2017 um 06:25 schrieb E. Wray Johnson :
> 
>  I have a JSON file
> https://gist.githubusercontent.com/Miserlou/c5cd8364bf9b2420bb29/raw/2bf258763c704f8ffd3ea9a3e81d25e2c6f6/cities.json
>  
> 
> 
> I want to load it into a database in a different XML format where I can use 
> gml:Point in place of longitude and latitude as separate elements.  However 
> my for loop does not emit individual XML elements for each json object in the 
> loaded array.
> 



Re: [basex-talk] A few general questions about BaseX

2017-09-12 Thread Michael Seiferle
Hi Anastasiou,

:-)

> Am 12.09.2017 um 10:54 schrieb Anastasiou A. :
> 
> Hello everyone
>  
> I am trying to load BaseX with a large number of XML files (~500), each one a 
> few hundreds of MBs big.
> BaseX fails with a message along the lines “This is too big for one database”.
=> might be that you hit one of our database limits.
See the first line here for general limits: 
http://docs.basex.org/wiki/Statistics 
>  
> Can I please ask:
>  
> 1)  Are there any logs, beyond the DB logs? If yes, where can I find them?
> a.  The reason I am asking is because once basexgui gives the message, 
> there is no indication about the error.
> Ideally, I would like to know if this is a limitation on memory amount or 
> number of items (?).
The database logs are all there is.
You can use the admin module to add your own messages to these logs, 
http://docs.basex.org/wiki/Admin_Module#admin:write-log 


So for example in a try / catch block you could log more explicitly whats 
happening :)

> 
> 2)  The parser options include reading XML files from archives, which is 
> very convenient, but once the file has been 
> parsed, does BaseX require the “originals” for queries / returning results?
If you created a database from your archive, i.e. db:create(‚foo.zip‘,…) the 
original files are no longer needed.
http://docs.basex.org/wiki/Database_Module#db:create 


> 
> 3)  Is it possible to do federation with BaseX? In other words, let’s say 
> I split a database in two large parts (as per #1), 
> is it possible to launch two baseX servers and then have them talk to each 
> other so that ultimately I just query one of 
> them and get back unified results?
> 

Yes, it is possible, but only if you are willing to suffer a little :-)
You can use the http://docs.basex.org/wiki/Client_Module 
 to connect to a running basex server 
and you could use the http://docs.basex.org/wiki/XQuery_Module#xquery:fork-join 
 to connect to 
multiple servers at once, pose a query and return the results.

But expect to do some stuff by hand: i.e.:

- maintain a list of servers you currently have
- handle storing, deleting and updating documents
- handle document retrieval, …

So a probably large bit of manual work is absolutely required, but depending on 
what you need to do with your documents it might work "well enough“ :-)

If you need more information let me know!

Best Michael


> All the best



Re: [basex-talk] Issue with Full Text Retrieval

2017-09-11 Thread Michael Seiferle
Hi Ron,
Hi Fabrice,

Your observation w.r.t. to element boundaries is right, the document is 
converted to a textual representation, by default it returns all nodes in their 
string representation:

$doc :=
> 
>   XQuery 
>   <_>and XPAth
>   <_>are   awesome
> /data()

Will turn to:
> 
>   XQuery 
>   and XPAthare   awesome
>  
So:
> $doc contains text { 'XPath‘ }

will return false.

You have 3.5 options:

1) => as Fabrice showed, query the individual text nodes

2) use the ft:search() Function to query the index directly, 
http://docs.basex.org/wiki/Full-Text_Module#ft:search 
<http://docs.basex.org/wiki/Full-Text_Module#ft:search>

> ft:search(
>   'CTGovDebug',
>   'neoplasms'
> )/.. (: get parent element for the matching text()-node

3) disable chopping when creating the database, 
http://docs.basex.org/wiki/Options#XML_Parsing 
<http://docs.basex.org/wiki/Options#XML_Parsing> 
> db:create(
>   'CTGovDebug',
>   "Path/to/NCT00473512.xml",
>   "NCT00473512.xml",
>   map {
>'ftindex': true(),
>'chop': false()
>   })


3.5) use the xml:space="preserve“ attribute to tell the parser not to chop 
child nodes of  when creating a database:
> 
>   
>   
> ClinicalTrials.gov processed this data on August 31, 
> 2017
> Link to the current ClinicalTrials.gov record.
> 



Hope this helped shed some light :-)

Best from Konstanz
Michael
--
Michael Seiferle, BaseX GmbH, http://www.basexgmbh.de
|-- Firmensitz: Obere Laube 73, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Tel: +49 7531 916 82 77

> Am 11.09.2017 um 09:35 schrieb Fabrice ETANCHAUD 
> <fetanch...@pch.cerfrance.fr>:
> 
> Hello Ron,
>  
> I don’t know how ft operators behave on document nodes.
> Supposing documents are converted to their data() representation, Your query 
> would yield the same negative answer.
> You should consider applying ft operators on text nodes like this :
>  
> for $trial in db:open('NCT00473512')//text() (: 
> [clinical_study/id_info/nct_id='NCT00473512'] :)
> return $trial[. contains text { 'neoplasms' }]
>  
> Best regards,
> Fabrice Etanchaud
>  
>  
> De : basex-talk-boun...@mailman.uni-konstanz.de 
> [mailto:basex-talk-boun...@mailman.uni-konstanz.de] De la part de Ron Katriel
> Envoyé : lundi 11 septembre 2017 00:42
> À : BaseX
> Objet : [basex-talk] Issue with Full Text Retrieval
>  
> Hi,
>  
> I am seeing strange behavior with Full Text retrieval. The following query 
> fails for a number of words that are in the XML document (see attached):
>  
> for $trial in db:open('CTGovDebug') (: 
> [clinical_study/id_info/nct_id='NCT00473512'] :)
> return $trial contains text { 'neoplasms' }
>  
> It fails on a good number of words including neoplasms, cougar, industry, 
> yes, completed, november, 2005, interventional, single, male, female, 
> assignment, none, research, principal, primary, secondary, age, years, 
> gender, etc. But it matches most of the words in the file.
>  
> Observation: The words that fail are located at the beginning and/or end of 
> the text and do not occur anywhere else in the middle of any text.
>  
> The document is the only one in the database. It does not make a difference 
> whether full text indexing is on or off. My BaseX version is 8.6.4.
>  
> Thanks,
> Ron
>  
>  
> Ron Katriel, Ph.D. | Principal Data Scientist | Medidata Solutions 
> <http://www.mdsol.com/>
> 350 Hudson Street, 7th Floor, New York, NY 10014
> rkatr...@mdsol.com <mailto:tbro...@mdsol.com> | direct: +1 201 337 3622 
>  | mobile: +1 201 675 5598 
>  | main: +1 212 918 1800 
> 


Re: [basex-talk] XML import issue (header related)

2017-09-04 Thread Michael Seiferle
Hi Ron, 

Adding another opinion the board (I meant to write this already on Saturday) ;-)
I don’t think there is much to optimize w.r.t. to the XQuery update solution, 
as your whole database will be held in memory during the update…
YET: if you do not care for the namespaces you could still strip them when 
creating your database:

```
db:create(
  'mydb-no-ns',
  '<_>',
  'mydoc2.xml',
  map {"stripns": "yes"}
)```

> http://docs.basex.org/wiki/Database_Module#db:create 
> 
> => • parsing options will only impact string input (URIs, XML strings), 
> because nodes have already been parsed.


Maybe this helps, I am not sure if someone already mentioned it!
Best

Michael

> Am 02.09.2017 um 00:38 schrieb Ron Katriel :
> 
> I can go with the default namespace declaration so no followup is needed, 
> unless you are curious and have the time to investigate.
> 



Re: [basex-talk] New basex-version -> broken paths

2017-09-04 Thread Michael Seiferle
Hi Günter,

sorry for my blatant ignorance, I am using RESTXQ over REST so regularly, that 
I almost forgot about the actual REST-Servlet! 


Still I encourage you to go with fetch:xml(); so if you changed it from:
> let $tokens := fetch:xml("tokens.xml")//entry

To:
> let $tokens := fetch:xml(„relative/to/.basex-home/tokens.xml")//entry

With `fetch:xml` in contrast to `doc()` it should work consistently across all 
modes of operation (REST, RestXQ, BaseX Standalone).
>   See: http://docs.basex.org/wiki/Fetch_Module#Conventions 
>   And this GIST for 
> resolving inconsistencies: 
> https://gist.github.com/micheee/2baf385a1974c9da0db867ed2634cf48


I am not really sure when the behavior of `doc` in the REST servlet changed, 
but a commit between 8.5.4 and 8.6 must have introduced this change.

`RESTPATH` is used to define the location of the XQuery files ran via the 
`?run=`-Parameter, but it does not change the base uri of the static context.


Hope this won’t cause too much trouble with your codebase.

Best
Michael

Btw. You are not the first one to encounter the intricacies of the doc() 
function: https://github.com/BaseXdb/basex/issues/1435 

> Am 04.09.2017 um 14:32 schrieb Günter Dunz-Wolff 
> :
> 
> Hi Michael,
> 
> thanks for the information.
> I changed 
> let $tokens := doc("tokens.xml")//entry
> to
> let $tokens := fetch:xml("tokens.xml")//entry
> (tokens.xml is in the same directory as the xq-file.)
> 
> The problem is still the same:
> [bxerr:BXFE0001] Resource "/Users/User/tokens.xml (No such file or 
> directory)" not found.
> 
> The path should be: /Users/User/Documents/project/BaseXWeb/tokens.xml
> 
> Same problems with RESTPATH empty or path to project-folder.
> 
> As I wrote, I have only problems with the REST-Service, not with RESTXQ.
> 
> Best,
> Guenter



Re: [basex-talk] Simple Map Operator in oXygen XML (XQJ)

2017-09-04 Thread Michael Seiferle
Hi Omar,

Looks like that error message is generated by oXygen; you might want to 
crosspost to their list.

Best
Michael

> Am 04.09.2017 um 14:31 schrieb Omar Siam :
> 
> Hi!
> 
> I just tried to use ther Simple Map Operator while writing an XQuery in 
> oXygen XML and executing the query using a client/server BaseX 8.6.6 data 
> source. I configured it as described here: 
> http://docs.basex.org/wiki/Integrating_oXygen
> 
> When I use the Simple Map Operator (!) I only get "Invalid XQuery syntax, 
> syntax does not pass static validation.". For example using "(1 to 10) ! 
> element node { . }"
> 
> If I run that XQuery in DBA for example it works.
> 
> Any ideas?
> 
> Best regards
> 
> Omar Siam
> 



Re: [basex-talk] New basex-version -> broken paths

2017-09-04 Thread Michael Seiferle
Hi Gunter,
Hi Kendall,

With more recent versions of BaseX I use the db:open() and fetch:xml() 
functions in order to open databases and files.

We introduced those functions because the `doc` function’s omnipotence lead to 
some confusion :-)

The `fetch:xml` function always resolves relative to the current working 
directory, which in the context of RestXQ is the project root, where .basex 
file resides.
`doc()`  otoh  resolves relative to the base-uri of the static context, which 
usually is the currently run query.

I hope this change won’t introduce to much problems with your codebase.

Best from Konstanz

Michael

> Am 04.09.2017 um 07:50 schrieb Kendall Shaw :
> 
> I don’t have an answer, but I was curious and so I tried setting the option 
> RESTPATH to /tmp. I am using 8.6.5.
>  
> With that, run=some.xq and run=../tmp/some.xq both ran the same query. In 
> some.xq I had doc(‘../tmp/some.xml’) and I get an error that
> /opt/tomcat/webapps/basex/tmp/some.xml doesn’t exist. WEBPATH is 
> /opt/tomcat/webapps/basex/.
>  
> So, it could be a difference in settings or default settings between the 2 
> versions, as opposed to being a bug.
>  
> Kendall
>  
> From:  on behalf of Günter 
> Dunz-Wolff 
> Date: Sunday, September 3, 2017 at 4:09 AM
> To: BaseX 
> Subject: [basex-talk] New basex-version -> broken paths
>  
> Hi all, 
>  
> I updated my aged basex-version (8.5.3) to 8.6.6. With the new version, my 
> defined file-references are broken, for example:
> let $style := doc('../xq_diff/remove_elements_from_doc.xsl‘)
> Even files in the same directory with the XQuery-file (corrigenda.xq) like: 
> let $tokens := doc(„tokens.xml")
>  
> With 8.5.3 the REST-Requests with 
> http://localhost:8984/rest?run=xqs/corrigenda.xq 
> 
>  worked without problems.
>  
> With 8.6.6 and with the same request I’ll get the following error:
> Stopped at ., 11/18:
> [FODC0002] Resource '/Users/xq_diff/remove_elements_from_doc.xsl' does not 
> exist
> OR
> Stopped at ., 79/26:
> [FODC0002] Resource '/Users/xxx/kleist_tokens.xml' does not exist.
>  
> It does work in BaseXGUI but not with the http-server. 
>  
> Thanks for any help, Guenter
>  
>  
>  


> Am 04.09.2017 um 07:50 schrieb Kendall Shaw :
> 
> I don’t have an answer, but I was curious and so I tried setting the option 
> RESTPATH to /tmp. I am using 8.6.5.
>  
> With that, run=some.xq and run=../tmp/some.xq both ran the same query. In 
> some.xq I had doc(‘../tmp/some.xml’) and I get an error that
> /opt/tomcat/webapps/basex/tmp/some.xml doesn’t exist. WEBPATH is 
> /opt/tomcat/webapps/basex/.
>  
> So, it could be a difference in settings or default settings between the 2 
> versions, as opposed to being a bug.
>  
> Kendall
>  
> From:  on behalf of Günter 
> Dunz-Wolff 
> Date: Sunday, September 3, 2017 at 4:09 AM
> To: BaseX 
> Subject: [basex-talk] New basex-version -> broken paths
>  
> Hi all, 
>  
> I updated my aged basex-version (8.5.3) to 8.6.6. With the new version, my 
> defined file-references are broken, for example:
> let $style := doc('../xq_diff/remove_elements_from_doc.xsl‘)
> Even files in the same directory with the XQuery-file (corrigenda.xq) like: 
> let $tokens := doc(„tokens.xml")
>  
> With 8.5.3 the REST-Requests with 
> http://localhost:8984/rest?run=xqs/corrigenda.xq 
> 
>  worked without problems.
>  
> With 8.6.6 and with the same request I’ll get the following error:
> Stopped at ., 11/18:
> [FODC0002] Resource '/Users/xq_diff/remove_elements_from_doc.xsl' does not 
> exist
> OR
> Stopped at ., 79/26:
> [FODC0002] Resource '/Users/xxx/kleist_tokens.xml' does not exist.
>  
> It does work in BaseXGUI but not with the http-server. 
>  
> Thanks for any help, Guenter
>  
>  
>  



Re: [basex-talk] Fwd: Re: using apply-function within an updating function

2017-08-29 Thread Michael Seiferle
Hi Rob,
hi Marco,


First: sorry for not coming back to you earlier.

Glad it worked using mixupdates, but I think there might be a way to make it 
work using the new XQUF 3.0 "invoke updating" capabilities  :-)
Christian is currently on holiday, I am sure he will report back on this. 


Best from Konstanz,

Michael

Von meinem iPhone gesendet

> Am 29.08.2017 um 15:17 schrieb Marco Lettere <m.lett...@gmail.com>:
> 
> Hi Rob,
> I suppose that if you add MIXUPDATES=true below #LOCAL OPTIONS in the .basex 
> file that you will find in your basex install directory and restart your GUI, 
> the error will not show up any longer in the GUI itself.
> Regards,
> Marco.
> 
>> On 29/08/2017 15:07, r.stap...@lijbrandt.nl wrote:
>> Hi Michael,
>> 
>> Though the GUI still gives an error onth the use of the apply-function 
>> within an updating function, my webservices do work correctly. Just added 
>> the MIXUPDATES-option in the web.xml file.
>> 
>> Best Rob.
>> 
>>  Oorspronkelijke bericht 
>> Onderwerp: Re: [basex-talk] using apply-function within an updating function
>> Datum: 29.08.2017 08:06
>> Afzender: r.stap...@lijbrandt.nl
>> Ontvanger: Michael Seiferle <m...@basex.org>
>> Kopie: BaseX <basex-talk@mailman.uni-konstanz.de>
>> 
>> Hi Michael,
>> 
>> Th point is that I am looking for a generic solution which I thought I had 
>> found with the use of the apply-function.
>> Most of my webservices take a record with more than one fieldvalue. By 
>> putting the fieldvalues in an json-formatted array on the client side and 
>> the use of the apply-function on the serverside, see [1], I thought I had 
>> found a nice and clean generic solution. Unfortunately this soultion gives 
>> me the error: "Function body must be an updating expression".
>> 
>> The issue is that the error is, in my opinion, falsely triggered by the use 
>> of the apply-function within updating function. An updating-error-situation 
>> should, in my opinion, be determined based on the function that is called by 
>> the apply function. In this case though the apply function calls an updating 
>> function, Basex still triggeres an updating error.
>> 
>> I cann't use MIXEDUPDATES because my webservices are in a module.
>> 
>> I really would like to use the apply-function here. What to do?
>> 
>> [1]
>> declare
>>  %rest:path("/cFactBank/request/new")
>>  %rest:PUT("{$dataRec}")
>>  %input:json("format=map")
>> 
>>  %updating
>>  function _:request.new
>>  ( $dataRec as array(*)
>>  )
>>  {
>>apply( request:new#6
>> , $dataRec
>> )
>>  } ;
>> 
>> 
>> Greetings,
>> Rob
>> 
>> 
>> Michael Seiferle schreef op 28.08.2017 18:20:
>>> Hi Rob,
>>> 
>>> may I ask what you intented to do? Looks like you expect $dataRec to
>>> contain exactly one value, right?
>>> At least I think so because you called `db:create#1` in `fn:apply`
>>> which implies you expect the array to contain a single value.
>>> 
>>> To create a single database use:
>>> 
>>>> ```
>>>> db:create($dataRec => array:get(1))
>>>> ```
>>> 
>>> …or… if you want to create a database for each of the array
>>> values:
>>> 
>>>> for $db in ($dataRec => array:flatten()) (: Flatten array to a
>>>> sequence :)
>>>> return db:create($db).(: create one
>>>> database per array item :)
>>> 
>>> …and… last but not least, for "Dynamic Updating Function
>>> Invocation“[1] you might use:
>>> 
>>>> let $create  := db:create#1
>>>> for $db in ($dataRec => array:flatten())
>>>> return invoke updating $create($db)
>>> 
>>> I could not wrap my head around using array:for-each(#2) and dynamic
>>> updating function invocation; this could make for a more readable
>>> solution, but I can not seem to get the syntax right; if we already
>>> fully support it at all ;-)
>>> 
>>> I hope I did not get you all wrong, feel free to ask for more help!
>>> ;-)
>>> 
>>> Best
>>> Michael
>>> 
>>> [1]
>>> https://www.w3.org/TR/xquery-update-30/#id-dynamic-updating-function-invocation
>>>  
>>> 
>>>> Am 28.08.2017 um 16:42 schrieb r.stap...@lijbrandt.nl:
>>>> 
>>>> Hi,
>>>> 
>>>> I want to use the apply function within an updating webfunction,
>>>> see[1]
>>>> How can this be done?
>>>> 
>>>> TIA,
>>>> 
>>>> Rob Stapper
>>>> 
>>>> [1]
>>>> declare
>>>> %rest:path("/cFactBank/dbCreate")
>>>> %rest:PUT("{$dataRec}")
>>>> %input:json("format=map")
>>>> 
>>>> %updating
>>>> function _:cFactBank.dbCreate
>>>> (  $dataRec as array(*)
>>>> )
>>>> {
>>>> apply( db:create#1
>>>> , $dataRec
>>>> )
>>>> } ;
> 
> 


Re: [basex-talk] using apply-function within an updating function

2017-08-28 Thread Michael Seiferle
Hi Rob,

may I ask what you intented to do? Looks like you expect $dataRec to contain 
exactly one value, right? 
At least I think so because you called `db:create#1` in `fn:apply` which 
implies you expect the array to contain a single value.

To create a single database use:

> ```
>   db:create($dataRec => array:get(1))
> ```

…or… if you want to create a database for each of the array values:

> for $db in ($dataRec => array:flatten()) (: Flatten array to a sequence :)
> return db:create($db).(: create one database per 
> array item :)

…and… last but not least, for "Dynamic Updating Function Invocation“[1] you 
might use:

> let $create  := db:create#1
> for $db in ($dataRec => array:flatten())
> return invoke updating $create($db)

I could not wrap my head around using array:for-each(#2) and dynamic updating 
function invocation; this could make for a more readable solution, but I can 
not seem to get the syntax right; if we already fully support it at all ;-)


I hope I did not get you all wrong, feel free to ask for more help! ;-)

Best
Michael


[1] 
https://www.w3.org/TR/xquery-update-30/#id-dynamic-updating-function-invocation 


> Am 28.08.2017 um 16:42 schrieb r.stap...@lijbrandt.nl:
> 
> Hi,
> 
> I want to use the apply function within an updating webfunction, see[1]
> How can this be done?
> 
> TIA,
> 
> Rob Stapper
> 
> [1]
> declare
>  %rest:path("/cFactBank/dbCreate")
>  %rest:PUT("{$dataRec}")
>  %input:json("format=map")
> 
>  %updating
>  function _:cFactBank.dbCreate
>  (  $dataRec as array(*)
>  )
>  {
>apply( db:create#1
> , $dataRec
> )
>  } ;



Re: [basex-talk] Donation link does not work.

2017-03-17 Thread Michael Seiferle
Hi Tomasz,

thanks for the kudos and thanks even more for your hint, we clearly overlooked 
that one!

The donate link has now been fixed, it will lead you to: 
https://www.paypal.me/BaseXGmbH 

Thanks again!

Michael

> Am 16.03.2017 um 18:51 schrieb Tomasz Kosiński 
> :
> 
> Hello,
> 
> I wanted to show a sign of appreciation to the work you are doing with BaseX, 
> which is in my opinion an exceptionally well done XML database which helped 
> me dozen of times by doing data analysis on large XML data sets.
> 
> But the donation link on your page leads to nowhere.
> 
> -- 
> 
> Best regards
> 
> Tomasz Kosiński
> TestLab Services Tomasz Kosiński
> 
> P: +48 602247984   S: maqmanahan
> 
> 
> NIP: 6721889805
> 
> 
> 
> 
> 
> -- 
> 
> Best regards
> 
> Tomasz Kosiński
> TestLab Services Tomasz Kosiński
> 
> P: +48 602247984  S: maqmanahan
> 
> 
> NIP: 6721889805
> 
> 




Re: [basex-talk] Simple query

2017-03-09 Thread Michael Seiferle
Hi Aaron, 

welcome to the list!

For BaseX to „open“ a collection you need to address it by URI; in your case no 
URI is present, so BaseX loads the „default collection“ which is set to the 
currently opened database (I guess you have none open :—)):


So usually you want to address your collection by name:
> for $foo in collection(‚myFoos‘)
> …
> return $foo

Where each $foo resembles a document inside your collection.
In BaseX a collection usually resembles a database, so your first step would 
be: 

- Create a database that either is a single document or contains multiple 
documents

So in SQL lingo I’d say you are basically missing your FROM ‚…‘ :-)

A good read might be: http://docs.basex.org/wiki/Databases 
<http://docs.basex.org/wiki/Databases> it shows the various ways of creating, 
returning and querying documents / collections :-)



Best
Michael
> Am 09.03.2017 um 00:30 schrieb Aaron Weber <awe...@comcast.net>:
> 
> Newbie alert. 
> 
> I'm trying to get my feet wet with BaseX, and in doing so, am trying to 
> understand XQuery and how to apply it to a database full of documents (not 
> just a single document that is typically queried). 
> 
> I am using Java and can post my code, but with a LocalSession, and a query, 
> the following produces 0 results. 
> 
> For $doc in collection() return $doc
> 
> I realize there's no "where", and in the sql world that would match all. 
> Maybe not in XQuery? 
> 
> Obviously just a test query, but I need to start somewhere. :-)
> 
> Thanks for any help! 
> -- 
> AJ


--
Michael Seiferle, BaseX GmbH, http://www.basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Fon: +49 7531 916 82 77



Re: [basex-talk] Cross-Origin Resource Sharing ( CORS) not available in jetty version 8

2017-02-25 Thread Michael Seiferle
Hi Rob, 

in addition to Christian’s mail, one more thought:

Great, angular2, haven’t had more than a brief look at it so far :-)

I guess you are using that NodeJS-application to serve and generate your 
AngularJS-files, right? Or are there any other reasons you need NodeJS for?

If you only need to serve your static files, you may as well use BaseX to serve 
static contents and put all (e.g. symlink) Angular related stuff to your 
`webapp/static`-folder.

The documentation is here: 
http://docs.basex.org/wiki/Web_Application#Available_Services 

An example can be found  here 
(https://github.com/BaseXdb/basex/tree/master/basex-api/src/main/webapp 
) , 
there is a static folder that will be mapped to localhost:8984/restxq/static


If by any means you need the NodeJS Server next to RestXQ a possible solution 
might be proxying the requests from NodeJS to your BaseX instance; so from the 
Browsers perspective all requests are sent to localhost:3000 :-)
I used https://www.npmjs.com/package/express-http-proxy 
 to redirect all request to 
http://localhost:3000 /restxq ->  
http://localhost:8989/restxq/ 

If you can not modify your NodeJS-service you might have a look at 
https://github.com/gr2m/CORS-Proxy:  it 
provides out-of-the-box CORS headers for arbitrary URLs

Lots of options for these OPTIONS headers ;-)

Hope this helps a bit.

Best from Konstanz

Michael 


P.S. in production it’s usually beneficial to have only a single web-server 
face the world

> Am 25.02.2017 um 09:34 schrieb Rob Stapper :
> 
> Hi Christian,
>  
> I’m trying to build a web based frontend with Angular(2) with Basex as 
> backend. 
> Since Angular uses localhost:3000 and basex uses localhost:8984 I need CORS 
> to be activated in the bachend’s jetty-service.
> If I try to activate this by editing the web.xml file I get the message from 
> the jetty that this service is not available.
> Obviously version 8 of jetty does not support CORS. According to the 
> documentation  Jetty 9 should support CORS.
>  
> Is replacing jett 8 with version 9 somewere on the agenda? Or can I do this 
> myself? (new area for me)
> I wouldn’t mind testrunning it.
>  
> TIA,
> Rob Stapper
>  
> PS. I see the request the request being handled and send back by the backend 
> (basex) but it misses the necessary header. Debugging my Angular app in the 
> browser say that CORS-header is missing.




Re: [basex-talk] Cannot access basex instance with latest basex/dba image

2017-02-08 Thread Michael Seiferle
Hi Björn,
hi Max,

yes, we kind of missed that not-so-subtle-change:
Docker basex/dba is now fixed to the DBA that allows remote connections.
https://hub.docker.com/r/basex/dba/ <https://hub.docker.com/r/basex/dba/>

`docker pull basex/dba:latest`

Should bring back that version.

We are currently figuring out ways to bundle the current dba alongsside 
`basex/basexhttp`.

I’ll keep you posted.

Best from Konstanz,
Michael

> Am 01.02.2017 um 14:52 schrieb Maximilian Gärber <mgaer...@arcor.de>:
> 
> Hi,
> this is how it used to be:
> 
> basex/basexhttp : the standard basex distribution for docker
> basex/dba: only the DBA project
> 
> The idea was to have both running independently where you would
> connect from /dba to /basexhttp
> 
> But this does not work anymore since 8.6
> 
> So for the time being, just use basex/dba prior to 8.6
> 
> 
> 
> 
> 2017-02-01 12:21 GMT+01:00 Christian Grün <christian.gr...@gmail.com>:
>> Hi Björn,
>> 
>>> a) Does this mean that since Version 8.6 there is no officially supported 
>>> web interface for basex?
>> 
>> There still is. DBA is still part of BaseX, but it doesn’t provide
>> means to connect remotely.
>> 
>>> b) What is the difference between the basex/basexhttp and basex/dba images? 
>>> (I think the documentation at https://hub.docker.com/r/basex/basexhttp/ is 
>>> now misleading)
>> 
>> Personally, I can’t say anything about Docker. Maybe someone else on
>> the list knows more?
>> 
>> Christian


--
Michael Seiferle, BaseX GmbH, http://www.basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Fon: +49 7531 916 82 77



[basex-talk] Docker run basexhttp and permission issues

2016-08-25 Thread Michael Seiferle
Hi BaseX-Talk, 

in case any of you is using our docker images, in recent builds there seems to 
be a bug related to the ENTRYPOINT and the PARENT mvn Image we are using.

If you encounter the following error message (in fact you should if you docker 
pulled recently ;-)):

> ⇒  docker run basex/basexhttp
> touch: cannot touch ‘/root/.m2/copy_reference_file.log’: Permission denied
> Can not write to /root/.m2/copy_reference_file.log. Wrong volume permissions?

You might want to override the ENTRYPOINT yourself:

> docker run --entrypoint=basexhttp basex/basexhttp


I already proposed a fix but I’d like someone with docker-expertise have a 
look, maybe s/o might want to add her or his 5cts ;-)
https://github.com/BaseXdb/basex/pull/1346 
<https://github.com/BaseXdb/basex/pull/1346>

Best
Michael

--
Michael Seiferle, BaseX GmbH, http://www.basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Fon: +49 7531 916 82 77



Re: [basex-talk] RESTXQ and xsd validation strangeness

2016-05-18 Thread Michael Seiferle
Hi Marco,

this one is not too obvious, yet:

the type of $body is „document-node()“ not element, so what I think happens is 
the following:

> validate:xsd-info($body…
receives a document-node() and somehow* BaseX passes a documents string 
representation to validate:xsd-info(), which happens the be the documents 
base-uri(), hence: "`tmp/basex/POST.xml` could not be found".


I am not 100% sure my explanation is correct, yet you could solve your problem 
by passing the element child of that document-node to the validate function, as 
follows: 

declare
  %rest:path("/testxsd")
  %rest:POST("{$body}")
  %rest:consumes("application/xml")
function page:testxsd($body as document-node()){
validate:xsd-report(
$body/element(),
http://www.w3.org/2001/XMLSchema;>)
};

See this gist for my experiments:

https://gist.github.com/micheee/025ffed4fbb06bc4b4200ab959755e3b


Hope this helps
Michael

* -> somehow means: most probably specified by rules I do not know of ;-)

> Am 13.05.2016 um 09:57 schrieb Marco Lettere <m.lett...@gmail.com>:
> 
> Dear all,
> this question triggers a dejavu in my head and I'm pretty sure this has been 
> discussed some time ago so I'm not sure why it strikes back at us ...
> With the latest snapshot (but with 8.4.4 it's the same) downloaded just few 
> minutes ago I start the basehttp server.
> Then I add the foolowing RestXQ to the restxq.xqm file:
> 
> declare
>  %rest:path("/testxsd")
>  %rest:POST("{$body}")
>  %rest:consumes("application/xml")
> function page:testxsd($body){
>  validate:xsd-info($body, "xsd.xsd")
> };
> 
> I store the following dummy xsd as xsd.xsd in the webapp folder:
> 
> 
> http://www.w3.org/2001/XMLSchema;>
> 
> 
> 
> 
> 
> 
> I invoke the restxq with:
> 
> curl -vd ""  http://localhost:5000/testxsd -H 
> "Content-type:application/xml"
> 
> Getting back the following error:
> 
> Error 400 Stopped at /tmp/basex/webapp/restxq.xqm, 12/20:
> [bxerr:BXVA0002] Validation could not be started: Resource 
> "/tmp/basex/POST.xml (No such file or directory)" not found.
> 
> This happens no matter what xml and what xsd is used. If I change $body with 
>  in the call to validate:xsd-info everything works smoothly ...
> Any ideas?
> Thanks,
> Marco.


--
Michael Seiferle, BaseX GmbH, http://www.basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Fon: +49 7531 916 82 77



Re: [basex-talk] Basex on maven central

2016-05-13 Thread Michael Seiferle
Hello we are currently working on updating maven central as well.

Jagrut investigates the options to do this :-)

Cheers from Lake Constance

Michael
Von meinem iPhone gesendet

> Am 13.05.2016 um 09:00 schrieb Marc van Grootel :
> 
> Hi Lance,
> 
> Just add http://files.basex.org/maven and optionally
> http://xqj.net/maven as additional repositories.
> I don't find this very inconvenient. This repo gets all the latest
> releases and snapshots right out of the oven.
> 
> Not sure why it's not uploaded to Central anymore though.
> 
> Cheers,
> --Marc
> 
> 
>> On Thu, May 12, 2016 at 5:45 PM, Lance Java  
>> wrote:
>> It seems that maven central is not up to date with the latest basex version.
>> I see here that there's only version 7.3.1 whereas on the basex website the
>> latest version is 8.4.4
>> 
>> http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.basex%22
>> 
>> Are there any plans to keep maven central up to date with basex releases?
> 
> 
> 
> -- 
> --Marc


Re: [basex-talk] Load 5GB xml using python

2016-05-09 Thread Michael Seiferle
Hello Henning,

a kind of naive approach might be uploading the file to your server via a 
webservice implementation of your choice (e.g. python).

You could then create a database from that temporary file on the server. This 
way you could avoid „caching“ the file in memory.

You might also consider switching to a RestXQ based approach.
Another option, regardless how you choose to upload the file, that could speed 
up the process would be Zippig the XML before sending it to the server.

Hope this helps! Feel free to ask for more!

Best Michael

> Am 09.05.2016 um 00:01 schrieb Henning Phan <henningp...@hotmail.com>:
> 
> Hello,
> My case:
> 1. A (non technical) user uploads a 5 GB xml which gets parsed by basex
> 2. Does some queries to check and modify some values
> 3. Downloads the modified 5 GB xml back.
> 
> So I'm planning to allow the user to edit their xml through a web application 
> and therefore the user must upload the xml to the web application. I'm using 
> python and when I receive the xml I want to create a database by using the 
> create function from the client API, but the create(name, content) forces me 
> to load the 5GB in memory which it cannot handle.
> 
> I read the java client API which takes a stream unlike the python API. Am I 
> forced to use java?
> 
> What options are there to solve this problem gracefully? Any options that 
> involve Python?
> 
> Thank you for reading this
> 
> - Henning


--
Michael Seiferle, BaseX GmbH, http://www.basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Fon: +49 7531 916 82 77



Re: [basex-talk] nilled() not working

2015-01-15 Thread Michael Seiferle

Dear Ankit,

BaseX is not a schema aware XQuery processor, hence your results.


In BaseX fn:nilled() will always return false.

Element nodes in BaseX will always be untyped, see for instance:
http://www.w3.org/TR/xpath-datamodel-30/#ElementNode = Property 11 and
http://www.w3.org/TR/xpath-functions-30/#func-nilled = in the notes.
So with respect to the specification fn:nilled() is working correctly, 
however it fails to live up to the expectations :-)


You can, nevertheless, mimic the fn:nilled() behavior, using this custom 
function I hacked together for you:

https://gist.github.com/micheee/b16586464b895f08ddfb

Depending on what you need, this might work just well.

Hope this helps.

Best from Constance,

Michael

P.S.The example code in my function has been shamelessly adapted from: 
http://www.xqueryfunctions.com/xq/fn_nilled.html :-)



On 15 Jan 2015, at 11:11, ankit kumar wrote:

I am trying to run fn:nilled() function in base-x, but every time a 
node
with xsi:nil=true is passed to the function it return false. Please 
help

me out.


Re: [basex-talk] Editor Background Color

2014-12-18 Thread Michael Seiferle
Hi Alex,

currently there is no way (at least no way that I am aware of :-)) to customize 
the background color of the various editor panels from *inside* BaseX, maybe 
your OS or window manager might do that.

I think it might need quite some time to provide a dark-theme, as one would 
need to update the syntax highlighting code as well.

However, I might be interested in this feature as well :-)


Best
Michael

On 18 Dec 2014, at 2:16, Christian Grün wrote:

 Hi Alex,

 I know that one of our team members is using BaseX with a dark desktop
 theme (on Mac OSX), so he might give you some hints.

 Could you possibly give us some more information on your environment?
 What OS do you use?

 Thanks,
 Christian


 On Thu, Dec 18, 2014 at 12:22 AM, Alex R. Loayza log...@yahoo.com wrote:
 Hello,

 I’m new to BaseX, and I’m trying to customize the GUI, by changing the
 background color of the Editor  panel. I always use dark themes in IDEs
 because bright whites hurt my eyes.

 However, I’ve found no way to change that setting in Base X. The Options /
 Colors setting in the main menu effects changes to panels other than the
 Editor.

 Is there a way to customize this?

 Thank you very much for any help, and especially for having built this great
 product and making it open source!

 Best regards,

 Alex



smime.p7s
Description: S/MIME digital signature


Re: [basex-talk] Paged results

2014-08-18 Thread Michael Seiferle

Hi Paul,

thanks for this snippet!
Have you already seen the built-in min/max functions?

max((1,2,3)), min((1,2,3))
Might save both, some bytes and milliseconds, neglectable but 
nevertheless. :-)



Best from Konstanz

Michael
On 15 Aug 2014, at 22:02, Paul Swennenhuis wrote:


Hi all,

Triggered by a thread in this forum I decided to make a paged() 
function that adds paging information to a node-set.
It does so by wrapping the node-set in an root element - with a name 
of your choice - with attributes for total number of nodes, 
start-index  requested page-size, actual page-size and end-index.
The last function argument lets you select whether or not to output a 
paged node-set or just wrap the node-set in a root element.


It's not very spectacular but it may be of use if you want to use 
BaseX for paged results or endless scrolling.

Comments are appreciated.

The module with the paged() function:
-
module namespace lib = My Library;

(:
lib:paged adds paging information to a node-set
in order to enable paged results for a web-app
Will return a node with the name as specified in $nodeName
along with total number of nodes ($total), start-index ($start), 
requested page-size ($num), actual page-size ($displayed)
and end-index ($end) as attributes, followed by the subsequence of the 
node-set


Collection MUST be a node-set (i.e. must NOT have a root element)

If $doPaged argument is false(), only the root node with the original 
collection is returned
The parameter makes it easier to do a non-conditional call of the 
function on a node-set


:)

declare function lib:paged ($collection, $nodeName, $start, $pageSize, 
$doPaged) {

let $total := count($collection)
let $min := lib:max(lib:min($pageSize,lib:min($total,$total - $start + 
1)),0)

return
 element {$nodeName} {
   if ($doPaged) then (
attribute total {$total},
attribute start {$start},
attribute pageSize {$pageSize},
attribute actualPageSize {$min},
attribute end {$start + $min - 1},
subsequence($collection, $start, $pageSize)
 )
   else
$collection
 }

};

(: Return smallest of two numbers :)

declare function lib:min($a,$b) {
if ($a  $b) then $a else $b
};

(: Return largest of two numbers :)

declare function lib:max($a,$b) {
if ($a  $b) then $a else $b
};




Usage example:

---

import module namespace lib=My Library at library.xqy;

lib:paged(collection(Facts)//city, 'cities', 500, 300, true())



Paul


Re: [basex-talk] What is the best way to implement an async REST method?

2014-07-16 Thread Michael Seiferle

Hi Marc,

I actually think this could be done manually using RestXQ.

You could maybe with something like this:

client issues request to start a long running job:
1) restxq/start/long-running-job - returns job id 'Foo'


Every n-seconds the client asks:
2) restxq/is-job-running?job-id=Foo
	- either redirects to restxq/is-job-running?job-id=Foo iff job 'Foo' 
is still running
	- or redirects to restxq/the-job-is-done iff job 'Foo' has stopped 
running


Obviously this kind of polling is neither an asynchronous nor the most 
beautiful (yet, at the moment the only) way to do it.


Personally I'd like to see support for 
http://www.html5rocks.com/en/tutorials/websockets/basics/ Websockets, 
this way RestXQ could notify the client once something is finished.
This would be true async communication and feel a lot better to deal 
with.



More opinions on this topic are very welcome :-)

Best
Michael

On 15 Jul 2014, at 17:21, Marc van Grootel wrote:

How would you implement an async REST pattern? I don't remember having 
seen
anything that makes me do this using plain XQuery. Does this mean the 
only

way to tackle this would be via Java and events maybe?

I would post to a URL, this URL would accept the post and return a
temporary URL where I can check the status of my request, then once 
it's
ready this temp URL will redirect me to the location of the real 
resource.
That's the gist of the async REST pattern that I would like to 
implement.


What would be the best approach to experiment with this?

--Marc


Re: [basex-talk] 7.8.2 application on Mac OS X

2014-04-24 Thread Michael Seiferle
Hi James,

my bad!
I forgot to fix the 7.8.2 bundle; the „latest“ bundle should already work for 
you: 
 http://files.basex.org/releases/BaseX-latest.app.zip

I’ll try to update the 7.8.2 bundle this evening! I’ll let you know once this 
happened.

Best
Michael
Am 23.04.2014 um 15:33 schrieb James Ball basex-t...@jamesball.co.uk:

 Hello,
 
 Is anyone else having problems with the BaseX 7.8.2.app.zip file on Mac OS X 
 (downloaded from the BaseX site)?
 
 When I unzip the file I get a no entry sign over the application icon and 
 launching the application gets an ‘You can’t open the application 
 BaseX782.app” because it may be damaged or incomplete.’
 
 I think the name of the application should be BaseX.app rather than 
 BaseX782.app so I think the packaging has gone wrong somewhere.
 
 Inside the package is a file called EMPTY and a BaseX.app - but this doesn’t 
 launch for me either.
 
 Many thanks, James
 
 -
 James Ball
 




smime.p7s
Description: S/MIME cryptographic signature


Re: [basex-talk] whitespace around comments

2013-04-05 Thread Michael Seiferle
Michael (other than me :-)) you are obviously right.


—
Mit freundlichen Grüßen
Michael Seiferle

On Fri, Apr 5, 2013 at 12:29 PM, Michael Piotrowski m...@cl.uzh.ch wrote:

 Dirk,
 On 2013-04-05, Dirk Kirsten d...@basex.org wrote:
 You are certainly right that with mixed content and the example you have
 given here chopping does make a semantic difference.
 However, you can disable this behaviour so BaseX does what you want. So the
 only reason I see why one should change the default behaviour would be
 because the default is not confirmant to some XML standard. However, I can
 not find any specifics in the spec about which is the expected behaviour,
 so in my opinion BaseX is doing nothing wrong here.
 Well, if you agree that chopping may alter the semantics of a document,
 wouldn't you agree that applying such a transformation *by default* is a
 bad idea?
 With respect to the XML specification, section 2.10 White Space
 Handling says:
   An XML processor MUST always pass all characters in a document that
   are not markup through to the application.
 Yes, the spec is vague wrt. to whitespace handling, and the existence of
 the xml:space attribute shows that different behaviors--including
 potentially corrupting ones--are possible.  I would therefore interpret
 the spec to mean that by default all characters should be preserved, but
 that other behaviors are possible.
 I see that this behaviour might be surprising for some users, but this
 might as well be the case if it were the other way round.
 No, because their documents wouldn't be corrupted.  You can easily
 remove all whitespace afterwards if you decide you don't need it, but
 once it's gone, it's gone and cannot be restored.  That's the problem.
 Additionally, if we would change this now it would break application
 code and unless there is a good reason (i.e. BaseX is actually doing
 something wrong or non-compliant) I don't see why one should change
 the default.
 Well, I'm not on a crusade or anything, so if you believe that it's a
 good idea to corrupt, by default, all documents containing mixed content
 on import, or if this behavior must be kept for compatiblity, so be it.
 I just wanted to point out that whitespace chopping may, in fact, alter
 the semantics of documents--it's not as harmless as it may seem.
 Best regards
 -- 
 Dr.-Ing. Michael Piotrowski, M.A. m...@cl.uzh.ch
 Institute of Computational Linguistics, University of Zurich
 Phone +41 44 63-54313 | OpenPGP public key ID 0x1614A044
 * OUT NOW: Natural Language Processing for Historical Texts
 * http://morganclaypool.com/doi/abs/10.2200/S00436ED1V01Y201207HLT017
 ___
 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] Pathname of the current XQuery?

2013-04-04 Thread Michael Seiferle
Thanks Liam, 
you are right, the shortest way to achieve should be the following:

 let $path-to-query-file := base-uri(_/)


Best from Konstanz

Michael

Am 02.04.2013 um 05:36 schrieb Liam R E Quin l...@w3.org:

 On Mon, 2013-04-01 at 13:36 -0400, Graydon Saunders wrote:
 
 I'd like to be able to say something like
 
 let $decisionSchema :=
 concat(string-join(tokenize(get-query-path(),'/')[position() ne
 last()],'/'),'/decisions_schema.xsd')
 
 only I can't figure out what get-query-path() is.
 
 For many Query engines it won't be defined.
 
 You could try constructing an element and asking for its base URI I
 suppose.
 
 Liam
 
 -- 
 Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
 Pictures from old books: http://fromoldbooks.org/
 Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
 
 ___
 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] Unable to integrate with oxygen to run xquery

2012-11-22 Thread Michael Seiferle
Hi Alex, 

I can only help you with two quick guesses at the moment: 

1)
  port  8080
looks like a kind of HTTP Port; the server by default runs on port: 1984 does 
this change anything?


2) does changing your query to: 
  let $content := //MessageHeader
  return $content[1]

change anything?

I just tried to set up the oxygen integration as depicted in our wiki and it 
worked on Mac OS,  using the 7.3 ZIP and the XQJ Drivers found @xqj.net
I know this it works on my machine probably does not help you much, but I am 
confident we can find the cause of your problem :-)

Best
Michael

Am 22.11.2012 um 00:47 schrieb Alex Muir alex.g.m...@gmail.com:

 Same response...
 
 On Wed, Nov 21, 2012 at 6:26 PM, Christian Grün christian.gr...@gmail.com 
 wrote:
  let $content := //MessageHeader
  return $content
 
 You could try to directly address the database in your query:
 
 let $content := db:open('DDEX')//MessageHeader
 return $content
 
 Does this help?
 Christian
 ___
 
  I've got basex set up using jetty and can query within the firefox browser
  to return data for example using the url
 
  http://localhost:8080/rest/DDEX?query=//MessageHeader
 
  however my equivalent oxygen xquery does not return data and rather
  continues to run not stopping
 
 
  I've recently downloaded the jars and configured the Data Source Drivers as
  per the http://docs.basex.org/wiki/Integrating_oXygen
 
  file:/mnt/xslt_volume/i4EnrichV7/analysis/resources/libs/basex-xqj-1.2.3.jar
  file:/mnt/xslt_volume/i4EnrichV7/analysis/resources/libs/xqj-api-1.0.jar
  file:/mnt/xslt_volume/i4EnrichV7/analysis/resources/libs/xqj2-0.1.0.jar
 
  In the basex  connection which is enabled I've got the following settings
 
  port  8080
  databaseNameDDEX
  logLevel
  description
  loginTimeout6000
  serverName localhost
  user admin
  password admin
 
  I
   set up a trasformation scenario with  BaseX transformer with the following
  xquery
 
 
 
 
 -- 
 -
 
 Alex G. Muir
 Software Engineering Consultant
 Linkedin Profile : http://ca.linkedin.com/pub/alex-muir/36/ab7/125
 Love African Kora Music? Take a moment to listen to Gambia's - Amadu Diabarte 
  Jali Bakary Konteh www.bafila.bandcamp.com Your support keeps Africa's 
 griot tradition alive... Cheers!
 
 ___
 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] id function in BaseX

2012-10-31 Thread Michael Seiferle
Hi Massimo,
Hi Ben, 

BaseX has no direct support for extracting the information, that for a given 
document the ID is renamed to @key (even with help of a DTD).
This is why those example queries fail to function as expected. BaseX will 
however work if the ID attribute is named @id. 

Long story short: you can mimic this behaviour, which you might have already 
known by running:
 declare function local:id($id as xs:string,
   $nodes as node()){
   $nodes//*[@key = $id]
 };
 local:id(M4M05, .)

or if you do not want to wrap it in a function, 
 //*[@key = M4M05]


Hope this helps
Michael


Am 29.10.2012 um 19:22 schrieb Ben Companjen bencompan...@gmail.com:

 This is just a guess, but did you include the DTD? As the document
 says: Notice that the id() functions works only if you have properly
 declared the ID and IDREF attributes in the document DTD.
 
 Ben
 
 On 29 October 2012 13:49, Massimo Franceschet
 massimo.francesc...@uniud.it wrote:
 Hi.
 
 I'm trying to use the XPath id function with BaseX (GUI interface) with no 
 success. For instance, I'm querying the bibliographic XML document found at 
 http://users.dimi.uniud.it/~massimo.franceschet/caffe-xml/xpath/xpath-syntax3.html
  with the id queries written below in this page, for instance, id(M4M05). 
 The query is parsed correctly by BaseX but the result is always empty.
 
 Cheers,
 
 Massimo Franceschet
 ___
 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] id function in BaseX

2012-10-31 Thread Michael Seiferle
Hi Massimo, 

sorry, I'm a little in a hurry:
The spec states: 
 http://www.w3.org/TR/xpath-datamodel/#dm-is-id
 Exactly what constitutes an ID depends in part on how the data model was 
 constructed, see 6.2 Element Nodes and 6.3 Attribute Nodes.
which says: 
 is-id
 If the attribute is named xml:id and its [attribute type] property does not 
 have the value ID, then [xml:id] processing is performed. This will assure 
 that the value does have the type ID and that it is properly normalized. If 
 an error is encountered during xml:id processing, an implementation may raise 
 a dynamic error. The is-id property is always true for attributes named 
 xml:id.

as BaseX does not check/care for the types when parsing, we follow: 
 The is-id property is always true for attributes named xml:id.

I hope I read the spec right; others will correct me :-)

Best
Michael
Am 31.10.2012 um 14:44 schrieb Massimo Franceschet 
massimo.francesc...@uniud.it:

 
 Il giorno 31/ott/2012, alle ore 14:39, Michael Seiferle ha scritto:
 
 Hi Massimo,
 Hi Ben, 
 
 BaseX has no direct support for extracting the information, that for a given 
 document the ID is renamed to @key (even with help of a DTD).
 This is why those example queries fail to function as expected. BaseX will 
 however work if the ID attribute is named @id. 
 
 Thanks Michael, this explains the failure. Strange behavior, anyway. I know 
 that ID-type attributes can have any name, not necessarily the name id. Is 
 BaseX behavior coherent with W3C specifications?
 
 Best,
 
 Massimo

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


Re: [basex-talk] running xquery scripts in REST server

2012-10-19 Thread Michael Seiferle
Hi Peter, 
sorry I did not manage to answer you earlier :-)
 
As a quick hint, could you please try the following:
* put your query file into the filesystem as described in 
http://docs.basex.org/wiki/REST 
* Please note, that in 7.3 the variable WEBPATH has been called HTTPPATH (I 
hope this does not add to the confusion ;-))

Apart from that, I can only encourage you to have a look at RestXQ as it is 
most flexible in my opinion for running XQuery server-side and empowering not 
only rest service but interactive website as well. 
= http://docs.basex.org/wiki/RESTXQ

Hope this helps!

Kind Regards
Michael
Am 17.10.2012 um 10:50 schrieb p...@themail.co.uk:

 
 Hello List
 
 this is a noob question:
 
 I have BaseX 7.3 set up using httpserver.  I can add a script to
 HTTPPATH and run it using http://{server:port}/rest?run=myScript.xq
 
 However, if I add myScript.xq to a database and try to run it then
 [http://{server:port}/rest/DB/myScript.xq ] then all I get returned
 is the XQuery script itself as a text file, the query doesn't run.
 
 From the examples e.g. http://docs.basex.org/wiki/REST#GET_Requests_2
 I thought that I am doing the same type of call, e,g,
 http://localhost:8984/rest/DB/mult.xq?a=21b=2 
 
 What should I be doing?
 
 Many thanks
 
 Peter
 
 
 
 
 
 
 ___
 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] Bug in db:rename()

2012-10-17 Thread Michael Seiferle
Dear Charles, 

Thank you very much for your report; and sorry for this inconvenience. 
Someone of our team will have a look and we will get back to you ASAP.

Best
Michael

Von meinem iPad gesendet

Am 16.10.2012 um 22:23 schrieb Charles Kowalski alxa...@gmail.com:

 On 10/16/2012 11:20 PM, Charles Kowalski wrote:
 Hi,
 
 Upon executing:
 
 db:rename('dbname', '', 'path')
 
 All database data was put under a root collection named 'ath' not the
 expected 'path'.
 
 The first letter gets chopped, something to do probably with string
 manipulation and zero string length.
 
 Thanks,
 alex
 To correct my previous description the first letter of every *child* path 
 gets lost
 
 db:replace('db', 'test.xml', root/)
 db:rename('db', '', 'renamed')
 
 results in:
 'renamed/est.xml'
 
 Thanks,
 alex
 ___
 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] Using full Java regular expressions

2012-10-15 Thread Michael Seiferle
Hi Gary, 

not directly a flag, but you are for sure able to use Java classes from within 
BaseX like so https://gist.github.com/c72fad2758af668eb0f1

More information on our Java Bindings can be found here: 
http://docs.basex.org/wiki/Java_Bindings

I hope this helps, feel free to ask for more help =)

Michael
Am 13.10.2012 um 16:10 schrieb The Trainspotter wy...@btinternet.com:

 Hi,
 
 I'm currently converting my project to use BaseX instead of Saxon. One thing 
 you can do in Saxon is provide a flag (an exclamation mark) to your regular 
 expression to tell the matches function to use the Java regular expression 
 processor, rather than the rather cut down expressions available in the 
 XQuery spec.
 
 Is there anything similar in BaseX? 
 
 If not what do you recommend to define a Java regular expression based 
 function for XQuery?
 
 Thanks in advance,
 Gary
 ___
 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] Using full Java regular expressions

2012-10-15 Thread Michael Seiferle

Am 15.10.2012 um 15:35 schrieb The Trainspotter wy...@btinternet.com:

 Is this switch something I could request as an enhancement,
Yes
 if so could I expect it to be implemented any time soon?
 
...not necessarily as I can not promise that someone will jump on this train 
anytime soon.
BUT it is for sure the first step towards completion :-))

Hope this helps
Michael


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


Re: [basex-talk] Navigating a DOM

2012-10-15 Thread Michael Seiferle
Hi there, 

just for the sake of completeness, my 2cents:
Am 15.10.2012 um 16:53 schrieb Rainer Klute rainer.kl...@itemis.de:

 As far as I am aware, Sedna is
 actually ideal for storing huge single file XML documents.
I am not sure if Sedna is better suited or not, but this is out of topic anyway 
:-).
 Would be a nice try if Sedna could run on Android. But it is in C and
 not Java, so …
I don't think the actual problem is storage or processing, but your application 
demanding for DOM like navigation and lazy loading of Elements.
This is indeed out of BaseX’ scope (at least at the moment) as far as I can 
see. 

I do not know your specifics, but I'd suggest you should at least consider 
giving BaseX (or any XML database for that matter) a try.

It’s rather easy and quick to extract only portions of a document and load 
other parts on demand. Usually even with documents of several gigabytes in 
size, thanks to indices, performance mainly depends on how much data you want 
and need at a given time.

But anyway, my reply is just for the sake of completeness, feel free to pursue 
whichever approach feels best for you and solves your problem :-)

Kind regards
Michael

P.S. (bold claims following ;-))
I doubt that a non disk persisted tree representation— such as XOM or SAX— is 
able to beat an XML database when it comes to tasks other than serializing the 
whole document, and even there most databases might be well on par as 
serializing the on disk representation should be straight forward.
XOM in their documentation states that you should not consider using XPath, as 
performance may degenerate. 
So deciding for or against XOM depends heavily on what you actually want and 
need :-)___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Navigating a DOM

2012-10-15 Thread Michael Seiferle
Hi Rainer,
 I am in fact not sure if such an API  exists; at least to my knowledge it does 
not.

Thanks for the valuable input and fruitful discussion so far :-)

Feel free to keep in touch and this thread alive. 
Feedback and questions are always very welcome!

Best 
Michael
Am 15.10.2012 um 19:12 schrieb Rainer Klute rainer.kl...@itemis.de:

 Well, since I won't get this
 lazy-loading-while-navigating-a-DOM-thingy anywhere, I'll have to
 reconsider my system architecture and find another solution.
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] bug: cancel = shut down

2012-10-04 Thread Michael Seiferle
Hi Cerstin, 

true this is an annoying bug—you are running Mac OS X I assume— that will 
eventually be fixed.
I thought we had this on GitHub already, looks like its missing….
well:
 Am 24.04.2012 um 22:27 schrieb Christian Grün christian.gr...@gmail.com:
 
 you stumbled upon one of the issues that are specific to Mac OSX (the
 Cancel button works on all Windows and Linux distributions we are
 aware of). […]
 As I'm one of the few in our group who hasn't switched to Mac.. I'll
 have to pass this on to the others.. Anyone interested in having a
 look at this issue?
I'll add it to our issues on GH now, this won't fix it yet,  but I hope this 
will at least increase the chance of having it fixed sooner than later.

Best from Konstanz
Michael
Am 03.10.2012 um 19:22 schrieb Cerstin Elisabeth Mahlow 
cerstin.mah...@unibas.ch:

 Hi,
 
 when closing BaseX GUI, you will be asked to save edited files. When you 
 click cancel, it shuts down immediately.  Shouldn't it cancel the closing 
 process but not the application?
 
 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 mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] XSLT import with relative path fails

2012-10-04 Thread Michael Seiferle
Hi Alexandros,

thanks for your mail, I will have a look at this. IIRC there is no URI 
resolution on BaseX’ behalf, but maybe the current working directory for Saxon 
is not set to what Saxon expects. 
Out of curiosity, does it work if you use absolute paths in the first place? I 
guess you are calling sth. like xslt:transform($doc, path/to/tei/...)

I'll try to have a look at it this afternoon, I guess this issue might as well 
affect other users. 
If you could provide me with a SSCE that can be run easily that would be great 
but not a necessity.

Cheers
Michael

Am 02.10.2012 um 16:50 schrieb Charles Kowalski alxa...@gmail.com:

 Hi,
 
 I am trying to use TEI-to-xhtml stylesheet* provided by the tei consortium 
 using the saxon HE transformer.
 The importing of xsl dependencies fails with this error:
 XTSE0165: I/O error reported by XML parser processing file:/../xhtml2/tei.xsl:
   /../xhtml2/tei.xsl (No such file or directory)
 The specific file i try to run is 
 The actual href in the xsl:import is xsl:import 
 href=../../../xhtml2/tei.xsl/
 
 From the error message it looks as if the relative path: 
 ../../../xhtml2/tei.xsl
 is converted to the (non-existent) absolute path: /../xhtml2/tei.xsl 
 
 The same transformation works fine if called from the cli with
 java -jar path/to/saxon9he.jar some-tei.xml 
 path/to/tei-stylesheets/xml/tei/stylesheet/profiles/tei/html/to.xsl
 Is there some sort of url resolution happening on behalf of basex before the 
 xsl is passed to saxon?
 
 I will try to reproduce with a set of less complex xsl files but it seems 
 like the issue lies with relative path resolution.
 
 Thanks, 
 Alexandros
 
 *You can download the latest stylesheets from sourceforge at: 
 http://sourceforge.net/projects/tei/files/Stylesheets/tei-xsl-6.14.zip/download
 ___
 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] large number of xml files

2012-08-21 Thread Michael Seiferle
Hi Sateesh, 

is saw that you sent dirk an XQuery file, is it the same that takes that much 
memory?
In case yes we will see if we can help with that :)
Kind Regards
Michael
Am 20.08.2012 um 14:34 schrieb sateesh sate...@intense.in:

 Hi Michael,
 
 I created the collection of 2k xml's as per your previous mail and tried
 executing the query,even though after creating the collection also the
 memory consumption is high(700MB of heap memory) and also it is taking 3
 mins of time for processing.
 
 Thanks  Regards
 Sateesh.A
 
 -Original Message-
 From: Michael Seiferle [mailto:m...@basex.org] 
 Sent: Monday, August 20, 2012 2:33 PM
 To: sateesh
 Cc: basex-talk@mailman.uni-konstanz.de
 Subject: Re: [basex-talk] large number of xml files
 
 Sateesh, 
 
 sorry I totally overlooked your last email.
 I'll reply inline:
 Am 18.08.2012 um 08:58 schrieb sateesh sate...@intense.in:
 
 
 Hi Micheal,
 
 I have tried to implemet your suggested changes , but I got struck as the
 10k xml's which I have to query on comes from different folders,and also
 one
 more question is how do I create collections using the program before
 running the query.
 XQuery at the moment has no possibility to create a collection on the fly,
 as such you would have to use our Java API  [1] or Commandline API [2].
 
 For creating a collection from different folders you would do as follows:
 create db myDB path/to/files;
  . creates the database coll with all documents found in the input
 directory.
 
 ADD TO target/ xmldir
  . adds all files from the xmldir directory to the database in the
 target path.
 
 
 I hope this helps :-)
 
 Kind Regards
 Michael
 
 
 Thanks  Regards
 Sateesh.A
 
 
 [1]
 https://github.com/BaseXdb/basex-examples/blob/master/src/main/java/org/base
 x/examples/query/CreateCollection.java
 [2] http://docs.basex.org/wiki/Commands
 
 
 

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


Re: [basex-talk] large number of xml files

2012-08-20 Thread Michael Seiferle
Sateesh, 

sorry I totally overlooked your last email.
I'll reply inline:
Am 18.08.2012 um 08:58 schrieb sateesh sate...@intense.in:

 
 Hi Micheal,
 
 I have tried to implemet your suggested changes , but I got struck as the
 10k xml's which I have to query on comes from different folders,and also one
 more question is how do I create collections using the program before
 running the query.
XQuery at the moment has no possibility to create a collection on the fly, as 
such you would have to use our Java API  [1] or Commandline API [2].

For creating a collection from different folders you would do as follows:
create db myDB path/to/files;
   • creates the database coll with all documents found in the input 
 directory.

ADD TO target/ xmldir
   • adds all files from the xmldir directory to the database in the 
 target path.


I hope this helps :-)

Kind Regards
Michael

 
 Thanks  Regards
 Sateesh.A
 

[1] 
https://github.com/BaseXdb/basex-examples/blob/master/src/main/java/org/basex/examples/query/CreateCollection.java
[2] http://docs.basex.org/wiki/Commands
___
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk


Re: [basex-talk] Table visualization of xquery results

2012-08-16 Thread Michael Seiferle
Hi Rob, 

this might be a little detour, but still worth a try:
By using RestXQ [1] you could transform your data to an HTML table and display 
it in any browser. 
E.g. like so:
https://gist.github.com/45cdb78b093fc3d91cac
The htmlize() function will simply rename your elements to math their html 
counterparts.

You may then call this function from whithin RestXQ and see the results in any 
browser :)


Kind regards
Michael

[1] http://docs.basex.org/wiki/RESTXQ
Am 16.08.2012 um 00:02 schrieb Rob Heiser rhei...@gmail.com:

 I'm using BaseXGUI to develop xqueries. The xqueries transform some
 data from the database into XML that will be rendered as a table. Will
 the table visualization view in BasexGUI work this way? My xqueries
 look something like this:
 
 let $dbName := foo
   return
 table
   columns
 columnName/column
 columnChild name/column
   /columns
   rows
   {
 for $item in doc($dbname)/some/xpath
   return
 row
   cell{$item/name/text()}/cell
   cell{$item/child/name/text()}/cell
 /row
   }
   /rows
 /table
 
 The text view of the results look like I expect it to, and using the
 xqueries inside the application I'm developing works once I get them
 written and debugged. I'd like to preview the tables inside BaseXGUI
 if possible, before returning to the IDE and having to run the
 application, if possible. Thanks for any guidance.
 
 -- 
 Rob
 ___
 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] BaseX and eXist XML database differences

2012-08-15 Thread Michael Seiferle
Hi Mailbox, 

obviously we are heavily biased towards BaseX on this list (well at least I am 
:-)).

BaseX can without a doubt be the system powering your website/cms/database.
Our RestXQ [1] implementation will allow you to write web applications in 
XQuery easily and straight-forward.

To help you base your decision, I will provide you with my personal opinion and 
arguments in favor of BaseX (some of them are true for eXist-db as well :-))

* BaseX is light-weight, small and still feature rich
* The dev team is responsive
* the codebase is coherent, slim and can be compiled without any external 
dependencies
* BaseX in general yields excellent overall performance
* the BSD license is very permissive
* our XQuery implementation has a high level of conformance to the standard
* we are usually very quick in implementing features that are added to the 
standard
* we have a increasing number of modules for all kinds of purposes and 
participate in the EXPath [2] Community efforts
* our Open Source developments are backed by a company since April 2012 to make 
sure that BaseX will (a) stay Open Source and (b) become even better :-)

The number of users that base their XQuery applications on BaseX or integrate 
BaseX at some point in their workflows has been continuously growing.

Anyhow, I'll leave the rest up to others on this list, I am sure their decision 
making, challenges and solutions will give you lots of more insight than I can.
We would be glad to welcome you to our family :-)


Kind regards, 
Michael

[1] http://docs.basex.org/wiki/RESTXQ
[2] http://expath.org/
Am 15.08.2012 um 07:59 schrieb mail...@actamail.com:

 Can anyone help me in telling the differences of BaseX and eXist XML 
 databases? I am looking for a native XML database to use for my web content 
 management system and homepage.
 ___
 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] large number of xml files

2012-08-10 Thread Michael Seiferle
Hi Sateesh, 

thanks for the data you sent us.

TL;DR:===

you are querying 1 files ad-hoc (i.e. open, parse and query each file in 
memory).
- solution: create a collection (that contains the files pre-parsed) and query 
that database instance.

===TL;DR:

1) General remarks:
You are comparing node names like so:
 let $cn := $R/*[xs:string(node-name(.)) = $nn]
where node-name(.) constructs a QName, which will then be cast to a xs:string( 
) and compared, 
this can be achieved more easily by using just name() which returns a string.
  let $cn := $R/*[name(.) = $nn]

You have a lot of data($f) calls when you actually only want $f/text() or for 
attributes $f/string() [0]

2) And probably the best solution for better performance:
You are creating in memory document instances on the fly:
 for each file you are opening by iterating through  $fpnode//filepaths/file 
you:
.1 parse it
.2 represent it as an in memory tree
.3 query it.

It would be much more efficient if you create a collection [1] (BaseX will add 
all XML files from your data directory to a collection once) and query the 
files located inside the collection.

I made a small example with 100 copies of your file the query takes 4seconds 
when each XML document is parsed and queried ad hoc.
When I create a collection with 100 copies of your file and run the query it 
takes only ~500milliseconds.

When you created a collection change the line that opens the documents to:
 let $x := doc(collection-sateesh/ || tokenize($f,/)[last()] )
which does the following:
The
 tokenize($f,/)[last()]
takes your path attributes like c:/data/abc.xml and returns the filename (the 
part after the last() slash).
the `||` operator concatenates it, so we open each document of your collection 
that is referenced in the filenames and run your remaining query unchanged.

I'll send the updated XQuery file privately so you can have a look.

Kind regards
Michael

[0] https://gist.github.com/faecd677274ac6ac7770
[1] http://docs.basex.org/wiki/Databases
Am 10.08.2012 um 09:24 schrieb Michael Seiferle m...@basex.org:

 Hi Sateesh, 
 
 
 I have a requirement of querying on large number of xml files some where 
 around 10,000 xml files , I have written the query and while executing the 
 query it is taking huge amount of memory and time some where around 700mb 
 memory and time around 4 -5 minutes .Is there a way to execute the query 
 with less memory and with in short time.
 Probably yes, but this depends on your query.
 Could you provide some example Code and maybe one of you 10k XML files? In 
 case you do not want to send them to the list, use supp...@basex.org for the 
 attachments.
 
 Kind regards
 Michael

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


Re: [basex-talk] Counting groups

2012-07-17 Thread Michael Seiferle
Hi Pascal, 

maybe you already tried that; but:

let $somethings :=  for $varGrp at $pos in local:getVariables($from,$to)
  group by $name := string($varGrp/@name)
  return Something/
for $something at $pos in $somethings
return...

Hope this helps, this is the best I can think of at the moment :)

Kind regards
Michael
Am 17.07.2012 um 13:29 schrieb Pascal Heus:

 All:
 In a group by query expression like 
   for $varGrp at $pos in local:getVariables($from,$to)
   group by $name := string($varGrp/@name)
   return Something/
 is there any way to get a value or position for the group count? 
 
 In my particular use case, I used this to generate an HTML table and I would 
 like to repeat the header every 20-30 rows (group). The at $pos variable 
 can't be used as it holds a sequence  of positions of the group members 
 (which is what it's supposed to). 
 
 Any suggestion appreciated.
 best
 *P
 
 
 
 
 ___
 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] recusive subdirectory suggestion

2012-07-13 Thread Michael Seiferle
Dear Kurt, 

thanks for the Kudos and thanks for your suggestion as well. 
As a quick solution you could do the following (entirely in XQuery ;-)): 

Use file:list($dir, false(), *.xml) [1] to retrieve a sequence of files 
without recursing into a subdirectory.
Then either
(1) Iterate over this sequence and perform your analysis on the fly
or
(2) create a database containing only the matching files and perform 
the analysis afterwards

For (1) and (2) see this GIST: https://gist.github.com/8488e895c5f73ac4de49

I hope this helps :-)

Kind regards
Michael 

[1] http://docs.basex.org/wiki/File_Module#file:list
[2] https://gist.github.com/8488e895c5f73ac4de49

Am 13.07.2012 um 07:35 schrieb Kurt Conrad:

 First, I just downloaded and used BaseX to audit and report a variety of 
 parent contexts across a set of about 2,500 XML documents. It was very 
 painless. Many thanks.
 
 Second, I couldn't find a way to prevent recursive indexing of 
 subdirectories. If the feature doesn't exist, it would be handy. In my case, 
 I had the current set of files in the selected directory and old versions in 
 subdirectories.
 
 Thanks, again.
 
 /s/ kwc 2012.07.12 22:34
 
 ___
 Kurt Conrad
 mailto:con...@sagebrushgroup.com
 www.SagebrushGroup.com
 
 ___
 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] BaseX with a Booleen Column

2012-07-09 Thread Michael Seiferle
Hi Scott, 

just for the sake of completeness I'll resend the email I privately sent from 
supp...@basex.org ;-)

 BaseX is a database that works schema-oblivious, i.e. for the sake of 
 flexibility BaseX does not respect schema types when creating a database.
 But: you are still available to use xs:boolean datatypes, by explicitly 
 casting values to xs:boolean():
 
 I added three examples in this gist for your convenience:
 https://gist.github.com/919c89044265842590ca
 
 
 You can find more information on types in XQuery here: 
 http://www.w3.org/TR/xpath-datamodel/#types-hierarchy
 Data types are usually determined at runtime, so the following will work even 
 though there is no explicit type information in the XML fragment:
 https://gist.github.com/9d0746ca3eaa383c28ab
 
 I hope this helps to clear things up a little.
 
 Kind regards from Lake Constance

Kind regards again :-))
Michael

Am 09.07.2012 um 07:40 schrieb Scott Clayton:

 Hey... I know this may be getting out of the native XML database talk but it 
 would be great if we could add a column and mark as true or false when we 
 grab the data from an external source and mark as gotten.
  
 Anyways...just a thought.  Maybe there is a plugin for this or something to 
 the effect?
  
 Best,
  
 Scott
  
 PS - I sent a similar email to the default contact at BaseX.org site and 
 after I sent it there was a suggestion to send feature inquiries to this 
 email... I could not find that suggextion until after I had already sent the 
 email.
  
 :-)
 ___
 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] Webdav not working on Windows 7 and Basex 7.2.1

2012-06-13 Thread Michael Seiferle
Hi Bob, 

could you perhaps give it a  try with the Zip Distribution [1]?
It has some startup scripts inside the bin folder, anyways those scripts 
contain a minor bug:

In line 10, somewhere in the middle we try to add milton 1.6.5 to the classpath:
 milton-api-1.6.5.jar

actually (unfortunatedly) this should say:
 milton-api-1.7.2.jar
Once I changed this line it works fine here.

In case you feel a little more terminal friendly, you might want to install 
git[2] and maven[3] and do the following:

1) clone the basex-api package from github: 
 git clone git://github.com/BaseXdb/basex-api.git
2) change to the newly cloned basex-api sources:
 cd basex-api
3) build basex-api from source and run the basexhttp services (webdav, rest, 
restxq) 
 mvn jetty:run



Hope this helps a little!

Kind regards
Michael

[1] http://files.basex.org/releases/7.2.1/BaseX721.zip
[2] http://git-scm.com/
[3] http://maven.apache.org/download.html
Am 12.06.2012 um 05:56 schrieb Bob Horvath:

 I am pretty sure the .exe.  If you think it would help, I could try whatever 
 options you think would be relevant.  
 
 Yes, rest and restxq both work. 
 
 Bob
 
 On Jun 11, 2012, at 9:19 PM, Christian Grün christian.gr...@gmail.com wrote:
 
 Hi Bob,
 
 which BaseX distribution are you working with (EXE, ZIP, compiled
 GitHub sources)? If I remember right, you didn't encounter any
 problems with REST/RESTXQ?
 
 Christian
 ___
 
 On Mon, Jun 11, 2012 at 11:49 PM, Bob Horvath b...@horvath.com wrote:
 
 I did try rebooting windows.  No luck.
 
 Another clue perhaps.  When I try it from a browser
 (http://localhost:8984/webdav), I get ...
 
 
 
 HTTP ERROR 500
 
 Problem accessing /webdav. Reason:
 
   com/bradmcevoy/http/ResourceFactory
 
 Caused by:
 
 java.lang.NoClassDefFoundError: com/bradmcevoy/http/ResourceFactory
   at java.lang.Class.getDeclaredConstructors0(Native Method)
   at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
   at java.lang.Class.getConstructor0(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
   at
 org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428)
   at
 org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
   at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
   at 
 org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
   at 
 org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
   at 
 org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
   at org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49)
   at 
 org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
   at org.mortbay.jetty.Server.handle(Server.java:326)
   at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
   at
 org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
   at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
   at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
   at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
   at
 org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
   at
 org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
 Caused by: java.lang.ClassNotFoundException:
 com.bradmcevoy.http.ResourceFactory
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 22 more
 
 Caused by:
 
 java.lang.ClassNotFoundException: com.bradmcevoy.http.ResourceFactory
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.Class.getDeclaredConstructors0(Native Method)
   at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
   at java.lang.Class.getConstructor0(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
   at
 org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428)
   at
 org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
   at 

Re: [basex-talk] XML file with xmlns attribute and XPATH

2012-05-24 Thread Michael Seiferle
Hi Philippe, 

you still have to declare a default element namespace for XQuery (or XPath for 
that matter) to recognize the element you want to return:
 declare default element namespace http://example.org;;
 feed xmlns=http://example.org; xmlns:abc=http://abc.example.org;
  titleProjects/title
 /feed/title
will work as expected.

I see that the solution is not obvious, but from the processors point of view:
* the XML fragment has the http://example.org namespace
* your path expressions don't.

I modified your example slightly to show an alternative way of doing this:
 declare  namespace a = http://example.org;;
 declare  namespace b = http://abc.example.org;;
 feed xmlns=http://example.org; xmlns:abc=http://abc.example.org;
  title abc:test=fooProjects/title
 /feed/a:title[@b:test = foo]

Feel free to ask for more help when needed, 

Michael


Am 24.05.2012 um 04:20 schrieb Philippe Rathé:

 Hello there,
 
 I just want to do a simple xpath expression but I can't get it works
 when I use this XML document
 
 ?xml version=1.0 encoding='utf-8'?
 feed xmlns=http://example.org; xmlns:abc=http://abc.example.org;
  titleProjects/title
 /feed
 
 The expression exquery //title does not return anything from the CLI
 once I open the database containing only that file.
 
 But it works with this file
 
 ?xml version=1.0 encoding='utf-8'?
 feed xmlns=http://example.org;
  titleProjects/title
 /feed
 
 It looks like having both xmlns and xmlns:abc namespace attribute
 creates a problem.
 My real use case is atompub feed document which the 2 first lines
 looks like this:
 
 ?xml version=1.0 encoding='utf-8'?
 feed xmlns=http://www.w3.org/2005/Atom;
 xmlns:app=http://www.w3.org/2007/app;
 
 Any idea?
 I'm using a 7.2.2 snapshot,
 thanks.
 ___
 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] HTTP module

2012-05-03 Thread Michael Seiferle
Hi Erol, 

Thanks for your reply, mines below:-- 
Michael Seiferle
Sent from my mobile, sorry for the brevity.


On Thursday, 3. May 2012 at 20:06, Erol Akarsu wrote:

 Michael,
 
 Thanks for reply.
 
 I think that should be easy to enhance current basex HTTP support to other 
 url types like here file:/// for local html files. 
 
 We will replace with url fetch with local file downloading. 
I guess it would be easy to allow http requests and somehow misuse them for 
local access, on the other hand using tagsoup and the doc() function will allow 
requesting files via both, http or the local filesystem with well defined 
semantics. 

I mean how would you post/put to file://, how will you handle request and 
response headers etc. - http offers a lot of options and means to access 
resources, that can not be mapped to local files without adding another layer 
of indirection, eg WebDAV.

What are your concerns with using doc(file://)  doc(http://), maybe I am 
missing something obvious?

 Isn't it?
Well, imho it depends ;-)
Maybe there are more opinions on our list?
 
 Erol Akarsu
Michael 
 
 On Thu, May 3, 2012 at 2:00 PM, Michael Seiferle m...@basex.org 
 (mailto:m...@basex.org) wrote:
  Hi Erol, 
  hi list, 
  
  I just re-read my last email: the I don't think so-part is a little 
  misleading, I have not read your mail carefully enough I guess.
  
  I was referring to your code example:
   http:send-request(http:request method='get' status-only='false'/, 
   'file:///D:/tmp/b000187585.htm')
  - this is indeed impossible, yet:with Tagsoup on the classpath, HTML 
  parsing is fully supported as pointed out in the wiki.
  
  Sorry for the confusion, had a long day :-) 
  
  Kind regards
  Michael
  
  
  Am 03.05.2012 um 19:42 schrieb Michael Seiferle:
  
   I don't think so; unless you provide a web server running locally, as the 
   HTTP module relies on the http protocol.
 

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


Re: [basex-talk] databases and live demo

2012-05-03 Thread Michael Seiferle
Hi Stefan, 


-- 
Michael Seiferle
Sent from my mobile, sorry for the brevity.


On Thursday, 3. May 2012 at 20:07, k...@buit-solutions.com wrote:

 
  
 
 Hi, 
 
 I'm currently testing baseX and wondering how one should use 
 databases/collections. 
Basically databases in BaseX are either a collection (more than one doc) or 
made of single documents. 
 
 
 I did some testing with the live demo and Query 6: 
  for $pub in doc('dblp')/dblp/* 
  where $pub/author = 'Alexander Holupirek' 
  return $pub/title 
 
 First I was wondering where in collection is. Tried it on my local 
 testmachine with in collection and several other of my testdocuments in the 
 same collection/database and the query took more than 10 seconds compared to 
 100ms in the live demo! 
Performance depends on many circumstances, usually we are trying to optimize 
queries to use indices automatically; but sometimes this may not be smart 
enough ;-)

You could try to compare the query plans, (info view in the GUI) for doc vs 
collection. Index accesses are denoted in the plan.

Have you made sure that the indices are up to date and enabled? This can be 
found in filedatabase properties, iirc

Another option to force index access is the db:fulltext() function, 
http://docs.basex.org/wiki/Database_Module#db:fulltext 

 
 
 Then I found out that you don't need in collection if you have just one 
 document in the database. So I dropped all other documents and tried it 
 again: This time the query took 38ms! 
 Is this intended or am I doing something wrong? When should you use 
 collections/databases? 
In case this problem persists feel free to send a ssce example to 
supp...@basex.org, we'll have a look then! 
 
 
 Are there any hints or best practices how to organize data to get efficient 
 queries?
Thats a tough question and depends a lot on the actual data being stored, but 
most often query rewrites can offer execution times an order of a magnitude 
better :-) 
 
 Krind regards, 
 
 Stefan
Hope this already helps a little

Michael 
 
 ___
 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] BaseX XQuery vs. python / lxml performance

2012-03-29 Thread Michael Seiferle
Hi Ronny, 

Hi Johannes  Charles, thanks for joining the conversation. 


In my opinion, and speaking officially for BaseX, I'd suppose that XML 
processing with BaseX databases should almost always[1] be faster than 
processing the XML sequentially via lxml.

However, performance may vary depending on the actual queries and/or the python 
glue code. 

I think Charles' approach of having as much logic in XQuery as possible will be 
the best option to pick here.
Maybe some of your Python code could as well be rewritten in XQuery, on the 
other hand this might not even be necessary due to XQuery rewrites as Johannes 
suggested.

@Ronny, maybe you could provide us with some sample code? In case it is not 
intended for the general public feel free to send it to supp...@basex.org.

Looking forward to seeing your code!

Viele Grüße vom Bodensee

Michael 

[1] I can sure think of examples that prove me wrong ;-)
Am 28.03.2012 um 23:19 schrieb Johannes.Lichtenberger:

 Thus I suppose it
 would be the best to write the queries in a reply, such that the BaseX
 team can make suggestions for similar queries which better utilize
 index-structures and the query optimizations from the query processor.

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


Re: [basex-talk] Query

2012-03-06 Thread Michael Seiferle
Hallo Carsten, 

klar:
 xmlDas was ich will/xml/text()
Der Text Step. 

Freundliche Grüße
Michael
Am 06.03.2012 um 11:32 schrieb chau...@arcor.de:

 Hallo!
 
 gibt es eine Möglichkeit in der GUI eine Query so zu formulieren, dass als 
 Ergebnis *nicht* so was rauskommt:
 
 xmlDas was ich will/xml
 
 sondern so was:
 
 Das was ich will
 
 Viele Grüße
 
 Carsten
 ___
 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] export xml using xquery in php

2012-02-02 Thread Michael Seiferle
Hi Nafiz, 

I guess you could use the built in EXPORT command. 

 $session-execute('OPEN myDB; EXPORT path/to/export.xml;CLOSE myDB;')

This snippet is untested, but should work. 

Another (again untested :-)) approach might be: 

file_put_contents( 
$filename, 
$session-execute('XQUERY doc(myDB)')
);

Hope this helps :-)

Kind Regards
Michael
Am 02.02.2012 um 11:06 schrieb Nafiz Al Naharul Islam Grameenphone IT Ltd.:

 Dear all,
  
 I need help to export xml file using xquery in php.
  
 Regards,
  
 Nafiz -Al Naharul Islam
 
 The information contained in this email and any attachment(s) to this email 
 are intended for the exclusive use of the addressee(s) and may contain 
 proprietary, confidential or privileged information. If you are not the 
 intended recipient and have received this email and/or its attachment(s) in 
 error, you are notified that disclosing, copying, distributing or taking any 
 action in reliance on the contents of this email and/or its attachment(s) is 
 strictly prohibited. Please notify the sender immediately and delete this 
 email and any attachments.
 
 WARNING: Computer viruses can be transmitted via email. Although GPIT has 
 taken reasonable precautions to ensure no viruses are present in this email 
 and/or its attachment(s), GPIT does not guarantee that this email and/or its 
 attachments are secure or error-free. The recipient should check this email 
 and any attachment(s) for the presence of viruses. GPIT shall accept no 
 liability whatsoever for any loss or damage arising from the use of this 
 email and/or its attachment(s).
 ___
 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


  1   2   >