Re: [basex-talk] Old dog trying to learn some new tricks.

2017-08-28 Thread Liam R. E. Quin
On Mon, 2017-08-28 at 16:02 -0500, Dave Day wrote:
> 
[...]
>  What I was hoping to do was to connect to a running BaseX, and
> send 
> the schema definitions that would be used to validate the XML.  In 
> reading doc, I see it is possible to create namespaces and use them,
> but 
> the format has to be either a URL or a URN.  Is it possible to create
> a 
> URN for a namespace on the fly, and then tell the code later on
> which 
> namespace to use?

I think really you are wanting to validate against a particular schema.
This is entirely unrelated to which namespace URI is used to identify
elements in the document. You can have multiple XML Schema Documents
(xsd) for validating XML documents whose elements are "in" the same
namespace.

A namespace in XML is nothing more or less than a URI used as a name.
They don't actually "do" anything :)

http://docs.basex.org/wiki/Validation_Module#XML_Schema_Validation
has an example that might help.

Liam


-- 
Liam Quin, W3C, http://www.w3.org/People/Quin/
Staff contact for Verifiable Claims WG, XQuery WG

Web slave for http://www.fromoldbooks.org/


Re: [basex-talk] Old dog trying to learn some new tricks.

2017-08-28 Thread Kendall Shaw
Can you elaborate on what you were imagining doing with namespaces? An XML 
namespace is referred to by it’s URI. If you created one, I don’t know what it 
would mean to tell the code later on which to use.

Do you mean a namespace prefix?

Kendall

On 8/28/17, 2:02 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Dave Day"  wrote:

Greetings BaseX list,

 I've got some very basic questions I was hoping I could get the 
answers to on this list.  Questions really break down into two 
categories.  My background is strictly on IBM mainframes, so please bear 
with me.

 1)Some XML schema questions, and

 2)Questions regarding how to configure/use BaseX for what I want to do.

 XML schema.  I've got a record definition created by IBM that 
changes somewhat depending upon the release of the system.  I want to 
create XML schema for each release dependent definition, and then make 
that definition available to BaseX.  I thought using namespaces was the 
way to go, but now am not sure.

 What I was hoping to do was to connect to a running BaseX, and send 
the schema definitions that would be used to validate the XML.  In 
reading doc, I see it is possible to create namespaces and use them, but 
the format has to be either a URL or a URN.  Is it possible to create a 
URN for a namespace on the fly, and then tell the code later on which 
namespace to use?

 Regards,

 -- Dave Day





[basex-talk] Old dog trying to learn some new tricks.

2017-08-28 Thread Dave Day

Greetings BaseX list,

    I've got some very basic questions I was hoping I could get the 
answers to on this list.  Questions really break down into two 
categories.  My background is strictly on IBM mainframes, so please bear 
with me.


    1)Some XML schema questions, and

    2)Questions regarding how to configure/use BaseX for what I want to do.

    XML schema.  I've got a record definition created by IBM that 
changes somewhat depending upon the release of the system.  I want to 
create XML schema for each release dependent definition, and then make 
that definition available to BaseX.  I thought using namespaces was the 
way to go, but now am not sure.


    What I was hoping to do was to connect to a running BaseX, and send 
the schema definitions that would be used to validate the XML.  In 
reading doc, I see it is possible to create namespaces and use them, but 
the format has to be either a URL or a URN.  Is it possible to create a 
URN for a namespace on the fly, and then tell the code later on which 
namespace to use?


    Regards,

    -- Dave Day



[basex-talk] Test message. Just to see if it works.

2017-08-28 Thread Dave Day





Re: [basex-talk] Startup hooks or persisting jobs

2017-08-28 Thread Kendall Shaw
Thanks. I would think that being able to schedule jobs would fit nicely with 
having scheduled jobs persist after restart.

Kendall

From: "Kirsten, Dirk" 
Date: Monday, August 28, 2017 at 12:21 PM
To: Kendall Shaw , BaseX 

Subject: AW: Startup hooks or persisting jobs

Hi Kendall,

there is currently no way to do this using BaseX itself. But I also don’t think 
that should be the job of BaseX. Instead you can write a servlet and deploy it 
using Tomcat which runs some Java application, e.g. which could trigger some 
BaseXX command. See 
http://crunchify.com/how-to-run-java-program-automatically-on-tomcat-startup/
 for an example how to do this.

Cheers
Dirk


Senacor Technologies Aktiengesellschaft - Sitz: Eschborn - Amtsgericht 
Frankfurt am Main - Reg.-Nr.: HRB 105546
Vorstand: Matthias Tomann, Marcus Purzer - Aufsichtsratsvorsitzender: Daniel 
Grözinger
Von: basex-talk-boun...@mailman.uni-konstanz.de 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de] Im Auftrag von Kendall Shaw
Gesendet: Montag, 28. August 2017 06:46
An: BaseX 
Betreff: [basex-talk] Startup hooks or persisting jobs

Am I missing an existing way to run xquery at startup (basex web service 
running under tomcat)? I have jobs that I schedule, but I have to schedule them 
again if basex is shutdown.

I can test for basex being started outside of basex and then execute queries, 
but if there is already a way to do this within basex, I would rather do that.

Kendall



Re: [basex-talk] Startup hooks or persisting jobs

2017-08-28 Thread Kirsten, Dirk
Hi Kendall,

there is currently no way to do this using BaseX itself. But I also don’t think 
that should be the job of BaseX. Instead you can write a servlet and deploy it 
using Tomcat which runs some Java application, e.g. which could trigger some 
BaseXX command. See 
http://crunchify.com/how-to-run-java-program-automatically-on-tomcat-startup/ 
for an example how to do this.

Cheers
Dirk


Senacor Technologies Aktiengesellschaft - Sitz: Eschborn - Amtsgericht 
Frankfurt am Main - Reg.-Nr.: HRB 105546
Vorstand: Matthias Tomann, Marcus Purzer - Aufsichtsratsvorsitzender: Daniel 
Grözinger
Von: basex-talk-boun...@mailman.uni-konstanz.de 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de] Im Auftrag von Kendall Shaw
Gesendet: Montag, 28. August 2017 06:46
An: BaseX 
Betreff: [basex-talk] Startup hooks or persisting jobs

Am I missing an existing way to run xquery at startup (basex web service 
running under tomcat)? I have jobs that I schedule, but I have to schedule them 
again if basex is shutdown.

I can test for basex being started outside of basex and then execute queries, 
but if there is already a way to do this within basex, I would rather do that.

Kendall



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
> )
>  } ;



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

2017-08-28 Thread r . stapper

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
 )
  } ;