Re: [basex-talk] standalone vs GUI character parsing

2016-10-27 Thread Christian Grün
Hi George,

> how can a basexclient execute  XQUERY
> "import module namespace test = "test" at "test.xq" if there isn't a
> querypath to define the directory for the modules?

One way is to specify the base URI in your query [1]. If you
frequently import server-side modules, the approach we recommend is to
move the modules into the repository.

Hope this helps,
Christian

[1] https://www.w3.org/TR/xquery-31/#id-base-uri-decl
[2] http://docs.basex.org/wiki/Repository


Re: [basex-talk] standalone vs GUI character parsing

2016-10-27 Thread George Sofianos

I pass this on to the Docker aficionados on the list…

Christian


Thanks and sorry for responding on a month old post about the xml 
parser, I just noticed my email filters were not working.


About the QUERYPATH, I think the issue isn't specifically about docker. 
Maybe I'm missing something, but how can a basexclient execute  XQUERY 
"import module namespace test = "test" at "test.xq" if there isn't a 
querypath to define the directory for the modules? I'm trying this on a 
local server instance and it searches for the test.xq in the BaseX bin 
directory. I hope there is an alternative way to declare the path, 
because I won't be able to use BaseX any more from my java application, 
using the BasexClient query method.


Specifically about Docker, the older images can't run because of the .m2 
permissions, and the latest one is missing QUERYPATH.


Re: [basex-talk] standalone vs GUI character parsing

2016-10-27 Thread Christian Grün
> What about characters that outside the UTF-8 scope?

That’s a difficult one. You may end up parsing silly stuff once you
tolerate wrongly encoded characters. If there is no chance to get your
input cleaned before sending it to BaseX, Tagsoup may be the last
resort.

> I also noticed that the QUERYPATH has been removed from latest builds, how
> can I set the Docker image to find xq modules? I was using the QUERYPATH to 
> map them.

I pass this on to the Docker aficionados on the list…

Christian


Re: [basex-talk] standalone vs GUI character parsing

2016-10-27 Thread George Sofianos
What about characters that outside the UTF-8 scope? I think that still 
makes the internal parser to fail. I thought that was intended behaviour 
so I never mentioned it.


On 09/30/2016 03:10 PM, Christian Grün wrote:

By default, XML documents with invalid characters should be rejected;
but if you turn on the internal parser in the parsing tab of the
Database Creation dialog, all invalid characters will be replaced with
FFFD. Maybe that’s what you have done?

I also noticed that the QUERYPATH has been removed from latest builds, 
how can I set the Docker image to find xq modules? I was using the 
QUERYPATH to map them.


Re: [basex-talk] A BaseX/DITA use case...

2016-10-27 Thread Maximilian Gärber
Interesting!

How can you watch without registering at BrightTalk?

Regards, Max

2016-10-06 0:41 GMT+02:00 France Baril :
> For those who are interested in the use of XML content for publishing, this
> presentation is about using BaseX to power a slideshow editing tool that
> builds slides from existing DITA documentation/training content...
>
> https://www.brighttalk.com/community/content-marketing/webcast/9273/209719?utm_campaign=community-live-recorded&utm_content=&utm_source=brighttalk-portal&utm_medium=web&utm_term=
>
> -
> France Baril
> Architecte documentaire / Documentation architect
> france.ba...@architextus.com


Re: [basex-talk] Download hinter Firewall funktioniert nicht

2016-10-27 Thread Maximilian Gärber
Hallo,

der ZIP Download eignet sich für Windows auch sehr gut. Entpacken und
in \basex\bin\ die gewünschte Variante z.B. basexgui.bat starten.

Auf diese Art können auch einfach mehrere Versionen benutzt werden,
aktuell ist http://files.basex.org/releases/8.5/

VG Max Gärber

Am 12. Oktober 2016 um 16:42 schrieb Schindler Wolfgang Dr.
:
> Hallo,
>
>
>
> der Download der aktuellen Version des BaseX Windows Installers auf einen
> Rechner, der über Proxy (hinter einer betrieblichen Firewall) aufs Web
> zugreift, funktioniert nicht. Warum weiß ich nicht genau, könnte aber
> vermuten, dass an der Art der URI
> http://files.basex.org/releases/8.5.3/BaseX853.exe liegt. Gibt es eine
> andere Methode an den Download zu kommen.
>
>
>
> Danke  fürs Helfen und noch einen schönen Tag!
>
>
>
> Beste Grüße,
>
> Wolfgang Schindler
>
>


Re: [basex-talk] Check if server is running, silently

2016-10-27 Thread Bram Vanroy
I was looking in the wrong places. The error I was trying to hide was a 
socket() error, but that is actually a PHP error and not a BaseX Exception! 
Errors and exceptions are handled differently of course. So I had to resort to 
PHP error_reporting to temporarily disable the generated error when we can't 
connect to the server. Like this:

  // error_reporting returns last state it was in
  $previousReportingLevel = error_reporting(0);
  $session = new Session($dbhost, $dbport, $dbuser, $dbpwd);
  error_reporting($previousReportingLevel);

You still have to wrap this in a try/catch block and ignore the catch though, 
because the BaseX script will also throw a 'Can't communicate with server' 
error. I'm not sure why this is the case. Considering PHP already returns false 
AND reports an error on socket_connect() fail it might be better to just return 
false when this error occurs on session creation. That way we can still throw 
our own Exception if needed, but more importantly we get a false return when 
the server cannot be connected to. Just a thought.

Kind regards

Bram

-Oorspronkelijk bericht-
Van: Christian Grün [mailto:christian.gr...@gmail.com] 
Verzonden: donderdag 27 oktober 2016 10:32
Aan: Bram Vanroy 
CC: BaseX 
Onderwerp: Re: [basex-talk] Check if server is running, silently

Hi Bram,

Unfortunately I cannot give you help on PHP (my knowledge about this language 
is around 20 years old now). If you check out our Java sources [1], you will 
see that our ping does basically the same what you do: We try to create a 
connection and return true if we succeed.

Regarding logging, I would assume that it’s your freedom to decide what you do 
in the catch branch. I am not sure where/when Apache comes into play in your 
setup?

Christian

[1] 
https://github.com/BaseXdb/basex/blob/25f3d67/basex-core/src/main/java/org/basex/BaseXServer.java#L285-L302



On Thu, Oct 27, 2016 at 10:22 AM, Bram Vanroy 
 wrote:
> Hi all
>
> To make clear to users which corpora are currently available and which 
> aren’t, I’m checking to see if a BaseX server instance exists and then 
> check if a specific database exists. Testing for the database is done 
> with db:query (as I learned through this mailinglist), but I’m not 
> sure how I can silently test for the server in PHP.
>
> All BaseX examples use try-catch blocks, which makes sense to catch 
> errors that go wrong, and do something with them. If I’m not mistaken 
> these errors are automatically logged by Apache (maybe also by other 
> webservices). This means that if I’m only checking the existence of a 
> server with the code below (variables left out), I will always write an error 
> to a log file.
> Obviously, that is not what I want because I know that the error 
> ‘Cannot communicate with server’ is to be expected when the server does not 
> exist!
>
> try {
>
>   $session = new Session($dbhost, $dbport, $dbuser, $dbpwd);
>
>
>
>   // db:exists returns a string 'false', still need to convert 
> to bool
>
>   $corpusExists =
> toBoolean($session->query("db:exists('$databaseName')")->execute());
>
>
>
>   $session->close();
>
>
>
>   if ($corpusExists) {
>
> $availabilityArray[] = $databaseName;
>
>   }
>
> } catch (Exception $e) {
>
>   //
>
> }
>
>
>
> This script works perfectly fine, but I do not want the errors to be 
> logged (for this case) to prevent my error log to be full of the same 
> error. Is there another way to test for a BaseX instance only? For 
> instance, a way to return false when the server does not exist, I could do 
> something like:
>
>
>
> $session = new Session($dbhost, $dbport, $dbuser, $dbpwd);
>
> If ($session) {
>
>   // db:exists returns a string 'false', still need to convert 
> to bool
>
>   $corpusExists =
> toBoolean($session->query("db:exists('$databaseName')")->execute());
>
>
>
>   $session->close();
>
>
>
>   if ($corpusExists) {
>
> $availabilityArray[] = $databaseName;
>
>   }
>
>
>
> }
>
>
>
>
>
> Thank you in advance
>
>
>
> Bram Vanroy



Re: [basex-talk] Some GUI suggestions

2016-10-27 Thread Christian Grün
I have created an issue to keep track of your suggestions [1].
Implementors out there: Get back to us :)

[1] https://github.com/BaseXdb/basex/issues/1378


On Wed, Oct 26, 2016 at 5:00 PM, Graydon Saunders  wrote:
> Hi Christian --
>
> That's certainly true and it's useful.  I am more looking for a configurable
> file target so I don't have to have the very early stages of "what is going
> on in there?" organized enough for a file:write or to find the large set of
> results twice each time.
>
> This is much less interesting to me than the named, loadable list of
> external variables; that would make life easier to various semi-technical
> folks I'm delivering queries to.
>
> Thanks!
> Graydon
>
> On Wed, Oct 26, 2016 at 10:08 AM, Christian Grün 
> wrote:
>>
>> Hi Graydon,
>>
>> > Configurable "dump the output to a file" (rather than using file:write
>> > in
>> > the query) would be nice, too; development is not always at a place
>> > where
>> > file:write is straightforward.
>>
>> One existing solution is to press the "Save" button in the Text View
>> once the query has been evaluated. If the result is small enough, the
>> text will be saved as is. Otherwise, the query will be re-evaluated,
>> and the result ends up in the specified file.
>>
>> Hope this helps,
>> Christian
>
>


Re: [basex-talk] Check if server is running, silently

2016-10-27 Thread Christian Grün
Hi Bram,

Unfortunately I cannot give you help on PHP (my knowledge about this
language is around 20 years old now). If you check out our Java
sources [1], you will see that our ping does basically the same what
you do: We try to create a connection and return true if we succeed.

Regarding logging, I would assume that it’s your freedom to decide
what you do in the catch branch. I am not sure where/when Apache comes
into play in your setup?

Christian

[1] 
https://github.com/BaseXdb/basex/blob/25f3d67/basex-core/src/main/java/org/basex/BaseXServer.java#L285-L302



On Thu, Oct 27, 2016 at 10:22 AM, Bram Vanroy
 wrote:
> Hi all
>
> To make clear to users which corpora are currently available and which
> aren’t, I’m checking to see if a BaseX server instance exists and then check
> if a specific database exists. Testing for the database is done with
> db:query (as I learned through this mailinglist), but I’m not sure how I can
> silently test for the server in PHP.
>
> All BaseX examples use try-catch blocks, which makes sense to catch errors
> that go wrong, and do something with them. If I’m not mistaken these errors
> are automatically logged by Apache (maybe also by other webservices). This
> means that if I’m only checking the existence of a server with the code
> below (variables left out), I will always write an error to a log file.
> Obviously, that is not what I want because I know that the error ‘Cannot
> communicate with server’ is to be expected when the server does not exist!
>
> try {
>
>   $session = new Session($dbhost, $dbport, $dbuser, $dbpwd);
>
>
>
>   // db:exists returns a string 'false', still need to convert to
> bool
>
>   $corpusExists =
> toBoolean($session->query("db:exists('$databaseName')")->execute());
>
>
>
>   $session->close();
>
>
>
>   if ($corpusExists) {
>
> $availabilityArray[] = $databaseName;
>
>   }
>
> } catch (Exception $e) {
>
>   //
>
> }
>
>
>
> This script works perfectly fine, but I do not want the errors to be logged
> (for this case) to prevent my error log to be full of the same error. Is
> there another way to test for a BaseX instance only? For instance, a way to
> return false when the server does not exist, I could do something like:
>
>
>
> $session = new Session($dbhost, $dbport, $dbuser, $dbpwd);
>
> If ($session) {
>
>   // db:exists returns a string 'false', still need to convert to
> bool
>
>   $corpusExists =
> toBoolean($session->query("db:exists('$databaseName')")->execute());
>
>
>
>   $session->close();
>
>
>
>   if ($corpusExists) {
>
> $availabilityArray[] = $databaseName;
>
>   }
>
>
>
> }
>
>
>
>
>
> Thank you in advance
>
>
>
> Bram Vanroy


Re: [basex-talk] Text resources

2016-10-27 Thread Christian Grün
> convert:binary-to-string(db:retrieve(‘some’,’some.txt’))

…exactly. I have added a little example to our documentation.

Cheers,
Christian

[1] http://docs.basex.org/wiki/Database_Module#db:retrieve


[basex-talk] Check if server is running, silently

2016-10-27 Thread Bram Vanroy
Hi all

 

To make clear to users which corpora are currently available and which
aren't, I'm checking to see if a BaseX server instance exists and then check
if a specific database exists. Testing for the database is done with
db:query (as I learned through this mailinglist), but I'm not sure how I can
silently test for the server in PHP.

 

All BaseX examples use try-catch blocks, which makes sense to catch errors
that go wrong, and do something with them. If I'm not mistaken these errors
are automatically logged by Apache (maybe also by other webservices). This
means that if I'm only checking the existence of a server with the code
below (variables left out), I will always write an error to a log file.
Obviously, that is not what I want because I know that the error 'Cannot
communicate with server' is to be expected when the server does not exist!

 

try {

  $session = new Session($dbhost, $dbport, $dbuser, $dbpwd);

 

  // db:exists returns a string 'false', still need to convert to
bool

  $corpusExists =
toBoolean($session->query("db:exists('$databaseName')")->execute());

 

  $session->close();

 

  if ($corpusExists) {

$availabilityArray[] = $databaseName;

  }

} catch (Exception $e) {

  //

}

 

This script works perfectly fine, but I do not want the errors to be logged
(for this case) to prevent my error log to be full of the same error. Is
there another way to test for a BaseX instance only? For instance, a way to
return false when the server does not exist, I could do something like:

 

$session = new Session($dbhost, $dbport, $dbuser, $dbpwd);

If ($session) {

  // db:exists returns a string 'false', still need to convert to
bool

  $corpusExists =
toBoolean($session->query("db:exists('$databaseName')")->execute());

 

  $session->close();

 

  if ($corpusExists) {

$availabilityArray[] = $databaseName;

  }

 

}

 

 

Thank you in advance

 

Bram Vanroy