Re: [basex-talk] Use Bash to construct multi-file form submission

2023-08-18 Thread Kendall Shaw

Hi Eliot,

In case you are still working on this, there is --config/-k where you 
can specify curl arguments. I think that would avoid bash parsing.


Best,
Kendall

On 8/15/2023 8:00 AM, Eliot Kimber wrote:


This is not strictly a BaseX question but it is in the context of 
communicating with a BaseX-implemented REST service and I’m hoping 
someone in this community can answer my question as I’ve not found a 
solution the interwebs.


I’ve implemented a POST method that expects a multi-part form request 
with multiple files that then loads those files into a database. The 
files are all related such that I want something close to an atomic 
commit for the set of files. Thus the multi-file form approach.


The REST method works and I can use from the command line using curl, i.e:

curl --location 
http://localhost:9984/now/rest/validation/reports?debug=false \
--form 
'files=@"/Users/eliot.kimber/git-basex/product-content-analytics/validation-reports/vancouver/bundle-strategic-portfolio-mgmt_errors_vancouver_2023-08-14T22~11~28Z_1ae692f8_1692054936.xml"' 
\
--form 
'files=@"/Users/eliot.kimber/git-basex/product-content-analytics/validation-reports/vancouver/bundle-tech-technology-industry_errors_vancouver_2023-08-14T22~11~28Z_1ae692f8_1692054971.xml"'


What I haven’t been able to figure out is how to construct the 
equivalent curl command in a bash script, where the script gets a list 
of flies to load and then constructs the –form parameters.


Everything I’ve tried results in a “Warning: Trailing data after 
quoted form parameter” message or some more utter failure.


It must be some subtlety of how to escape the quotes—my googling 
around produces lots of stack overflow discussions of how to manage 
the escapes, but nothing I’ve tried has so far worked.


My bash approach is simply:

curlcmd=”curl --location …”
for file in ${files[@]}; do
   curlcmd+=” --form ‘files=@\”${file}\”’
done

And then execute the resulting string:

bash -c $curlcmd


I have a separate script that successfully constructs a curl call to a 
companion end point that takes one file:


curl \
"--location""${serverUrl}:${serverPort}/now/rest/validation/report/${fileName}?debug=${debug}"\
"--header""Content-Type: text/xml"\
"--data-binary""@${filePath}"

And I’m currently just calling this for each file, which is OK.

But I’d really like to be able to send a set of files as a single REST 
call.


Thanks,

Eliot

_

*Eliot Kimber*

Sr Staff Content Engineer

O: 512 554 9368

M: 512 554 9368

servicenow.com 

LinkedIn  | Twitter 
 | YouTube 
 | Facebook 



Re: [basex-talk] Link Graph Construction: Anything I Can Crib or Learn From?

2022-06-26 Thread Kendall Shaw
And there are graph databases not based on RDF: Neo4j, Tinkerpop and others.


For gathering metrics from a DITA CCMS, I used Blazegraph and querie using 
SPARQL. You can express just those sort of things: What links to this.


About that last paragraph: I've also wondered how representing mostly 
hierarchical data scales in a graph database.


Kendall


On Thursday, June 23, 2022 1:02:45 PM (-07:00), Tim Thompson wrote:


Thanks, Bridger. I agree this seems like a use case for graph technologies 
(RDF/SPARQL or labeled property graphs). SPARQL 1.1 includes property paths, 
which make it possible to query on transitive properties (e.g., A contains B, B 
contains C). One example from Wikidata: 
https://twitter.com/andre_ourednik/status/1427264453217763336.



There are also document-based representations, as Bridger mentions: JSON-LD, 
RDF/XML, and TriX are supported by RDF tools; there's also GraphML and GEXF, 
supported by the Gephi platform[1] for network visualization and also Python 
tools like NetworkX[2].


Would be interesting to test how a recursive approach using db:attribute, etc., 
over a link index would scale in BaseX.



Tim



[1] https://gephi.org/
[2] https://networkx.org/




--
Tim A. Thompson (he, him)
Librarian for Applied Metadata Research
Yale University Library






On Thu, Jun 23, 2022 at 1:09 PM Bridger Dyson-Smith  
wrote:

Hi Eliot -



I've wondered (but never tested/explored) about leveraging some semblance of 
json-ld (or serialized ttl, or something similar) and passing those values to 
Apache Jena (or another SPARQL processor) to use that as an inference engine. 
I'm deep in Speculation Territory here - I don't know what anything would look 
like - but you're describing an interesting problem, and it seems doable. 
Martynas Jusevicius (and his colleagues) have a project, LinkedDataHub, that 
may provide another avenue for exploring this -- I haven't used AtomGraph's 
applications, but he's active on the xml.com slack, and it looks like there are 
some interesting visualization capabilities with their work.



Our listserv friend and neighbor, Tim Thompson of Yale, may have some ideas 
along these lines, too.
Sorry that I can't provide anything concrete, but I hope some of this is 
somewhat helpful.

Best,
Bridger


[1] https://json-ld.org/
[2] https://jena.apache.org/
[3] https://github.com/AtomGraph/LinkedDataHub


On Thu, Jun 23, 2022 at 10:35 AM Eliot Kimber  
wrote:


In the context of our Project Mirabel system that manages DITA content, I need 
to be able answer the question “for topic X, what other topics link to it 
directly or indirectly?”

 

That is, say Topic A links to Topic B that Links to Topic C.

 

Asking the question “What topics ultimately link to topic C?” I would like to 
get the answer “Topic A, Topic B”.

 

Getting the answer for direct references is easy—I already build a where-used 
index that captures, for each DITA map or topic, what other maps and topics 
link directly to it.

 

But to get the Topic A part of the answer I need some kind of link graph index 
and I’m not sure how best to go about calculating this or capturing it in some 
index or set of indexes.

 

In our content the fan out from a single Topic C to the set of topics that 
ultimately reference it could be 10s of 1000s of topics. We have about 45K 
topics in the content for each version of the ServiceNow Platform and a number 
of topics that are used by a large number of other topics, so the explosion can 
be quite large. That suggests that a simple 
topic-to-ultimately-referenced-topics index would be very inefficient in that 
the entry for any given topic could potentially have 45K – 1 entries (we don’t 
care that a topic references itself).

 

On the other hand, working backwards through chains of direct references can 
also be expensive and is probably too slow, so maybe the brute-force index is 
the best option?

 

At the same time, I would like to be able to quickly visualize the link graph 
extending from or ending in any given topic or simply the link graph for the 
entire information set, which requires capturing the nodes and edges.

 

My question: does anyone either have experience or insight into this kind of 
link graph challenge or know of relevant papers or general discussion of graph 
processing I might look at?

 

Thanks,

 

Eliot

_

Eliot Kimber

Sr Staff Content Engineer

O: 512 554 9368

M: 512 554 9368

servicenow.com

LinkedIn | Twitter | YouTube | Facebook


-- 
Sent with Vivaldi Mail. Download Vivaldi for free at vivaldi.com

Re: [basex-talk] Serialization options

2017-11-30 Thread Kendall Shaw
Hi,

Before people post CSV files to a web service, they bring a troop of Guerillas 
into a room and give them computer keyboards. After that the guerillas pound on 
the keyboards and then click send. So, the CSV files that arrive can have 
different separators between each other and they use Microsoft word, perhaps, 
to type CSV text sometimes, maybe, and so there will be files surrounded by 
what looks like double quotes but is actually the left and right quote 
characters and all sorts of other problems.

In some cases, an error other than generic failure is wanted so that a user can 
know roughly what the problem is. In other cases, differences might be better 
to resolve in the web service, e.g. semi-colon vs. comma.

Kendall

On 11/30/17, 9:30 AM, "Christian Grün"  wrote:

Hi Kendall,

> csv:serialize(A, map {'newline': 
''})

The 'newline' option is a general serialization option; it cannot be
used with csv:serialize. If you want to take advantage of it, you
should use fn:serialize with method:csv [1]. Maybe my previous
response to George gives some more insight into the difference between
general and CSV serialization parameters.

> Also, about the csv option in RESTXQ, I have a need to accept a variety 
of CSV formats, some day in the future. For examples, CSV might have left and 
right quote characters, instead of double quote characters, or one uses commas 
another uses semi-colons, etc. Do you have a suggestion about how to handle 
that and still use the csv input option?

The CSV module provides support for custom field separators, so
switching from commas to semi-colons should be no problem [2].
Regarding left and quote characters, do you refer to “ and ” (201C /
201D) ? Do you have some more background information for us how these
characters come into play in your scenario?

Thanks in advance,
Christian

[1] 
https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Serialization=DwIFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=ZAZOc3Olja5l-6mlonje0zklw5GkCf31gPC4KYPwEuQ=LV1ACCRgeKxZ5oZLbOt2pG66GDtuAxOXYDIoP5WbC1k=
[2] 
https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_CSV-5FModule=DwIFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=ZAZOc3Olja5l-6mlonje0zklw5GkCf31gPC4KYPwEuQ=BVh9mjMYLAWJJN7X6CsaSTRyxjlXUS8ucaaj2J_fZdU=




Re: [basex-talk] Serialization options

2017-11-30 Thread Kendall Shaw
Hi,

Thank you, I will certainly use the newline option instead of what I described, 
I n the future.

Related to that, am I getting syntax wrong here:

csv:serialize(A, map {'newline': 
''})

I get back unknown option ‘newline’. The same for item-separator and method.

Also, about the csv option in RESTXQ, I have a need to accept a variety of CSV 
formats, some day in the future. For examples, CSV might have left and right 
quote characters, instead of double quote characters, or one uses commas 
another uses semi-colons, etc. Do you have a suggestion about how to handle 
that and still use the csv input option?

Kendall

On 11/29/17, 11:59 PM, "Christian Grün"  wrote:

Hi Kendall,

> That results in CRLF for me when served from RESTXQ.

With RESTXQ, you could try the following:

  declare
%output:method('csv')
%output:newline('\r\n')
  function local:csv() {

  };

> “tems can also be serialized as JSON if the Serialization Parameter 
method is set to csv.”
> 
https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_CSV-5FModule-23csv-3Aserialize=DwIFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=BhY9kJjja-TTckKgEI05TpeLKfNjDs4cbYB5msGYY8Q=ekp_GDd2EaFjFMLGPJHWnPgakobru0nmSy4nixg3zaw=

Thanks for the pointer. I hope the text is more readable now.

Best,
Christian


> On 11/29/17, 2:44 AM, "basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of George Sofianos"  wrote:
>
> Hi,
>
> What I'm trying to do is serialize a CSV with CRLF newlines in Linux
> using BaseX. It's not really important since my CSV parser supports 
both
> newlines, but maybe this discussion can help me understand how BaseX
> serialization works, or create an improvement for BaseX.
>
> I'm running BaseX GUI (latest snapshot). I have a sequence of strings
> that are CSV. I'm using fn:serialize with an item-separator of xml
> entity  I'm then returning this output as a result of the script.
> This gives me about 200 lines of CSV. Copy pasting these lines into an
> editor, or using the Save button from the GUI, saves these values with
> an LF newline character.
>
> The RFC [2] for CSV files recommends a CRLF character for CSV, so it
> would be nice if I can serialize this from BaseX directly. I tried 
some
> options from the wiki [1] but had no luck. File module also uses a
> system specific newline character. [3] Maybe this is something that
> could be a part of CSV serialization issue [4] , or maybe it is 
already
> possible to achieve this somehow.
>
> Thanks,
>
> George
>
> 
[1|https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Serialization=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo=xnyCt8OzH6uYfja9WTPafSfCb6z4Xfq7wsTK_WlxGGc=]
> 
[2|https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_rfc4180-23section-2D2=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo=f90XqUlysE4EosoDkbQL6CTEkpg35kUhKkmlK6juXY0=]
> 
[3|https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_File-5FModule-23file-3Awrite-2Dtext-2Dlines=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo=5UXzyZR-HJyffZELtzCZaECemWJnPSkb_wmgFjgDxe0=]
> 
[4|https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_BaseXdb_basex_issues_1518=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo=E-7_NaFPPP_PCUioDBWRaq2jouQno-v4D9LMbeF0gRo=]
>
>
>




Re: [basex-talk] Serialization options

2017-11-29 Thread Kendall Shaw
Hi,

This is awful, but:

replace(csv:serialize($csv), '([^])[]', '$1')

That results in CRLF for me when served from RESTXQ.

Hopefully, there is a better answer. csv:serialize complained that it didn’t 
recognize the option ‘item-separator’ or the option ‘method’. I didn’t try the 
file function. Maybe it works there.

This might have a typo:

“tems can also be serialized as JSON if the Serialization Parameter method is 
set to csv.”

in:

http://docs.basex.org/wiki/CSV_Module#csv:serialize

Kendall

On 11/29/17, 2:44 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
George Sofianos"  wrote:

Hi,

What I'm trying to do is serialize a CSV with CRLF newlines in Linux 
using BaseX. It's not really important since my CSV parser supports both 
newlines, but maybe this discussion can help me understand how BaseX 
serialization works, or create an improvement for BaseX.

I'm running BaseX GUI (latest snapshot). I have a sequence of strings 
that are CSV. I'm using fn:serialize with an item-separator of xml 
entity  I'm then returning this output as a result of the script. 
This gives me about 200 lines of CSV. Copy pasting these lines into an 
editor, or using the Save button from the GUI, saves these values with 
an LF newline character.

The RFC [2] for CSV files recommends a CRLF character for CSV, so it 
would be nice if I can serialize this from BaseX directly. I tried some 
options from the wiki [1] but had no luck. File module also uses a 
system specific newline character. [3] Maybe this is something that 
could be a part of CSV serialization issue [4] , or maybe it is already 
possible to achieve this somehow.

Thanks,

George


[1|https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Serialization=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo=xnyCt8OzH6uYfja9WTPafSfCb6z4Xfq7wsTK_WlxGGc=]

[2|https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_rfc4180-23section-2D2=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo=f90XqUlysE4EosoDkbQL6CTEkpg35kUhKkmlK6juXY0=]

[3|https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_File-5FModule-23file-3Awrite-2Dtext-2Dlines=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo=5UXzyZR-HJyffZELtzCZaECemWJnPSkb_wmgFjgDxe0=]

[4|https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_BaseXdb_basex_issues_1518=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo=E-7_NaFPPP_PCUioDBWRaq2jouQno-v4D9LMbeF0gRo=]





Re: [basex-talk] Loading data

2017-11-20 Thread Kendall Shaw
Also, I would think that map:merge would be the typical FP idea where 
conceptually each step is a copy of the entire map, but it’s implemented as 
only what has changed being new. If that isn’t the case that would be important 
to know.

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Monday, November 20, 2017 at 12:13 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Loading data

I hope that the tuple stream of a FLWOR expression does not accumulate heap 
memory. Is that the case, Christian, or anyone?

Kendall

From: "E. Wray Johnson" <wray.john...@gmail.com>
Date: Monday, November 20, 2017 at 10:37 AM
To: Kendall Shaw <kendall.s...@workday.com>
Cc: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Loading data


I may need to load hundreds of thousands of items each with dozens of sub-nodes.

I am looking for a solution that will not be at risk of running out of heap 
memory.

On Mon, Nov 20, 2017 at 12:44 PM, Kendall Shaw 
<kendall.s...@workday.com<mailto:kendall.s...@workday.com>> wrote:
Hi,

Just about building maps, in general: If you look at map:merge in 
http://docs.basex.org/wiki/Map_Module<https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Map-5FModule=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=Vqrcy5xoTXekYA_60uYsRLfwE8plvHtMAGq8kejU0do=NQHz3DOpC6VgtvcpVqQQScfIlaR_5kZ_TbihOEVZATY=>
 it shows a way to build a map with a for expression. If the question updating 
maps in a loop was about this, then it is probably preferable to have the 
result of the for expression be  a map, rather than updating a map, iteratively.

Kendall

From: 
<basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>>
 on behalf of "E. Wray Johnson" 
<wray.john...@gmail.com<mailto:wray.john...@gmail.com>>
Date: Sunday, November 19, 2017 at 5:15 AM
To: Michael Seiferle <m...@basex.org<mailto:m...@basex.org>>
Cc: BaseX 
<basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>>
Subject: Re: [basex-talk] Loading data

Thanks. I tried doing #2 inside the iteration and that did not work.  I will 
try it your way and let you know if it works.
Wray Johnson
(m) 704-293-9008<tel:(704)%20293-9008>

On Nov 19, 2017, at 6:30 AM, Michael Seiferle 
<m...@basex.org<mailto:m...@basex.org>> wrote:
Dear Wray,

I tried to come up with a sketch of what–I think–might help you:
https://gist.github.com/micheee/8a8734a1713a7121cab15eb3dfb389d9<https://urldefense.proofpoint.com/v2/url?u=https-3A__gist.github.com_micheee_8a8734a1713a7121cab15eb3dfb389d9=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=0dY_XpYSlIufV9bPNvpZD4BvkOL2-P3MduC5WpG4FTc=Guzfb_5gXuH4sJ2goSUdevQcE_tYJ-A_zXytOn3yTPs=>

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<https://urldefense.proofpoint.com/v2/url?u=https-3A__gist.githubusercontent.com_Miserlou_c5cd8364bf9b2420bb29_raw_2bf258763c704f8ffd3ea9a3e81d25e2c6f6_cities.json=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=0dY_XpYSlIufV9bPNvpZD4BvkOL2-P3MduC5WpG4FTc=oX2YSOYRvXFIiOp87Q6C_ev1UGt0DWVkaCFu0whK6GM=>')
  => 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<https://urldefense.proofpoint.com/v2/url?u=https-3A__gist.githubusercontent.com_Miserlou_c5cd8364bf9b2420bb29_raw_2bf258763c704f8ffd3ea9a3e81d25e2c6f6_cities.json=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=0dY_XpYSlIufV9bPNvpZD4BvkOL2-P3MduC5WpG4FTc=oX2YSOYRvXFIiOp87Q6C_ev1UGt0DWVkaCFu0whK6GM=>')
  =&g

Re: [basex-talk] Loading data

2017-11-20 Thread Kendall Shaw
I hope that the tuple stream of a FLWOR expression does not accumulate heap 
memory. Is that the case, Christian, or anyone?

Kendall

From: "E. Wray Johnson" <wray.john...@gmail.com>
Date: Monday, November 20, 2017 at 10:37 AM
To: Kendall Shaw <kendall.s...@workday.com>
Cc: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Loading data


I may need to load hundreds of thousands of items each with dozens of sub-nodes.

I am looking for a solution that will not be at risk of running out of heap 
memory.

On Mon, Nov 20, 2017 at 12:44 PM, Kendall Shaw 
<kendall.s...@workday.com<mailto:kendall.s...@workday.com>> wrote:
Hi,

Just about building maps, in general: If you look at map:merge in 
http://docs.basex.org/wiki/Map_Module<https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Map-5FModule=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=Vqrcy5xoTXekYA_60uYsRLfwE8plvHtMAGq8kejU0do=NQHz3DOpC6VgtvcpVqQQScfIlaR_5kZ_TbihOEVZATY=>
 it shows a way to build a map with a for expression. If the question updating 
maps in a loop was about this, then it is probably preferable to have the 
result of the for expression be  a map, rather than updating a map, iteratively.

Kendall

From: 
<basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>>
 on behalf of "E. Wray Johnson" 
<wray.john...@gmail.com<mailto:wray.john...@gmail.com>>
Date: Sunday, November 19, 2017 at 5:15 AM
To: Michael Seiferle <m...@basex.org<mailto:m...@basex.org>>
Cc: BaseX 
<basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>>
Subject: Re: [basex-talk] Loading data

Thanks. I tried doing #2 inside the iteration and that did not work.  I will 
try it your way and let you know if it works.
Wray Johnson
(m) 704-293-9008<tel:(704)%20293-9008>

On Nov 19, 2017, at 6:30 AM, Michael Seiferle 
<m...@basex.org<mailto:m...@basex.org>> wrote:
Dear Wray,

I tried to come up with a sketch of what–I think–might help you:
https://gist.github.com/micheee/8a8734a1713a7121cab15eb3dfb389d9<https://urldefense.proofpoint.com/v2/url?u=https-3A__gist.github.com_micheee_8a8734a1713a7121cab15eb3dfb389d9=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=0dY_XpYSlIufV9bPNvpZD4BvkOL2-P3MduC5WpG4FTc=Guzfb_5gXuH4sJ2goSUdevQcE_tYJ-A_zXytOn3yTPs=>

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<https://urldefense.proofpoint.com/v2/url?u=https-3A__gist.githubusercontent.com_Miserlou_c5cd8364bf9b2420bb29_raw_2bf258763c704f8ffd3ea9a3e81d25e2c6f6_cities.json=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=0dY_XpYSlIufV9bPNvpZD4BvkOL2-P3MduC5WpG4FTc=oX2YSOYRvXFIiOp87Q6C_ev1UGt0DWVkaCFu0whK6GM=>')
  => 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<https://urldefense.proofpoint.com/v2/url?u=https-3A__gist.githubusercontent.com_Miserlou_c5cd8364bf9b2420bb29_raw_2bf258763c704f8ffd3ea9a3e81d25e2c6f6_cities.json=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=0dY_XpYSlIufV9bPNvpZD4BvkOL2-P3MduC5WpG4FTc=oX2YSOYRvXFIiOp87Q6C_ev1UGt0DWVkaCFu0whK6GM=>')
  => json:parse()
For more info on our BaseX JSON-Module see: 
http://docs.basex.org/wiki/JSON_Module<https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_JSON-5FModule=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=0dY_XpYSlIufV9bPNvpZD4BvkOL2-P3MduC5WpG4FTc=Uia9oCJta1vQG3jvblV437dpVM5JvI9GsfmVjj2xssY=>

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


Hope t

Re: [basex-talk] Loading data

2017-11-20 Thread Kendall Shaw
Hi,

Just about building maps, in general: If you look at map:merge in 
http://docs.basex.org/wiki/Map_Module it shows a way to build a map with a for 
expression. If the question updating maps in a loop was about this, then it is 
probably preferable to have the result of the for expression be  a map, rather 
than updating a map, iteratively.

Kendall

From:  on behalf of "E. Wray 
Johnson" 
Date: Sunday, November 19, 2017 at 5:15 AM
To: Michael Seiferle 
Cc: BaseX 
Subject: Re: [basex-talk] Loading data

Thanks. I tried doing #2 inside the iteration and that did not work.  I will 
try it your way and let you know if it works.
Wray Johnson
(m) 704-293-9008

On Nov 19, 2017, at 6:30 AM, Michael Seiferle 
> wrote:
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] Update/Delete JSON

2017-11-15 Thread Kendall Shaw
On 11/15/17, 4:24 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Christian Grün"  wrote:

Hi Maurice,

Depending on the chosen format, different outputs will be generated by
json:parse. Traditionally, it is true that only XML was generated by
this function, but in newer versions (and in alignment with the XQuery
3.1 specs and the fn:parse-json function), it is also possible now to
convert JSON data to atomic XQuery items (maps, arrays, strings,
numbers and booleans) [1,2]. The resulting representation will be more
memory-efficient, and access to XQuery maps is blazing fast, but it
won’t be possible to store this representation to a database.

Hope this helps, greetings,
Christian

[1] 
https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_JSON-5FModule-23XQuery=DwIFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=gYEI_kXgIHiAXP9cz0NdqkWgkjfpAGxnOd1-b8pW3mo=_ugHBUSWLu-V4vzcR6jpfcc11M-g6zbiag5lU7COcLA=
[2] 
https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_JSON-5FModule-23XQuery-5FFormat=DwIFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=gYEI_kXgIHiAXP9cz0NdqkWgkjfpAGxnOd1-b8pW3mo=o-pnuPNeYd74pBg0DLEEtwO3r4IKsaC7DPGIo7gxG6c=



On Wed, Nov 15, 2017 at 8:30 AM,   wrote:
> Christian,
>
> The JSON Module suggests that JSON objects are represented as 
XML-documents
> with a certain structure, not as immutable maps. Is there support in BaseX
> for json:parse and json:serialize for parsing JSON in textual form into
> immutable maps and back to JSON in textual form?
>
> Kind regards,
> Maurice van Keulen

Aside from XQuery and BaseX converting JSON, because JSON is not just objects, 
I think there could be a problem with the concept of converting JSON to maps, 
also. For example, these JSON documents aren’t map-like:

1. true
2. ["a", "a", "a", "x"]

Kendall



Re: [basex-talk] updating inside map:for-each

2017-11-14 Thread Kendall Shaw
On 11/14/17, 1:42 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Christian Grün"  wrote:

> How can database updating be done inside map:for-each ?

The higher-order functions of the XQuery spec are currently restricted
to non-updating functions. You can circumvent this restriction by
enabling the MIXUPDATES option, or using traditional iterations (which
are, at least, not much slower than map:for-each):

  for $key in map:keys($map)
  let $val := $map($key)
  return (...)

I will offer that if the question is being asked because it matches what would 
be done in other languages, it’s probably a good idea to read about functional 
programming, which XQuery is associated with.  A purely  functional program 
would not directly cause side-effects within a function.

At least, some familiarity with functional programming is fundamentally 
important in learning about XQuery.

Kendall



Re: [basex-talk] Can't update or delete JSON objects

2017-11-13 Thread Kendall Shaw
From:  on behalf of "E. Wray 
Johnson" 
Date: Sunday, November 12, 2017 at 12:32 AM
To: BaseX 
Subject: [basex-talk] Can't update or delete JSON objects

I have tried XQUERY updates that should work but they don't work.
My technique of storing JSON documents is perhaps not traditional.
I have reduced my example to this simple example.

FRIST CREATE DATABASE WITH ONE DOCUMENT:
db:create('geography', json:parse('{ "code": "USA", "name": "United States of 
America", "birth": 1776 }'), '/country')

THEN ADD ANOTHER DOCUMENT:

db:add('geography', json:parse('{ "code": "CAN", "name": "Canada", "birth": 
1867 }'), '/country')


  1.  How can I update either of these documents using 'code' as the unique 
identifier?

 *   How can I change the 'name' or 'birth'?
 *   How can I add a 'population' number?

  1.  How can I delete either of these documents using 'code' as the unique 
identifier?

My knowledge xquery update has lots of gaps. But, here are some answers.
Changing the value of the name element:
replace value of node db:open('geography')/json[code='CAN]/name with 'Canadia, 
eh?'
Adding a population number:
insert  node 12 into 
db:open('geography')/json[code='USA']
Delete “document”:
delete node db:open('geography')/json[code='XAN']
The update example you gave in the previous post is a BaseX extension and a 
non-updating expression.
A very important concept about XQuery update is the notion of an updating 
expression.
This has important information:
http://docs.basex.org/wiki/XQuery_Update#Pending_Update_List
Kendall



[basex-talk] repo install

2017-11-10 Thread Kendall Shaw
I have been updating packages by modifying the files in REPOPATH instead of 
creating a xar file and using repo install. Is it safe to expect that to 
continue to work for the foreseeable future?

Kendall


Re: [basex-talk] Architecture question

2017-10-27 Thread Kendall Shaw
If BaseX is going to be used for something other than storage, then that 
planned usage could be key in choosing a method to communicate between web 
browser and mainframe.

Kendall

On 10/27/17, 11:43 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:

I'm trying to come up with an application that provides:

1)Ability for a user on a desktop to communicate with a mainframe, 
without connecting the browser directly to the mainframe code.  I do not 
want to run a web server on the mainframe due to the security issues I 
will hit with that.  This has to be an 'outbound' connection from the 
mainframe.  The mainframe establishes the connection, does not listen 
for and accept a connection.

2)Ability for the mainframe to create and load databases within Basex. I 
tried establishing  a direct connection to a Basex server, but that 
requires my mainframe code to have a crypto service running that will 
create the MD5 hash value.  If that service isn't up, I can't get past 
the connection, and I can't require that the service be started.

3)Ability for a user to view the data in the database(s) as they are 
being updated to get the most current data.



My thought was to have the java comm server start, establish the RMI 
environment, and then when a command from the user came thru that 
interface, the java comm server would also start a new thread to connect 
to the Basex server and that thread would then create and load the database.

It would be a more simple and straight forward application if I could 
get the user's  browser to communicate directly with the java comm 
server, and I am trying to research how to do that now.

My biggest issue with doing all of this is that I'm not in my own 
element.  I'm having to teach myself java on the fly, as I go.

 -- Dave


On 10/27/2017 1:01 PM, Kendall Shaw wrote:
> Hi,
>
> Do you need to be doing remote procedure calls? In the abstract possibly 
anything you would want RPC for could be done in java on the communications 
server and basex would be interacted with using it’s APIs.
>
> I have been giving what I think are answers to abstract questions. It 
might be a good idea to ask more high-level questions that allow people to 
offer possible solutions using XQuery XML, XML databases, web applications, 
etc. Describing what you want a solution for that you think would require an 
XML database, might be useful.
>
> Kendall
>
> On 10/27/17, 8:57 AM, "basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:
>
>  Kendall,
>  
>   No, not wanting to use RMI to call functions in Basex, but to
>  handle communications between  a user on a browser, and my java comm
>  server that is talking to my code on the z/OS box.
>  
>   Something like this:
>  
>   Java comm server starts up, and listens for a connection.
>  
>   Connection established, and a new thread is started.
>  
>   New thread checks to see if Basex is started, and starts one if 
not.
>  
>   Thread establishes an RMI server.
>  
>   When Basex starts, it starts my RMI client code. Would have to 
run
>  on a separate thread within Basex. (Haven't figured out how to do 
this
>  one yet)
>  
>   User, on a browser, while connected to the Basex server, needs 
to
>  communicate with the mainframe code. Basex passes the request to the 
RMI
>  client, then waits for the response from the RMI client.(Ditto on 
this
>  one too...need to figure out if this is possible).
>  
>   RMI client sends request to RMI server thread in my comm server.
>  
>   RMI server thread pushes request across connection to mainframe.
>  Waits for response.
>  
>   Response come in, RMI server thread pushes response to RMI 
client
>  running in Basex.
>  
>   RMI client pushes response to Basex that then responds to the 
browser.
>  
>   User views the response.
>  
>  
>  On 10/27/2017 10:34 AM, Kendall Shaw wrote:
>  > HI,
>  >
>  > I would think so. But, if you mean using RMI to call functions in 
BaseX, it’s probably a better idea to run basex on both and use 

Re: [basex-talk] Architecture question

2017-10-27 Thread Kendall Shaw
Hi,

Do you need to be doing remote procedure calls? In the abstract possibly 
anything you would want RPC for could be done in java on the communications 
server and basex would be interacted with using it’s APIs.

I have been giving what I think are answers to abstract questions. It might be 
a good idea to ask more high-level questions that allow people to offer 
possible solutions using XQuery XML, XML databases, web applications, etc. 
Describing what you want a solution for that you think would require an XML 
database, might be useful.

Kendall

On 10/27/17, 8:57 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:

Kendall,

 No, not wanting to use RMI to call functions in Basex, but to 
handle communications between  a user on a browser, and my java comm 
server that is talking to my code on the z/OS box.

 Something like this:

 Java comm server starts up, and listens for a connection.

 Connection established, and a new thread is started.

 New thread checks to see if Basex is started, and starts one if not.

 Thread establishes an RMI server.

 When Basex starts, it starts my RMI client code. Would have to run 
on a separate thread within Basex. (Haven't figured out how to do this 
one yet)

 User, on a browser, while connected to the Basex server, needs to 
communicate with the mainframe code. Basex passes the request to the RMI 
client, then waits for the response from the RMI client.(Ditto on this 
one too...need to figure out if this is possible).

 RMI client sends request to RMI server thread in my comm server.

 RMI server thread pushes request across connection to mainframe.  
Waits for response.

 Response come in, RMI server thread pushes response to RMI client 
running in Basex.

 RMI client pushes response to Basex that then responds to the browser.

 User views the response.


On 10/27/2017 10:34 AM, Kendall Shaw wrote:
> HI,
>
> I would think so. But, if you mean using RMI to call functions in BaseX, 
it’s probably a better idea to run basex on both and use the BaseX client API 
or REST.
>
> Kendall
>
> On 10/27/17, 8:13 AM, "basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:
>
>  Kendall,
>  
>   I've now got a java server running that can accept a connection
>  from my mainframe code.
>  
>   In the scenario you have below, would it be possible to have the
>  imported module use RMI to communicate with the java communication 
server?
>  
>   Regards,
>  
>       -- Dave
>  
>  
>  
>  On 10/19/2017 8:48 PM, Kendall Shaw wrote:
>  > Yes. The section in the documentation about RESTXQ shows how 
XQuery can be used to handle HTTP requests. The part about REST shows a way to 
execute queries (programs) and commands over HTTP. BaseX comes with a servlet 
that can run in a web server. The servlet is a java class that is executed by 
the java vm that is running the web server. The servlet also runs the native 
basex server. BaseX also includes a web server that can be used instead of a 
web server outside of BaseX.
>  >
>  > The section in the documentation about Java bindings shows how you 
can create modules that implement XQuery functions in java (or whatever JVM 
language). In xquery like:
>  >
>  > Import module namespace d = “ http: //duke-software.com/xml “;
>  >
>  > d:compute()
>  >
>  > The function d:compute() could be implemented in java so you are 
executing java by invoking the function.
>  >
>  > The XQuery that implements a web application could use the module 
that includes the java functions that interact with the mainframe to 
communicate with a service listening in the mainframe. That is driven by the 
web application.
>  >
>  > To  cause basex to handle communication from the second task, you 
could use threads but instead of what I said in the last post, it might be 
better to have the program that interacts with the mainframe run as  a separate 
OS service that handles data coming from the mainframe and data coming from 
basex.
>  >
>  > The user’s browser calls the web service that runs within basex 
(directly or from another web application). That web service includes ca

Re: [basex-talk] Architecture question

2017-10-27 Thread Kendall Shaw
HI,

I would think so. But, if you mean using RMI to call functions in BaseX, it’s 
probably a better idea to run basex on both and use the BaseX client API or 
REST.

Kendall

On 10/27/17, 8:13 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:

Kendall,

 I've now got a java server running that can accept a connection 
from my mainframe code.

 In the scenario you have below, would it be possible to have the 
imported module use RMI to communicate with the java communication server?

 Regards,

 -- Dave



On 10/19/2017 8:48 PM, Kendall Shaw wrote:
> Yes. The section in the documentation about RESTXQ shows how XQuery can 
be used to handle HTTP requests. The part about REST shows a way to execute 
queries (programs) and commands over HTTP. BaseX comes with a servlet that can 
run in a web server. The servlet is a java class that is executed by the java 
vm that is running the web server. The servlet also runs the native basex 
server. BaseX also includes a web server that can be used instead of a web 
server outside of BaseX.
>   
> The section in the documentation about Java bindings shows how you can 
create modules that implement XQuery functions in java (or whatever JVM 
language). In xquery like:
>
> Import module namespace d = “ http: //duke-software.com/xml “;
>
> d:compute()
>
> The function d:compute() could be implemented in java so you are 
executing java by invoking the function.
>
> The XQuery that implements a web application could use the module that 
includes the java functions that interact with the mainframe to communicate 
with a service listening in the mainframe. That is driven by the web 
application.
>
> To  cause basex to handle communication from the second task, you could 
use threads but instead of what I said in the last post, it might be better to 
have the program that interacts with the mainframe run as  a separate OS 
service that handles data coming from the mainframe and data coming from basex.
>
> The user’s browser calls the web service that runs within basex (directly 
or from another web application). That web service includes calls to xquery 
functions that directly communicate with the mainframe over sockets or the 
separate OS service.
>
> The second task could communicate with the OS service that executes 
XQuery in basex and receives data from BaseX which it send to the mainframe.
>
> If you implement xquery functions in java you probably would need to look 
at the examples in the basex source in the basex-examples directory.
>
> Kendall
>
> On 10/19/17, 2:24 PM, "basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:
>
>  It is your last sentence that I don't understand, due to my lack of
>  knowledge of most all things Basex.
>  
>  The Java code that does the communication would be a function that is
>  called from within a running Basex server?
>  
>   -- Dave
>  
>  
>  On 10/19/2017 4:12 PM, Kendall Shaw wrote:
>  > If the desktop code can be java, then it could be like:
>  >
>  > A web application running in basex serves the web page that is UI 
for the user.
>  >
>  > That web application uses the module that you wrote in java to 
connect and send and receive data with the mainframe for your 2 tasks. The 
module is used in the web application as xquery functions.
>  >
>  > Kendall
>  >
>  > On 10/19/17, 1:57 PM, "basex-talk-boun...@mailman.uni-konstanz.de 
on behalf of Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:
>  >
>  >  I googled websockets, and sure enough, the RFC talks about 
the HTTP
>  >  protocol.  I'm not going to try to code that.
>  >
>  >  I've been in this business long enough to know there are 
always multiple
>  >  ways to get something done.  I've got a lot of time invested 
in code
>  >  that creates both schema and xml for my data, and really 
don't want to
>  >  throw that time and effort away.
>  >
>  >  Your suggestion earlier of having a piece of code running on 
a desktop
>  >  external to Basex to provide the communication link probably 
would work

Re: [basex-talk] Architecture question

2017-10-19 Thread Kendall Shaw
Yes. The section in the documentation about RESTXQ shows how XQuery can be used 
to handle HTTP requests. The part about REST shows a way to execute queries 
(programs) and commands over HTTP. BaseX comes with a servlet that can run in a 
web server. The servlet is a java class that is executed by the java vm that is 
running the web server. The servlet also runs the native basex server. BaseX 
also includes a web server that can be used instead of a web server outside of 
BaseX.
 
The section in the documentation about Java bindings shows how you can create 
modules that implement XQuery functions in java (or whatever JVM language). In 
xquery like:

Import module namespace d = “ http: //duke-software.com/xml “;

d:compute()

The function d:compute() could be implemented in java so you are executing java 
by invoking the function.

The XQuery that implements a web application could use the module that includes 
the java functions that interact with the mainframe to communicate with a 
service listening in the mainframe. That is driven by the web application.

To  cause basex to handle communication from the second task, you could use 
threads but instead of what I said in the last post, it might be better to have 
the program that interacts with the mainframe run as  a separate OS service 
that handles data coming from the mainframe and data coming from basex.

The user’s browser calls the web service that runs within basex (directly or 
from another web application). That web service includes calls to xquery 
functions that directly communicate with the mainframe over sockets or the 
separate OS service.

The second task could communicate with the OS service that executes XQuery in 
basex and receives data from BaseX which it send to the mainframe.

If you implement xquery functions in java you probably would need to look at 
the examples in the basex source in the basex-examples directory.

Kendall

On 10/19/17, 2:24 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:

It is your last sentence that I don't understand, due to my lack of 
knowledge of most all things Basex.

The Java code that does the communication would be a function that is 
called from within a running Basex server?

 -- Dave


On 10/19/2017 4:12 PM, Kendall Shaw wrote:
> If the desktop code can be java, then it could be like:
>
> A web application running in basex serves the web page that is UI for the 
user.
>
> That web application uses the module that you wrote in java to connect 
and send and receive data with the mainframe for your 2 tasks. The module is 
used in the web application as xquery functions.
>
> Kendall
>
> On 10/19/17, 1:57 PM, "basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:
>
>  I googled websockets, and sure enough, the RFC talks about the HTTP
>  protocol.  I'm not going to try to code that.
>  
>  I've been in this business long enough to know there are always 
multiple
>  ways to get something done.  I've got a lot of time invested in code
>  that creates both schema and xml for my data, and really don't want 
to
>  throw that time and effort away.
>  
>  Your suggestion earlier of having a piece of code running on a 
desktop
>  external to Basex to provide the communication link probably would 
work,
>  but it is starting to look kind of like a kluge now, I think.
>  
>  The scenario.
>  
>   Desktop code accepts the connection from the mainframe, and
>  connects to the Basex server.
>  
>   Would have to do a poll of Basex to determine if a new request 
had
>  been added to a request database.
>  
>   User, at a browser, would add a request to the database, and 
then
>  wait for the response.
>  
>   Code doing the poll would get the request and stuff it down the
>  pipe to the mainframe, then go back to its poll.  Needs to be able to
>  recognize when data comes in on the connection as well.
>  
>   Response comes in, and the Basex request database is updated.
>  
>   Basex server sends the response to the browser.
>  
>  Would this work?
>  
>  
>  On 10/19/2017 3:08 PM, Kendall Shaw wrote:
>  > It does: HTTP.
>  >
>  > On 10/19/17, 12:42 PM, "basex-talk-boun...@mailman.uni-konstanz.de 
o

Re: [basex-talk] Architecture question

2017-10-19 Thread Kendall Shaw
If the desktop code can be java, then it could be like:

A web application running in basex serves the web page that is UI for the user.

That web application uses the module that you wrote in java to connect and send 
and receive data with the mainframe for your 2 tasks. The module is used in the 
web application as xquery functions.

Kendall

On 10/19/17, 1:57 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:

I googled websockets, and sure enough, the RFC talks about the HTTP 
protocol.  I'm not going to try to code that.

I've been in this business long enough to know there are always multiple 
ways to get something done.  I've got a lot of time invested in code 
that creates both schema and xml for my data, and really don't want to 
throw that time and effort away.

Your suggestion earlier of having a piece of code running on a desktop 
external to Basex to provide the communication link probably would work, 
but it is starting to look kind of like a kluge now, I think.

The scenario.

 Desktop code accepts the connection from the mainframe, and 
connects to the Basex server.

 Would have to do a poll of Basex to determine if a new request had 
been added to a request database.

 User, at a browser, would add a request to the database, and then 
wait for the response.

 Code doing the poll would get the request and stuff it down the 
pipe to the mainframe, then go back to its poll.  Needs to be able to 
recognize when data comes in on the connection as well.

 Response comes in, and the Basex request database is updated.

 Basex server sends the response to the browser.

Would this work?


On 10/19/2017 3:08 PM, Kendall Shaw wrote:
> It does: HTTP.
>
> On 10/19/17, 12:42 PM, "basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:
>
>  Unless websockets has some protocol sitting on top of standard TCP/IP
>  communication, there shouldn't be an issue.
>  
>  
    >  
>  On 10/19/2017 2:29 PM, Kendall Shaw wrote:
>  >   On 10/19/17, 10:54 AM, "Christian Grün" 
<christian.gr...@gmail.com> wrote:
>  >
>  >  @Kendall:
>  >
>  >  > If I understood, it was connecting from mainframe to the 
BaseX server over a socket that was wanted (I assume that means TCP). I think 
that websockets don’t connect to TCP sockets, without HTTP on both sides to 
establish the connection. So, if using HTTP would require implementing  HTTP 
(or parts of it) in assembly language, that is not trivial, possibly.
>  >
>  >  Yes, exactly.
>  >
>  >
>  >  @Marco:
>  >
>  >  > not only browser clients but all other application (written 
in Java, nodeJS, Python ...) supporting websocket client libraries I suppose! 
;-)
>  >
>  >  Quite definitely! I’ll knock at your door once the first beta 
versions
>  >  will be around. If you believe you can give some helpful 
input on the
>  >  feature design in the GitHub issue, your feedback will be 
welcome.
>  >
>  > Great, in general. But, if one side is on the mainframe unless 
there is a websocket library there the problem would be the same.
>  >
>  > Kendall
>  >
>  >  > On 10/19/17, 10:15 AM, 
"basex-talk-boun...@mailman.uni-konstanz.de on behalf of Marco Lettere" 
<basex-talk-boun...@mailman.uni-konstanz.de on behalf of m.lett...@gmail.com> 
wrote:
>  >  >
>  >  > Hi,
>  >  > not only browser clients but all other application 
(written in Java,
>  >  > nodeJS, Python ...) supporting websocket client 
libraries I suppose! ;-)
>  >  > Waiting eagerly for it ...
>  >  > M.
>  >  >
>  >  > On 19/10/2017 19:08, Christian Grün wrote:
>  >  > > Hi Dave,
>  >  > >
>  >  > > Kendall has already given you all relevant 
information (thanks!).
>  >  > >
>  >  > > Very early client bindings of BaseX provided support 
for bidirectional
>  >  > > connections. As the fu

Re: [basex-talk] Architecture question

2017-10-19 Thread Kendall Shaw
It does: HTTP.

On 10/19/17, 12:42 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:

Unless websockets has some protocol sitting on top of standard TCP/IP 
communication, there shouldn't be an issue.



On 10/19/2017 2:29 PM, Kendall Shaw wrote:
>   On 10/19/17, 10:54 AM, "Christian Grün" <christian.gr...@gmail.com> 
wrote:
>
>  @Kendall:
>  
>  > If I understood, it was connecting from mainframe to the BaseX 
server over a socket that was wanted (I assume that means TCP). I think that 
websockets don’t connect to TCP sockets, without HTTP on both sides to 
establish the connection. So, if using HTTP would require implementing  HTTP 
(or parts of it) in assembly language, that is not trivial, possibly.
>  
>  Yes, exactly.
>  
>  
>  @Marco:
>  
>  > not only browser clients but all other application (written in 
Java, nodeJS, Python ...) supporting websocket client libraries I suppose! ;-)
>  
>  Quite definitely! I’ll knock at your door once the first beta 
versions
>  will be around. If you believe you can give some helpful input on the
>  feature design in the GitHub issue, your feedback will be welcome.
>  
> Great, in general. But, if one side is on the mainframe unless there is a 
websocket library there the problem would be the same.
>
> Kendall
>  
>  > On 10/19/17, 10:15 AM, "basex-talk-boun...@mailman.uni-konstanz.de 
on behalf of Marco Lettere" <basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of m.lett...@gmail.com> wrote:
>  >
>  > Hi,
>  > not only browser clients but all other application (written in 
Java,
>  > nodeJS, Python ...) supporting websocket client libraries I 
suppose! ;-)
>  > Waiting eagerly for it ...
>  > M.
>  >
>  > On 19/10/2017 19:08, Christian Grün wrote:
>  > > Hi Dave,
>  > >
>  > > Kendall has already given you all relevant information 
(thanks!).
>  > >
>  > > Very early client bindings of BaseX provided support for 
bidirectional
>  > > connections. As the functionality was rarely used, and as 
only a few
>  > > bindings supported this part of the protocol, it was 
eventually
>  > > dropped. If you scan the history of our Wiki and the Github 
sources,
>  > > you will probably stumble upon the code snippets.
>  > >
>  > > The major reason is that most of today’s applications that 
are
>  > > interactive and are built on top of BaseX rely on HTTP. As 
soon as
>  > > WebSockets will be available [1], it will be possible to 
send data to
>  > > browser clients.
>  > >
>  > > Hope this helps,
>  > > Christian
>  > >
>  > > [1] 
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_BaseXdb_basex_issues_1449=DwIDaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=HTzHEkqTVFJxI8dfoxQV2nh-Sx_PWJdIVZl7i7EiaAM=EE2LEkklhkn_5oQHObR67dH0aMbWgLwEP9Zcx5JHmYM=
>  > >
>  > >
>  > >
>  > > On Thu, Oct 19, 2017 at 7:01 PM, Dave Day 
<david@duke-software.com> wrote:
>  > >> Hi Kendall,
>  > >>
>  > >>  Thanks for the response.
>  > >>
>  > >>  Seems to me there ought to be some way to get a Basex 
server to write  a
>  > >> data stream to a socket other than as the result of running 
a query or a
>  > >> command.
>  > >>
>  > >>  Maybe someone from the Basex developers group  will 
chime in here.
>  > >>
>  > >>  -- Dave
>  > >>
>  > >>
>  > >>
>  > >> On 10/18/2017 7:56 PM, Kendall Shaw wrote:
>  > >>> Someone can probably give a better answer. As far as I 
know there are no
>  > >>> xquery socket io functions provided with basex. You can 
write java to do
>  &g

Re: [basex-talk] Architecture question

2017-10-19 Thread Kendall Shaw
 On 10/19/17, 10:54 AM, "Christian Grün" <christian.gr...@gmail.com> wrote:

@Kendall:

> If I understood, it was connecting from mainframe to the BaseX server 
over a socket that was wanted (I assume that means TCP). I think that 
websockets don’t connect to TCP sockets, without HTTP on both sides to 
establish the connection. So, if using HTTP would require implementing  HTTP 
(or parts of it) in assembly language, that is not trivial, possibly.

Yes, exactly.


@Marco:

> not only browser clients but all other application (written in Java, 
nodeJS, Python ...) supporting websocket client libraries I suppose! ;-)

Quite definitely! I’ll knock at your door once the first beta versions
will be around. If you believe you can give some helpful input on the
feature design in the GitHub issue, your feedback will be welcome.

Great, in general. But, if one side is on the mainframe unless there is a 
websocket library there the problem would be the same.

Kendall

> On 10/19/17, 10:15 AM, "basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of Marco Lettere" <basex-talk-boun...@mailman.uni-konstanz.de on behalf 
of m.lett...@gmail.com> wrote:
>
> Hi,
> not only browser clients but all other application (written in Java,
> nodeJS, Python ...) supporting websocket client libraries I suppose! 
;-)
> Waiting eagerly for it ...
> M.
>
> On 19/10/2017 19:08, Christian Grün wrote:
> > Hi Dave,
> >
> > Kendall has already given you all relevant information (thanks!).
> >
> > Very early client bindings of BaseX provided support for 
bidirectional
> > connections. As the functionality was rarely used, and as only a few
> > bindings supported this part of the protocol, it was eventually
> > dropped. If you scan the history of our Wiki and the Github sources,
> > you will probably stumble upon the code snippets.
> >
> > The major reason is that most of today’s applications that are
> > interactive and are built on top of BaseX rely on HTTP. As soon as
> > WebSockets will be available [1], it will be possible to send data 
to
> > browser clients.
> >
> > Hope this helps,
> > Christian
> >
> > [1] 
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_BaseXdb_basex_issues_1449=DwIDaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=HTzHEkqTVFJxI8dfoxQV2nh-Sx_PWJdIVZl7i7EiaAM=EE2LEkklhkn_5oQHObR67dH0aMbWgLwEP9Zcx5JHmYM=
> >
> >
> >
> > On Thu, Oct 19, 2017 at 7:01 PM, Dave Day 
<david@duke-software.com> wrote:
> >> Hi Kendall,
> >>
> >>  Thanks for the response.
> >>
> >>  Seems to me there ought to be some way to get a Basex server 
to write  a
> >> data stream to a socket other than as the result of running a 
query or a
> >> command.
> >>
> >>  Maybe someone from the Basex developers group  will chime in 
here.
> >>
> >>  -- Dave
> >>
> >>
> >>
> >> On 10/18/2017 7:56 PM, Kendall Shaw wrote:
> >>> Someone can probably give a better answer. As far as I know there 
are no
> >>> xquery socket io functions provided with basex. You can write 
java to do
> >>> that or you can use an external process that communicates with 
the mainframe
> >>> and invoke that process from xquery, among other solutions. If 
you write
> >>> java you could look at the basex source to imitate how it uses 
sockets
> >>> and/or read about socket io in java. With that you could poll or 
send and
> >>> receive data to from the mainframe.
> >>>
> >>> To know if the mainframe connection is connected, I think you can 
use the
> >>> admin:sessions() function to see if it is connected or your 
program that
> >>> does the io could indicate that it is not connected if it can’t 
communicate.
> >>>
> >>> If you use xquery and RESTXQ to write the web application, and 
the same
> >>> basex instance is communicating with the mainframe then the 
xquery in your
> >>> application is already running in the basex server.
>

Re: [basex-talk] Architecture question

2017-10-19 Thread Kendall Shaw
Hi,

If I understood, it was connecting from mainframe to the BaseX server over a 
socket that was wanted (I assume that means TCP). I think that websockets don’t 
connect to TCP sockets, without HTTP on both sides to establish the connection. 
So, if using HTTP would require implementing  HTTP (or parts of it) in assembly 
language, that is not trivial, possibly.

As far as BaseX writing a data stream without a query or a command, using 
BaseX, even if it is for nothing but storage, implies executing queries 
(programs) or commands.

I guess you could have the mainframe side be the only use of sockets. The 
mainframe application would initiate queries and commands and then poll to see 
if BaseX has changes that were introduced by the web application.

Kendall

On 10/19/17, 10:15 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Marco Lettere" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
m.lett...@gmail.com> wrote:

Hi,
not only browser clients but all other application (written in Java, 
nodeJS, Python ...) supporting websocket client libraries I suppose! ;-)
Waiting eagerly for it ...
M.

On 19/10/2017 19:08, Christian Grün wrote:
> Hi Dave,
>
> Kendall has already given you all relevant information (thanks!).
>
> Very early client bindings of BaseX provided support for bidirectional
> connections. As the functionality was rarely used, and as only a few
> bindings supported this part of the protocol, it was eventually
> dropped. If you scan the history of our Wiki and the Github sources,
> you will probably stumble upon the code snippets.
>
> The major reason is that most of today’s applications that are
> interactive and are built on top of BaseX rely on HTTP. As soon as
> WebSockets will be available [1], it will be possible to send data to
> browser clients.
>
> Hope this helps,
> Christian
>
> [1] 
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_BaseXdb_basex_issues_1449=DwIDaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=HTzHEkqTVFJxI8dfoxQV2nh-Sx_PWJdIVZl7i7EiaAM=EE2LEkklhkn_5oQHObR67dH0aMbWgLwEP9Zcx5JHmYM=
>
>
>
> On Thu, Oct 19, 2017 at 7:01 PM, Dave Day <david@duke-software.com> 
wrote:
>> Hi Kendall,
>>
>>  Thanks for the response.
>>
>>  Seems to me there ought to be some way to get a Basex server to 
write  a
>> data stream to a socket other than as the result of running a query or a
>> command.
>>
>>  Maybe someone from the Basex developers group  will chime in here.
>>
>>  -- Dave
>>
>>
>>
>> On 10/18/2017 7:56 PM, Kendall Shaw wrote:
>>> Someone can probably give a better answer. As far as I know there are no
>>> xquery socket io functions provided with basex. You can write java to do
>>> that or you can use an external process that communicates with the 
mainframe
>>> and invoke that process from xquery, among other solutions. If you write
>>> java you could look at the basex source to imitate how it uses sockets
>>> and/or read about socket io in java. With that you could poll or send 
and
>>> receive data to from the mainframe.
>>>
>>> To know if the mainframe connection is connected, I think you can use 
the
>>> admin:sessions() function to see if it is connected or your program that
>>> does the io could indicate that it is not connected if it can’t 
communicate.
>>>
>>> If you use xquery and RESTXQ to write the web application, and the same
>>> basex instance is communicating with the mainframe then the xquery in 
your
>>> application is already running in the basex server.
>>>
>>> For the second task it’s the same idea. You will need to read about how
>>> updating works:
>>>
>>>
https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_XQuery-5FUpdate=DwIDaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=HTzHEkqTVFJxI8dfoxQV2nh-Sx_PWJdIVZl7i7EiaAM=_pSKI0JdH9q6EQwFZt5180gq24TDNk9RHCCCU9529v4=
>>>
>>> Or, reading this would tell you a lot:
>>>
>>> 
https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Table-5Fof-5FContents=DwIDaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=HTzHEkqTVFJxI8dfoxQV2nh-Sx_PWJdIVZl7i7EiaAM=d1UB9tyc9LKqvqvzoP9KPWE9x9Q2Va9Ge5qSYrTsEvA=
>>>
>>

Re: [basex-talk] Architecture question

2017-10-18 Thread Kendall Shaw
Someone can probably give a better answer. As far as I know there are no xquery 
socket io functions provided with basex. You can write java to do that or you 
can use an external process that communicates with the mainframe and invoke 
that process from xquery, among other solutions. If you write java you could 
look at the basex source to imitate how it uses sockets and/or read about 
socket io in java. With that you could poll or send and receive data to from 
the mainframe.

To know if the mainframe connection is connected, I think you can use the 
admin:sessions() function to see if it is connected or your program that does 
the io could indicate that it is not connected if it can’t communicate.

If you use xquery and RESTXQ to write the web application, and the same basex 
instance is communicating with the mainframe then the xquery in your 
application is already running in the basex server.

For the second task it’s the same idea. You will need to read about how 
updating works:

 http://docs.basex.org/wiki/XQuery_Update

Or, reading this would tell you a lot:

http://docs.basex.org/wiki/Table_of_Contents

Kendall

On 10/18/17, 3:22 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Dave Day"  wrote:

Greetings list,

 I have an idea of how I want to use Basex, and would like to know 
if what I am wanting to do will work.

 My background is IBM mainframe, so the terminology I use is 
influenced by that.

 I have a server running in an address space on a mainframe. Within 
that address space are multiple tasks active.  I believe the term task 
is equivalent to a thread in the distributed world.

 I would like to have a task initialize when my server comes up and 
establish a connection to an instance of a Basex server. This task would 
be responsible for processing requests that come in from the Basex server.

 On a browser, I want to have a user connect to an instance of the 
Basex HTTP server.  From the manual, it states that if the HTTP server 
is started, the client server is started as well.  I don't know if this 
is all one instance of a Basex, or if there are actually two processes 
that get established.   The HTTP server will need to know if the 
connection has been established between the mainframe and the client 
server.  Is this possible, and if so, how would that be accomplished?

 Assuming that the user on the browser needs some information from 
my mainframe server, is there a mechanism in place to facilitate the 
HTTP server sending the request to the client server, and the client 
server sending the request to the mainframe.  Would the mainframe have 
to do a poll of some kind to see if there was data, or can the client 
server push the request out across the connection?

 If the above works, that is, Basex acting as a message broker 
between a browser and the mainframe, I want to be able to create another 
connection from another task on the mainframe to the Basex client server 
as a result of a user request on a browser, have that 2nd task create a 
new database, and start pushing xml across that 2nd connection.  While 
that new database is being updated from the mainframe, can the user on 
the browser query the new database to get the most current data?

 Regards,

 -- Dave Day





Re: [basex-talk] AUTHMETHOD = Custom

2017-10-17 Thread Kendall Shaw
Ok. So, you don’t need an http server. You can run the BaseX server and use the 
native protocol. I have not done that.

The documentation about AUTHMETHOD says it concerns using HTTP.

Have you looked at the example in this:

http://docs.basex.org/wiki/Server_Protocol

In the example on the URL above, I think the third Client line is sending the 
hash and nonce.

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Dave Day 
<david@duke-software.com>
Date: Tuesday, October 17, 2017 at 3:06 PM
To: "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] AUTHMETHOD = Custom


Kendall,

I don't really understand enough about non-mainframe programming to really 
know for sure, but I don't think I want to get into writing code that has to 
construct HTTP dialog to communicate.

What I am wanting to do is to connect to the Basex server, give it the 
command(s) necessary to create a database, and then push xml across the 
connection.

From the Server Protocol



  1.  Client connects to server socket
  2.  Server sends a realm and nonce, separated by a colon: {realm:nonce}
  3.  Client sends the user name and a hash value. The hash is composed of the 
md5 hash of
 *   the md5 hash of the user name, realm, and password (all separated by a 
colon), and
 *   the nonce: {username} {md5(md5(username:realm:password) + nonce)}
  4.  Server replies with \00 (success) or \01 (error)

A big part of my problem is that I am an assembler language programmer that 
does not understand how to interpret a lot of the doc that I read.  Bear with 
me if you will.

I've found a routine on my platform that I can call that will create an MD5 
hash value.  Lets say I wanted to use the default logon id of 'admin'.  I am 
interpreting the doc that I have to make two calls to my routine.

The 1st call would create a hash using admin:realm value:admin.  That is 
number 1. under the item 3.

But, what is it telling me with number 2. ??

I'm used to filling out a parm list with the correct values, then pointing 
R1 to the parmlist in storage, and calling a routine.  Then check the return 
code that comes back from the call that is usually in R15that kind of stuff.

And then I've got the difference in code pages to take into consideration, 
I believe.  The data I get from  the server is ascii.

-- Dave







On 10/17/2017 4:39 PM, Kendall Shaw wrote:
Hi,

If you are using the http server because you plan to use basex over HTTP and 
you don’t want to require any authentication, then what I suggested should work.

For example, your program would use the HTTP protocol to interact with BaseX 
over REST:

http://docs.basex.org/wiki/REST<https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_REST=DwMDaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=ShUCNFqxyM51vqFlfV_61r6DOxWyhxLI_39_3HzvU1w=BKq2g4_XQG-thvH8sFeosCSy5443quD_ZDjHrZcip8k=>

You could also write your basex side applications using RESTXQ and define your 
own protocol over HTTP for your z/OS program to use.

If you don’t want to use HTTP then you don’t need the HTTP server and can 
communicate with BaseX using its native protocol (I have not tried that):

http://docs.basex.org/wiki/Server_Protocol<https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Server-5FProtocol=DwMDaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=ShUCNFqxyM51vqFlfV_61r6DOxWyhxLI_39_3HzvU1w=VFUOQjesvCO0qGrZN69dTWVe2-uyxeTCmwuBHBxCrCA=>

If you can run Java on z/OS  and you can use the basex java libraries, you 
could use one of the wrappers over the server protocol (that’s what I use in 
one case). Or you could embed basex within your java application.

Kendall

From: 
<basex-talk-boun...@mailman.uni-konstanz.de><mailto:basex-talk-boun...@mailman.uni-konstanz.de>
 on behalf of Dave Day 
<david@duke-software.com><mailto:david@duke-software.com>
Date: Tuesday, October 17, 2017 at 2:26 PM
To: 
"basex-talk@mailman.uni-konstanz.de"<mailto:basex-talk@mailman.uni-konstanz.de> 
<basex-talk@mailman.uni-konstanz.de><mailto:basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] AUTHMETHOD = Custom


Kendall,

   I did not make myself clear(again).  Please forgive.

I've got my own application executing on an IBM z/OS platform that I want 
to have connect to the Basex server.  This is not a browser that is trying to 
connect.

In the .bin file are scripts to start a server, and also what looks like an 
http server.

The doc specifically mentions HTTP server, so maybe this doesn't apply to 
the non-HTTP server.

I'm trying to figure out how to construct the response for the realm:nonce 
that the server sent, but not having a whole lot of luck so far.

Regards,

--

Re: [basex-talk] AUTHMETHOD = Custom

2017-10-17 Thread Kendall Shaw
The HTTP parts that I suggested are using basicauth but with a password that is 
not intended to be secret.

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Tuesday, October 17, 2017 at 2:39 PM
To: "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] AUTHMETHOD = Custom

Hi,

If you are using the http server because you plan to use basex over HTTP and 
you don’t want to require any authentication, then what I suggested should work.

For example, your program would use the HTTP protocol to interact with BaseX 
over REST:

http://docs.basex.org/wiki/REST<https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_REST=DwMGaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=sJquPOR3mFGl6JLTfVzXh6chpwiPJxkXTQfcN9mqjVY=KtQOYE378YvZSOyAi-pOV41YNUqJw4sZ7Cjs-C25e8A=>

You could also write your basex side applications using RESTXQ and define your 
own protocol over HTTP for your z/OS program to use.

If you don’t want to use HTTP then you don’t need the HTTP server and can 
communicate with BaseX using its native protocol (I have not tried that):

http://docs.basex.org/wiki/Server_Protocol<https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Server-5FProtocol=DwMGaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=sJquPOR3mFGl6JLTfVzXh6chpwiPJxkXTQfcN9mqjVY=Q4-6DHjGqOrNElaaIySy9zHIDaOGgpMecijIvMT2lAY=>

If you can run Java on z/OS  and you can use the basex java libraries, you 
could use one of the wrappers over the server protocol (that’s what I use in 
one case). Or you could embed basex within your java application.

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Dave Day 
<david@duke-software.com>
Date: Tuesday, October 17, 2017 at 2:26 PM
To: "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] AUTHMETHOD = Custom


Kendall,

   I did not make myself clear(again).  Please forgive.

I've got my own application executing on an IBM z/OS platform that I want 
to have connect to the Basex server.  This is not a browser that is trying to 
connect.

In the .bin file are scripts to start a server, and also what looks like an 
http server.

The doc specifically mentions HTTP server, so maybe this doesn't apply to 
the non-HTTP server.

I'm trying to figure out how to construct the response for the realm:nonce 
that the server sent, but not having a whole lot of luck so far.

Regards,

-- Dave





On 10/17/2017 4:05 PM, Kendall Shaw wrote:
From: 
<basex-talk-boun...@mailman.uni-konstanz.de><mailto:basex-talk-boun...@mailman.uni-konstanz.de>
 on behalf of Dave Day 
<david@duke-software.com><mailto:david@duke-software.com>
Date: Tuesday, October 17, 2017 at 9:53 AM
To: 
"basex-talk@mailman.uni-konstanz.de"<mailto:basex-talk@mailman.uni-konstanz.de> 
<basex-talk@mailman.uni-konstanz.de><mailto:basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] AUTHMETHOD = Custom


Greetings list,

In the Basex configuration file, I added

AUTHMETHOD = Custom

After starting the server, the 1st response I get from the server when I 
connect to it is the realm:nonce values.

In the Basex manual, it states for AUTHMETHOD

Specifies the default authentication method, which will be used by the HTTP 
server for negotiating
credentials. Allowed values are Basic, Digest, and Custom:

With custom authentication, the server will not do any authentication.



Is it possible to connect to Basex server without going thru any 
authentication?



Someone probably has a better answer than this. Web applications that you write 
using RESTXQ don’t have to require authentication. So, if RESTXQ fits with what 
you want to do, that would be one way to not require authentication for your 
applications. You could also create a user with a throw away password like 
“password”, grant the user admin permissions and then you can use that user to 
use BaseX REST functions or command from the basex server (not http).

For example, if you create user test with password test and granted the user 
admin, then:

http://test:test@localhost:8984/basex/rest?command=list<https://urldefense.proofpoint.com/v2/url?u=http-3A__test-3Atest-40localhost-3A8984_basex_rest-3Fcommand-3Dlist=DwMDaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=Ze_U47kGtTu-2O8cxVr7alsbVXakXZ_8jTguLi_wX6I=VrkNYPC-2STvUlL_88t0d6bsOfFoxVcCy2uZ7HJ4dtM=>

Also, by default admin user’s password is admin.

Or you could embed basex within a java application.



Kendall









Re: [basex-talk] AUTHMETHOD = Custom

2017-10-17 Thread Kendall Shaw
Hi,

If you are using the http server because you plan to use basex over HTTP and 
you don’t want to require any authentication, then what I suggested should work.

For example, your program would use the HTTP protocol to interact with BaseX 
over REST:

http://docs.basex.org/wiki/REST

You could also write your basex side applications using RESTXQ and define your 
own protocol over HTTP for your z/OS program to use.

If you don’t want to use HTTP then you don’t need the HTTP server and can 
communicate with BaseX using its native protocol (I have not tried that):

http://docs.basex.org/wiki/Server_Protocol

If you can run Java on z/OS  and you can use the basex java libraries, you 
could use one of the wrappers over the server protocol (that’s what I use in 
one case). Or you could embed basex within your java application.

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Dave Day 
<david@duke-software.com>
Date: Tuesday, October 17, 2017 at 2:26 PM
To: "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] AUTHMETHOD = Custom


Kendall,

   I did not make myself clear(again).  Please forgive.

I've got my own application executing on an IBM z/OS platform that I want 
to have connect to the Basex server.  This is not a browser that is trying to 
connect.

In the .bin file are scripts to start a server, and also what looks like an 
http server.

The doc specifically mentions HTTP server, so maybe this doesn't apply to 
the non-HTTP server.

I'm trying to figure out how to construct the response for the realm:nonce 
that the server sent, but not having a whole lot of luck so far.

Regards,

-- Dave





On 10/17/2017 4:05 PM, Kendall Shaw wrote:
From: 
<basex-talk-boun...@mailman.uni-konstanz.de><mailto:basex-talk-boun...@mailman.uni-konstanz.de>
 on behalf of Dave Day 
<david@duke-software.com><mailto:david@duke-software.com>
Date: Tuesday, October 17, 2017 at 9:53 AM
To: 
"basex-talk@mailman.uni-konstanz.de"<mailto:basex-talk@mailman.uni-konstanz.de> 
<basex-talk@mailman.uni-konstanz.de><mailto:basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] AUTHMETHOD = Custom


Greetings list,

In the Basex configuration file, I added

AUTHMETHOD = Custom

After starting the server, the 1st response I get from the server when I 
connect to it is the realm:nonce values.

In the Basex manual, it states for AUTHMETHOD

Specifies the default authentication method, which will be used by the HTTP 
server for negotiating
credentials. Allowed values are Basic, Digest, and Custom:

With custom authentication, the server will not do any authentication.



Is it possible to connect to Basex server without going thru any 
authentication?



Someone probably has a better answer than this. Web applications that you write 
using RESTXQ don’t have to require authentication. So, if RESTXQ fits with what 
you want to do, that would be one way to not require authentication for your 
applications. You could also create a user with a throw away password like 
“password”, grant the user admin permissions and then you can use that user to 
use BaseX REST functions or command from the basex server (not http).

For example, if you create user test with password test and granted the user 
admin, then:

http://test:test@localhost:8984/basex/rest?command=list<https://urldefense.proofpoint.com/v2/url?u=http-3A__test-3Atest-40localhost-3A8984_basex_rest-3Fcommand-3Dlist=DwMDaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=Ze_U47kGtTu-2O8cxVr7alsbVXakXZ_8jTguLi_wX6I=VrkNYPC-2STvUlL_88t0d6bsOfFoxVcCy2uZ7HJ4dtM=>

Also, by default admin user’s password is admin.

Or you could embed basex within a java application.



Kendall








Re: [basex-talk] AUTHMETHOD = Custom

2017-10-17 Thread Kendall Shaw
From:  on behalf of Dave Day 

Date: Tuesday, October 17, 2017 at 9:53 AM
To: "basex-talk@mailman.uni-konstanz.de" 
Subject: [basex-talk] AUTHMETHOD = Custom


Greetings list,

In the Basex configuration file, I added

AUTHMETHOD = Custom

After starting the server, the 1st response I get from the server when I 
connect to it is the realm:nonce values.

In the Basex manual, it states for AUTHMETHOD

Specifies the default authentication method, which will be used by the HTTP 
server for negotiating
credentials. Allowed values are Basic, Digest, and Custom:

With custom authentication, the server will not do any authentication.



Is it possible to connect to Basex server without going thru any 
authentication?



Someone probably has a better answer than this. Web applications that you write 
using RESTXQ don’t have to require authentication. So, if RESTXQ fits with what 
you want to do, that would be one way to not require authentication for your 
applications. You could also create a user with a throw away password like 
“password”, grant the user admin permissions and then you can use that user to 
use BaseX REST functions or command from the basex server (not http).

For example, if you create user test with password test and granted the user 
admin, then:

http://test:test@localhost:8984/basex/rest?command=list

Also, by default admin user’s password is admin.

Or you could embed basex within a java application.



Kendall






Re: [basex-talk] Why am I getting this error with the prolog statement

2017-10-04 Thread Kendall Shaw
On 10/3/17, 7:57 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Christian Grün"  wrote:

Hi Dave (cc to the list),

> I am creating xml on an IBM mainframe. The code page used on 
mainframes
> is defined as EBCDIC 0037. 
https://urldefense.proofpoint.com/v2/url?u=https-3A__en.wikipedia.org_wiki_EBCDIC-5F037=DwIBaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=miid_BqIV7JLoVEU1Rw6R1qalH8OKsZl1ca87e9HMcM=PTtt72n66Y0yBVLX3hbg9q6mV2FP3ZfO-PYn7C-PoWU=

As EBCDIC 0037 is limited to 256 characters, a simple mapping should
suffice to convert your text to ISO-8859-1 (see the mapping table in
the Wikipedia entry you referenced). It should be lightning fast, no
matter if you do it in assembler or in XQuery.

Dave,
I, for one, am interested to know what you find, because it is an unusual (for 
me) problem and fun. 

The Hercules people might have advice because they deal with mainframe software 
using gnu tools.

http://www.hercules-390.org/

Kendall



Re: [basex-talk] pyBaseX url

2017-09-26 Thread Kendall Shaw
If pybasex is using http,  the port is probably not 1984. It would be the port 
used by the web server that is serving basex rest services. 1984 would usually 
be the basex server port (not using http).

Kendall

From:  on behalf of Bridger 
Dyson-Smith 
Date: Tuesday, September 26, 2017 at 8:20 AM
To: Andreas Doering 
Cc: BaseX 
Subject: Re: [basex-talk] pyBaseX url

Hi Andreas,

On Sep 26, 2017 10:48, "Andreas Doering" 
> wrote:

Hello all,

I want to use BaseX in a python environment and
found PyBaseX by Luca Lilianas. Unfortunately, the email address associated 
with github does not seem to exist.

What is not clear to me how the url has to be formatted.
I tried
'http://localhost:1984:/rest/'
but got timeouts.
Have you tried 
'http://localhost:1984/rest/';
 e.g. removing the trailing ':'?

I started a basexserver (with default port/user/password)
and I can create and work with my example database with the
the textual client from BaseX.
But I could not find out how I have to format the url parameter so that the 
python interface works.

I created a client by
c = 
BaseXClient('http://localhost:1984:/rest/',default_database=None,user='admin',password='admin')
c.connect
c.create_database('TestName')

The last line hangs in socket read.

The log file does not show anything of that.

Furthermore, it seems, that the current code in github is python2 specific,
or maybe some package it depends on.
I remember that during installation on python3 something broke, so I am using 
python2 in the moment.
Any plans to port to python3?

Regards,

Andreas
I can't speak to the python3 question, apologies.

Best,
Bridger


Re: [basex-talk] java.lang.NoClassDefFoundError: Could not initialize class java.nio.file.FileSystems$DefaultFileSystemHolder

2017-09-18 Thread Kendall Shaw
Or build basex using openjdk.

On 9/18/17, 4:30 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Kendall Shaw" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
kendall.s...@workday.com> wrote:

I don’t know if this helps. It could be because of openjdk vs oracle. In 
FileSystems.java in the oracle JDK getDefault loads:

sun.nio.fs.DefaultFileSystemProvider.create()

I imagine that openjdk wouldn’t use that, perhaps. So, maybe using the 
oracle JDK would work.

Kendall

On 9/18/17, 4:06 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf 
of Liam R. E. Quin" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
l...@w3.org> wrote:

It seems with the latest Java 1.8 -
java-1.8.0-openjdk-headless-1.8.0.144-0.b01.el7_4.x86_64
on Centos 7, I can no longer drop a database, any ideas?

This is with both 8.5.3 and 8.6.6, and also with
the latest snapshot, BaseX867-20170824.195627.zip

[[
$ bin/basexclient -p 1994
Username: admin
Password: 
BaseX 8.6.6 [Client]
Try 'help' to get more information.
> open rdf
Database 'rdf' was opened in 1.61 ms.
> close
Database 'rdf' was closed.
> drop db rdf
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 8.5.3
Java: Oracle Corporation, 1.8.0_131
OS: Linux, amd64
Stack Trace: 
java.lang.NoClassDefFoundError: Could not initialize class 
java.nio.file.FileSystems$DefaultFileSystemHolder
at java.nio.file.FileSystems.getDefault(FileSystems.java:176)
at java.nio.file.Paths.get(Paths.java:84)
at org.basex.io.IOFile.toPath(IOFile.java:335)
at org.basex.io.IOFile.delete(IOFile.java:243)
at org.basex.io.IOFile.delete(IOFile.java:240)
at org.basex.core.cmd.DropDB.drop(DropDB.java:77)
at org.basex.core.cmd.DropDB.run(DropDB.java:46)
at org.basex.core.Command.run(Command.java:253)
at org.basex.core.Command.execute(Command.java:99)
at org.basex.server.ClientListener.run(ClientListener.java:136)

> open rdf
Database 'rdf' was opened in 1.56 ms.
> xquery count(//image)
7370
Query executed in 68.2 ms.
]]



-- 
Liam Quin, W3C, 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.w3.org_People_Quin_=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=nQjzwq1-tGGjgX2B1ykqHFTvIIAsUM7apaVuSdPVWkk=0s_TznyqfelNVXekmL3_FHwI3_ASwudgsnLjh_k5nDM=
 
Staff contact for Verifiable Claims WG, XQuery WG

Web slave for 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.fromoldbooks.org_=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=nQjzwq1-tGGjgX2B1ykqHFTvIIAsUM7apaVuSdPVWkk=9CUbgtTPIfEhIOd76gJHf8kbpM6WP9lLIRPFG7YGLkc=
 






Re: [basex-talk] java.lang.NoClassDefFoundError: Could not initialize class java.nio.file.FileSystems$DefaultFileSystemHolder

2017-09-18 Thread Kendall Shaw
I don’t know if this helps. It could be because of openjdk vs oracle. In 
FileSystems.java in the oracle JDK getDefault loads:

sun.nio.fs.DefaultFileSystemProvider.create()

I imagine that openjdk wouldn’t use that, perhaps. So, maybe using the oracle 
JDK would work.

Kendall

On 9/18/17, 4:06 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Liam R. E. Quin"  wrote:

It seems with the latest Java 1.8 -
java-1.8.0-openjdk-headless-1.8.0.144-0.b01.el7_4.x86_64
on Centos 7, I can no longer drop a database, any ideas?

This is with both 8.5.3 and 8.6.6, and also with
the latest snapshot, BaseX867-20170824.195627.zip

[[
$ bin/basexclient -p 1994
Username: admin
Password: 
BaseX 8.6.6 [Client]
Try 'help' to get more information.
> open rdf
Database 'rdf' was opened in 1.61 ms.
> close
Database 'rdf' was closed.
> drop db rdf
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 8.5.3
Java: Oracle Corporation, 1.8.0_131
OS: Linux, amd64
Stack Trace: 
java.lang.NoClassDefFoundError: Could not initialize class 
java.nio.file.FileSystems$DefaultFileSystemHolder
at java.nio.file.FileSystems.getDefault(FileSystems.java:176)
at java.nio.file.Paths.get(Paths.java:84)
at org.basex.io.IOFile.toPath(IOFile.java:335)
at org.basex.io.IOFile.delete(IOFile.java:243)
at org.basex.io.IOFile.delete(IOFile.java:240)
at org.basex.core.cmd.DropDB.drop(DropDB.java:77)
at org.basex.core.cmd.DropDB.run(DropDB.java:46)
at org.basex.core.Command.run(Command.java:253)
at org.basex.core.Command.execute(Command.java:99)
at org.basex.server.ClientListener.run(ClientListener.java:136)

> open rdf
Database 'rdf' was opened in 1.56 ms.
> xquery count(//image)
7370
Query executed in 68.2 ms.
]]



-- 
Liam Quin, W3C, 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.w3.org_People_Quin_=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=nQjzwq1-tGGjgX2B1ykqHFTvIIAsUM7apaVuSdPVWkk=0s_TznyqfelNVXekmL3_FHwI3_ASwudgsnLjh_k5nDM=
 
Staff contact for Verifiable Claims WG, XQuery WG

Web slave for 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.fromoldbooks.org_=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=nQjzwq1-tGGjgX2B1ykqHFTvIIAsUM7apaVuSdPVWkk=9CUbgtTPIfEhIOd76gJHf8kbpM6WP9lLIRPFG7YGLkc=
 




Re: [basex-talk] Server Variables, cached vars, etc

2017-09-09 Thread Kendall Shaw
The servlet could populate your singleton just once upon startup, or run xquery 
etc. The load-on-startup configuration means that the servlet is initialized 
after basex has been loaded. So, if you restart jetty or whatever web 
server/web container you are using basex restarts and then your servlet’s init 
method is invoked.

Kendall

From: Erik Peterson <e...@ardec.com>
Date: Saturday, September 9, 2017 at 4:16 AM
To: Kendall Shaw <kendall.s...@workday.com>
Cc: "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Server Variables, cached vars, etc

Thanks Kendal for your reply. What would be the advantage of creating a servlet 
over a singleton class to do the same thing?

On Fri, Sep 8, 2017 at 11:12 AM, Kendall Shaw 
<kendall.s...@workday.com<mailto:kendall.s...@workday.com>> wrote:
I thought it might be useful to mention advice I was given about startup hooks:

> From: "Kirsten, Dirk" 
> dirk.kirs...@senacor.com<mailto:dirk.kirs...@senacor.com>
,,,
> 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/<https://urldefense.proofpoint.com/v2/url?u=http-3A__crunchify.com_how-2Dto-2Drun-2Djava-2Dprogram-2Dautomatically-2Don-2Dtomcat-2Dstartup_=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=fPChED25tvjfNbUFkPSuyRBFfpYGFrqPI1DLNeEovLI=0q_rTZpxZNOefv3G77E1Vna_JmrxWcl0OcoKc1EmHAc=>
>  for an example how to do this.

I switched from using a cron job, to doing this in order to schedule jobs.  I 
have very simple servlet that is configured with 
2 (basex has load-on-startup 2). It runs a 
shell script which schedules the jobs, soon after basex is loaded.

Kendall

From: 
<basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>>
 on behalf of Erik Peterson <e...@ardec.com<mailto:e...@ardec.com>>
Date: Tuesday, September 5, 2017 at 7:02 AM
To: Fabrice ETANCHAUD 
<fetanch...@pch.cerfrance.fr<mailto:fetanch...@pch.cerfrance.fr>>, 
"basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>" 
<basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>>
Subject: Re: [basex-talk] Server Variables, cached vars, etc

Thank you all for your replys.  It looks like a main memory database is the 
best "built in" option.  However, I have created Jar file  to drop him/lib with 
a Java Singleton object...holding a map.  That should be  accessible across 
requests and sessions.   The question is how to populate this just once upon 
start up?  Perhaps I could do a job that would do that?  Also I could memoize 
the variables in a global script.  That way the expensive operation is only run 
the first time it is needed.

Any other suggestions welcome.  Recommend that a standard built-in feature  be 
added to handle these scenarios.

On Tue, Sep 5, 2017 at 1:33 AM Fabrice ETANCHAUD 
<fetanch...@pch.cerfrance.fr<mailto:fetanch...@pch.cerfrance.fr>> wrote:
To be confirmed : there is no 'start script' server option.
I do manually create and populate the mainmem db in the dba query interface.

Best regards,
Fabrice

-Message d'origine-
De : Fabrice ETANCHAUD
Envoyé : mardi 5 septembre 2017 09:29
À : 'Marco Lettere'; 
basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>
Objet : RE: [basex-talk] Server Variables, cached vars, etc

Hi all,

Another solution is to share a main memory database, that behaves like a memory 
cache.
In Client/Server mode, any main memory created by one client is available to 
all the other ones.

Best regards,
Fabrice


-Message d'origine-
De : 
basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>
 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>]
 De la part de Marco Lettere Envoyé : mardi 5 septembre 2017 09:14 À : 
basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>
Objet : Re: [basex-talk] Server Variables, cached vars, etc

On 05/09/2017 01:37, Erik Peterson wrote:
> How can I create a variable that is evaluated only once but accessed
> across many RestXQ requests and sessions. I'm trying to cache data
> that comes from an integration with an expensive operation. Does BaseX
> support something similar to server variables like Mark Logic?

Hi Erik,

AFAIK you have the following possibilities to keep a variable live accross 
multiple RestXQ calls:

1) Use session 
http://docs.basex

Re: [basex-talk] Server Variables, cached vars, etc

2017-09-08 Thread Kendall Shaw
I thought it might be useful to mention advice I was given about startup hooks:

> From: "Kirsten, Dirk" 
> dirk.kirs...@senacor.com
,,,
> 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.

I switched from using a cron job, to doing this in order to schedule jobs.  I 
have very simple servlet that is configured with 
2 (basex has load-on-startup 2). It runs a 
shell script which schedules the jobs, soon after basex is loaded.

Kendall

From:  on behalf of Erik Peterson 

Date: Tuesday, September 5, 2017 at 7:02 AM
To: Fabrice ETANCHAUD , 
"basex-talk@mailman.uni-konstanz.de" 
Subject: Re: [basex-talk] Server Variables, cached vars, etc

Thank you all for your replys.  It looks like a main memory database is the 
best "built in" option.  However, I have created Jar file  to drop him/lib with 
a Java Singleton object...holding a map.  That should be  accessible across 
requests and sessions.   The question is how to populate this just once upon 
start up?  Perhaps I could do a job that would do that?  Also I could memoize 
the variables in a global script.  That way the expensive operation is only run 
the first time it is needed.

Any other suggestions welcome.  Recommend that a standard built-in feature  be 
added to handle these scenarios.

On Tue, Sep 5, 2017 at 1:33 AM Fabrice ETANCHAUD 
> wrote:
To be confirmed : there is no 'start script' server option.
I do manually create and populate the mainmem db in the dba query interface.

Best regards,
Fabrice

-Message d'origine-
De : Fabrice ETANCHAUD
Envoyé : mardi 5 septembre 2017 09:29
À : 'Marco Lettere'; 
basex-talk@mailman.uni-konstanz.de
Objet : RE: [basex-talk] Server Variables, cached vars, etc

Hi all,

Another solution is to share a main memory database, that behaves like a memory 
cache.
In Client/Server mode, any main memory created by one client is available to 
all the other ones.

Best regards,
Fabrice


-Message d'origine-
De : 
basex-talk-boun...@mailman.uni-konstanz.de
 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de]
 De la part de Marco Lettere Envoyé : mardi 5 septembre 2017 09:14 À : 
basex-talk@mailman.uni-konstanz.de
Objet : Re: [basex-talk] Server Variables, cached vars, etc

On 05/09/2017 01:37, Erik Peterson wrote:
> How can I create a variable that is evaluated only once but accessed
> across many RestXQ requests and sessions. I'm trying to cache data
> that comes from an integration with an expensive operation. Does BaseX
> support something similar to server variables like Mark Logic?

Hi Erik,

AFAIK you have the following possibilities to keep a variable live accross 
multiple RestXQ calls:

1) Use session 
http://docs.basex.org/wiki/Session_Module

2) Use a database which is builtin in BaseX and is very lightweight.
Especially if your data is serializable to XML you could benefit also from 
indexes to speed up access to your cached objects.

3) Use the file system.

Hope this helps [cit] ;-)

Marco.
--
Erik Peterson
President, Ardec LLC
281-804-9023 | e...@ardec.com


Re: [basex-talk] How do create XML for a one byte hex field that is used as a flag byte

2017-09-07 Thread Kendall Shaw
Sorry for answering a question with a question. Aside from the bit manipulation 
advice given, do you really need to be storing a representation of bits in XML?

Often people store an intermediate form of data in XML. A decoder transforms 
data into the intermediate form when constructing XML and an encoder transforms 
the intermediate form to the external form when serializing the XML. That way 
in XML you are manipulating things like an element named db2-mepl-list rather 
than 0010 or 40.

Kendall

On 9/7/17, 1:01 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Dave Day"  wrote:

Greetings list,

I don't know if I am asking this question correctly.  I'm new to the 
XML world.  I can google this, get some hits, but when I read the posts, 
it is not really clear to me.  Any help is appreciated.

 On an IBM mainframe,  I've got a one byte hex field defined as follows:

   PCDTFLAG DSXL1 FLAG TO INDICATE ORIGIN OF INFO


DTFLENTP EQU   B'1000' INFO CAME FROM MODULE ENTRY POINT
DTFLMEPS EQU   B'0100' DB2 MEPL LIST HAS BEEN SEARCHED
DTFLMEPL EQU   B'0010' INFO CAME FROM DB2 MEPL LIST
DTFLDB2S EQU   B'0001' DSNMODS HAS BEEN SEARHCED
DTFLDSNM EQU   B'1000' INFO CAME FROM DSNMODS SEARCH
DTFLSYST EQU   B'0100' INFO CAME FROM SYSTEM TABLE
DTFLSYSS EQU   B'0010' SYSTEM TABLE HAS BEEN SEARCHED
DTFLCMNC EQU   B'0001' COMMON AND NUC HAS BEEN SEARCHED

 I need to be able to create XML for the field PCDTFLAG.  OK, define 
an element as hexBinary. But then how do I define the bits within the byte.

 On the mainframe side, with the equated values,  I can OR the flag 
byte with the equated value, and this will set the correct bit on in the 
byte.

 OI   PCDTFLAG,DTFLENTPwill turn on bit 0 in the 1 byte field if 
it is not on already.

 I can test for the bit on or off.

 TMPCDTFLAG,DTFLENTP

 JZ  some-other-area-of-code   will branch if the bit is off

 JOanother-area-of-code  will branch if the bit is on

 So, I guess I am asking two questions.  One, how to give definition 
to bits within a byte, and two, how to manipulate and test those defined 
bits.

 Regards,

 -- Dave Day







Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Kendall Shaw
A problem with that is that it evaluates the variable each time. If you need it 
to only evaluate once (expensive operation), something else needs to be done. I 
would like to know an answer to this so that I can schedule jobs on start up 
without involving processes external to basex.

From:  on behalf of Xavier-Laurent 
SALVADOR 
Date: Monday, September 4, 2017 at 11:42 PM
To: Erik Peterson 
Cc: BaseX 
Subject: Re: [basex-talk] Server Variables, cached vars, etc

Hi,

do you mean something like a repo variable ?

If you define a module name in your repo:

 1-  module namespace myNs = 
'http://www.x.fr/-repo’;

You can define in your repo a new variable :

 1-declare variable $myNs:testid :=  
db:open(‘x')/utilisateurs/entry/sessions/session/id=session:id();

Then import your module in your restxq:

  1-   import module namespace isi = 
'http://www.isilex.fr/isi-repo’;

And access your variables:

  1-$myNs:testid

More here: 
http://docs.basex.org/wiki/XQuery_3.0#External_Variables

Sorry If I’m wrong and didn’t understand,

XLS
Le 5 sept. 2017 à 01:37, Erik Peterson > 
a écrit :

How can I create a variable that is evaluated only once but accessed across 
many RestXQ requests and sessions. I'm trying to cache data that comes from an 
integration with an expensive operation. Does BaseX support something similar 
to server variables like Mark Logic?




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

2017-09-03 Thread 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] XML import issue (header related)

2017-09-01 Thread Kendall Shaw
I think my mail client altered my post to move ‘.’ characters to the end of 
what it thinks is a sentence.

This:

e:strip-namespaces().

Is supposed to be this:

e:strip-namespaces(.)

 



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

2017-09-01 Thread Kendall Shaw
On 9/1/17, 1:04 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Martin Honnen"  wrote:

On 01.09.2017 22:01, Alexander Holupirek wrote:
>> On 1. Sep 2017, at 19:41, Ron Katriel  wrote:
>> Is there a way simpler way around this - other than modifying the input 
header to remove the namespace declaration?

> declaring a default element in your XQuery might help?
> 
> ```xquery
> declare default element namespace 
"https://urldefense.proofpoint.com/v2/url?u=http-3A__www.drugbank.ca=DwICaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=txjXxCSiNw_iW8D4o67JHNWxnyvM5vySI1NZIbu5_aI=53cXA-gr8txDllT9Vth7fcG5TfJLR7SbBp_PXu-POYg=
 ";
> 
> for $drug in doc('drugbank.Lepirudin.ATC.fail.xml')/drugbank/drug
> where not(empty($drug/atc-codes/atc-code))
> return  {

But that would also put the result elements into that namespace, not 
sure whether that is wanted.

If all of the documents are similar and there is enough code to justify the 
effort of pre-processing the documents to change the default namespace to no 
namespace, you could do that:

declare namespace e = "http://example.com;;

declare function e:strip-namespaces($node as node()) as node() {
  typeswitch ($node)
  case $node as document-node() return document { 
$node/node()/e:strip-namespaces(.) }
  case $node as element() return element {local-name($node)} { $node/@*, 
$node/node()/e:strip-namespaces(.) }
  default return $node
};

for $drug in e:strip-namespaces(db:open('DrugBankFail'))/drugbank/drug
where not(empty($drug/atc-codes/atc-code))
return  {
   { string-join(distinct-values($drug/name), ' | ') } ,
   { string-join(distinct-values(for $level in 
$drug/atc-codes/atc-code/level return if (fn:string-length($level/@code) = 5) 
then $level/text() else ()), ' | ') } ,
   { string-join(distinct-values(for $level in 
$drug/atc-codes/atc-code/level return if (fn:string-length($level/@code) = 4) 
then $level/text() else ()), ' | ') } ,
   { string-join(distinct-values(for $level in 
$drug/atc-codes/atc-code/level return if (fn:string-length($level/@code) = 3) 
then $level/text() else ()), ' | ') } ,
   { string-join(distinct-values(for $level in 
$drug/atc-codes/atc-code/level return if (fn:string-length($level/@code) = 1) 
then $level/text() else ()), ' | ') } 
} 




Re: [basex-talk] Best practice for storing timestamp information in XML

2017-08-29 Thread Kendall Shaw
Oops. I didn’t mean to click send.

string(xs:time("00:00:00.000") + xs:dayTimeDuration("PT999.S"))

is:

17:46:39.

So, if an element contained microseconds, you could do arithmetic with the 
values and use something like above to format the result.

let $ms := 999
return xs:time('00:00:00.000') + xs:dayTimeDuration(concat('PT',  $ms div 
1, 'S'))

Kendall


On 8/29/17, 6:52 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Kendall Shaw" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
kendall.s...@workday.com> wrote:

I assume these are durations, but I’m not sure if the clock start date is 
relevant. If you can assume it’s not going to span days, my first thought was 
something like:

string(xs:time("00:00:00.000") + xs:dayTimeDuration("PT0.0001S"))

which produces:

00:00:00.0001

The duration is being expressed as an arbitrary number of seconds. 
“PT0.0001S” is 1 microsecond, I think.

The duration added to a time results in a time and the default format is 
what you asked for.

Another example:

string(xs:time("00:00:00.000") + xs:dayTimeDuration("PT999.S"))

is:



On 8/29/17, 12:51 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf 
of Dave Day" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
david@duke-software.com> wrote:

 Greetings List,

 I've got an 8 byte value that is the output of a Store Clock 
instruction on a mainframe.  The value created by the instruction is a 
64 bit hex value where  bit 51 is equal to one microsecond. To get a 
value that is microseconds, the original clock value is shifted to the 
right 12 bits. The clock started at all 0's on January 1st, 1900.

 I need to be able to store and do basic math(addition and 
subtraction) on the value in microseconds.  And, these values will need 
to be displayed on a browser in HH:MM:SS.TT format.

 If I create the decimal value for the integer on the mainframe 
when 
creating the XML record, I will have to go thru some conversion logic.  
There could be possibly millions of these records in one XML database.

 It seems to me to make more sense to create the value as a 
hexBinary element, and then have some code running within  BaseX do the 
conversion to create the correct time value.

 Is this the way to do something like this?

 Regards,

 -- Dave Day







Re: [basex-talk] Best practice for storing timestamp information in XML

2017-08-29 Thread Kendall Shaw
I assume these are durations, but I’m not sure if the clock start date is 
relevant. If you can assume it’s not going to span days, my first thought was 
something like:

string(xs:time("00:00:00.000") + xs:dayTimeDuration("PT0.0001S"))

which produces:

00:00:00.0001

The duration is being expressed as an arbitrary number of seconds. “PT0.0001S” 
is 1 microsecond, I think.

The duration added to a time results in a time and the default format is what 
you asked for.

Another example:

string(xs:time("00:00:00.000") + xs:dayTimeDuration("PT999.S"))

is:



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

 Greetings List,

 I've got an 8 byte value that is the output of a Store Clock 
instruction on a mainframe.  The value created by the instruction is a 
64 bit hex value where  bit 51 is equal to one microsecond. To get a 
value that is microseconds, the original clock value is shifted to the 
right 12 bits. The clock started at all 0's on January 1st, 1900.

 I need to be able to store and do basic math(addition and 
subtraction) on the value in microseconds.  And, these values will need 
to be displayed on a browser in HH:MM:SS.TT format.

 If I create the decimal value for the integer on the mainframe when 
creating the XML record, I will have to go thru some conversion logic.  
There could be possibly millions of these records in one XML database.

 It seems to me to make more sense to create the value as a 
hexBinary element, and then have some code running within  BaseX do the 
conversion to create the correct time value.

 Is this the way to do something like this?

 Regards,

 -- Dave Day





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





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" <dirk.kirs...@senacor.com>
Date: Monday, August 28, 2017 at 12:21 PM
To: Kendall Shaw <kendall.s...@workday.com>, BaseX 
<basex-talk@mailman.uni-konstanz.de>
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/<https://urldefense.proofpoint.com/v2/url?u=http-3A__crunchify.com_how-2Dto-2Drun-2Djava-2Dprogram-2Dautomatically-2Don-2Dtomcat-2Dstartup_=DwMGaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=gOpscG7vkDRSI_XslDmh4eqaDUWLl-AlYsKjjD9n7Rs=H3i0AH5LU5JYG_1guelBQPwLs9FgFlNKzT3qnkjQvbI=>
 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 <basex-talk@mailman.uni-konstanz.de>
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



[basex-talk] Startup hooks or persisting jobs

2017-08-27 Thread Kendall Shaw
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] RESTXQ %input:csv annotation

2017-08-21 Thread Kendall Shaw
Thank you, that worked. And I’ll note that text/csv will be handled when I 
update BaseX.

Kendall

On 8/21/17, 4:22 AM, "Christian Grün" <christian.gr...@gmail.com> wrote:

Hi Kendall,

In BaseX 8.6.5, only "text/comma-separated-values" is detected as CSV
media type, so the following should work:

  curl -XPOST -H"Content-Type: text/comma-separated-values" -data
@some.csv 
"https://urldefense.proofpoint.com/v2/url?u=http-3A__example.com_basex_store.csv=DwIFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=rNboQKVnWnXp-YmOjjhaMZd8_9BoqGIjpH3YIUKgxBE=_HNnJt3O3gQfHwOJD_A5KK3FemeBoPP_FPvYbn_3ZCY=
 "

I noticed that "text/csv" is much more common, and other types such as
"application/csv" as used as well. With [1], all media types with sub
type "csv" or "comma-separated-values" will now be accepted as CSV
input.

Hope this helps,
Christian

[1] 
https://urldefense.proofpoint.com/v2/url?u=http-3A__files.basex.org_releases_latest_=DwIFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=rNboQKVnWnXp-YmOjjhaMZd8_9BoqGIjpH3YIUKgxBE=5F6dQtLLTqw2Ko39fFYa6-HFQHaygjUaau3ji4jI2mY=
 





On Mon, Aug 21, 2017 at 6:01 AM, Kendall Shaw <kendall.s...@workday.com> 
wrote:
> The example produces an error saying it can’t convert string to document
> node:
>
>
>
> declare
>
>   %rest:path("/store.csv")
>
>   %rest:POST("{$csv}")
>
>   %input:csv("header=true,encoding=CP1252")
>
> function page:store-csv($csv as document-node()) {
>
>   "Number of rows: " || count($csv/csv/record)
>
> };
>
>
>
> I can just change the function signature and parse the string with
> csv:parse, but is the example missing a detail (or am I missing a detail)?
>
>
>
> I used this to store CSV data in the default format.
>
>
>
> curl –XPOST –H’Content-Type: text/csv’ –data @some.csv
> 
https://urldefense.proofpoint.com/v2/url?u=http-3A__example.com_basex_store.csv=DwIFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=rNboQKVnWnXp-YmOjjhaMZd8_9BoqGIjpH3YIUKgxBE=_HNnJt3O3gQfHwOJD_A5KK3FemeBoPP_FPvYbn_3ZCY=
 
>
>
>
> Kendall
>
>




Re: [basex-talk] RESTXQ %input:csv annotation

2017-08-20 Thread Kendall Shaw
Sorry for the duplicate post.

From: Kendall Shaw <kendall.s...@workday.com>
Date: Sunday, August 20, 2017 at 9:00 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: RESTXQ %input:csv annotation

The example produces an error saying it can’t convert string to document node:

declare
  %rest:path("/store.csv")
  %rest:POST("{$csv}")
  %input:csv("header=true,encoding=CP1252")
function page:store-csv($csv as document-node()) {
  "Number of rows: " || count($csv/csv/record)
};

I can just change the function signature and parse the string with csv:parse, 
but is the example missing a detail (or am I missing a detail)?

I used this to store CSV data in the default format.

curl –XPOST –H’Content-Type: text/csv’ –data @some.csv 
http://example.com/basex/store.csv

Kendall



[basex-talk] %input:csv annotation

2017-08-20 Thread Kendall Shaw
Trying to use the example,  in the RESTXQ section of the documentation:

declare
  %rest:path("/store.csv")
  %rest:POST("{$csv}")
  %input:csv("header=true,encoding=CP1252")
function page:store-csv($csv as document-node()) {
  "Number of rows: " || count($csv/csv/record)
};


Using:

curl  -i -XPOST –data @test.csv   -H’Content-Type: 
text/csv’ http://blah/basex/store.csv

The result is [XPTY0004] Cannot cast xs:string to document-node()

I can just invoke csv:parse but, is the example missing a detail?

Kendall


[basex-talk] RESTXQ %input:csv annotation

2017-08-20 Thread Kendall Shaw
The example produces an error saying it can’t convert string to document node:

declare
  %rest:path("/store.csv")
  %rest:POST("{$csv}")
  %input:csv("header=true,encoding=CP1252")
function page:store-csv($csv as document-node()) {
  "Number of rows: " || count($csv/csv/record)
};

I can just change the function signature and parse the string with csv:parse, 
but is the example missing a detail (or am I missing a detail)?

I used this to store CSV data in the default format.

curl –XPOST –H’Content-Type: text/csv’ –data @some.csv 
http://example.com/basex/store.csv

Kendall



Re: [basex-talk] Implement read lock and write lock

2017-08-18 Thread Kendall Shaw
I would like to know what the read-lock and write-lock parameters mean. The 
documentation says they are in a different namespace than database names, so 
“factbook” doesn’t refer to the “factbook” database. What do the parameters 
refer to?

For Dharmendra’s questions, if /bloomsbury/config/audit.xml is a path in BaseX 
rather than a filesystem path, then probably nothing needs to be done other 
than being aware of what gets locked in which situation as described in that 
chapter.

If it is a filesystem path, then I think the scenario would need to be 
described more in order to answer the question.

Kendall

From:  on behalf of Fabrice 
ETANCHAUD 
Date: Thursday, August 17, 2017 at 2:14 AM
To: 'Dharmendra Singh' , BaseX 

Subject: Re: [basex-talk] Implement read lock and write lock

Hi Dhamendra Kumar,

XQuery and BaseX are extremely productive technologies,
But at the cost of a minimal learning time.

I am sorry I cannot help at that point,
You should take the time to read a few tutorials and have an overview of all 
the BaseX capabilities by reading the documentation starter sections.

Best regards,
Fabrice


De : Dharmendra Singh [mailto:dharam.m...@gmail.com]
Envoyé : jeudi 17 août 2017 11:04
À : Fabrice ETANCHAUD; BaseX
Objet : Re: [basex-talk] Implement read lock and write lock

Thanks for your reply favrice,

I am new in the BaseX so if you little explore.


i have gone through the documentation within documentation these line has been 
given

declare option query:read-lock "foo,bar";
declare option query:read-lock "batz";
  declare option query:write-lock "quix";

i have the file structure:

/bloomsbury/config/audit.xml

so i have to lock the audit.xml so how can i do that.


Regards
Dharmendra Kumar Singh

On Thursday, 17 August 2017 2:01 PM, Fabrice ETANCHAUD 
> wrote:

Hi Dharmendra Kumar,

Maybe you shall have a look at the following resource :

http://docs.basex.org/wiki/Transaction_Management


Regards,
Fabrice Etanchaud

“Perfection is finally attained not when there is no longer anything to add,
but when there is no longer anything to take away."

Saint-Exupéry


De : 
basex-talk-boun...@mailman.uni-konstanz.de
 [mailto:basex-talk-boun...@mailman.uni-konstanz.de] De la part de DK Singh
Envoyé : jeudi 17 août 2017 09:53
À : BaseX
Objet : [basex-talk] Implement read lock and write lock

Hi All,

How can i implement read lock and write lock,  any functions to do this

Regards
Dharmendra Kumar Singh



Re: [basex-talk] HTTP module

2017-08-14 Thread Kendall Shaw
Does it work to use Andy’s multipart version with encoding=”UTF-8” added to 
body elements?

On 8/14/17, 3:59 PM, "Giuseppe Celano"  wrote:

Thanks, Andy. I have also tried to invoke curl via proc:execute():

proc:execute("curl",("-F", "data=@example.txt",  "-F", "tagger=", "-F", 
"parser=",  
"https://urldefense.proofpoint.com/v2/url?u=http-3A__lindat.mff.cuni.cz_services_udpipe_api_process=DwIFAg=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=qRCvzBXhWnhavXBh6P8EXvNUf4YQi32_9ryqeOGjFo0=eR_QvfgwPhEJZno15HPXKZ7T6_aiGenJQ-NEFhJyCyU=
 " ))

The function works, but unfortunately the text inside the file is not 
recognized as UTF-8, and so I get al lot of gibberish in the result. At the 
beginning I though it was due to
my MacOS configuration, but I experimented a lot, and the problem seems to 
depend on BaseX. 

I run the basexgui (and basex) commands of the bin folder from my Terminal 
window and they should inherit the environment variables (and indeed 
proc:execute("locale") also shows the right UTF-8 values).

I will open a Github issue, unless I am missing something here.








Re: [basex-talk] HTTP module

2017-08-14 Thread Kendall Shaw
Can you elaborate on “does not work”? What response do you get.

From: Giuseppe Celano <cel...@informatik.uni-leipzig.de>
Date: Monday, August 14, 2017 at 10:43 AM
To: Kendall Shaw <kendall.s...@workday.com>
Cc: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] HTTP module

Thanks, Kendall, I tried but it does not work :(

Universität Leipzig
Institute of Computer Science, Digital Humanities
Augustusplatz 10
04109 Leipzig
Deutschland
E-mail: 
cel...@informatik.uni-leipzig.de<mailto:cel...@informatik.uni-leipzig.de>
E-mail: giuseppegacel...@gmail.com<mailto:giuseppegacel...@gmail.com>
Web site 1: 
http://www.dh.uni-leipzig.de/wo/team/<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.dh.uni-2Dleipzig.de_wo_team_=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=TlIOuppKOV4asTDc_0id-1Pvzd-oP7t4YHr2yE_Gq3A=dux16wNCZ5h2561adWMHR4ElYd_DdDGhkNgDiHLnFew=>
Web site 2: 
https://sites.google.com/site/giuseppegacelano/<https://urldefense.proofpoint.com/v2/url?u=https-3A__sites.google.com_site_giuseppegacelano_=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=TlIOuppKOV4asTDc_0id-1Pvzd-oP7t4YHr2yE_Gq3A=Nt61VJ9xd6KArgVDT8ISIy7kOYiUYAKczZkMyWv2jh8=>

On Aug 14, 2017, at 6:53 PM, Kendall Shaw 
<kendall.s...@workday.com<mailto:kendall.s...@workday.com>> wrote:

http:send-request(

tokenizertaggerparserdata=Děti pojedou k babičce. Už se těší.

)



Re: [basex-talk] HTTP module

2017-08-14 Thread Kendall Shaw
Hi Giuseppe,

You were asking about a method other than adding to the URL. Using –F with curl 
uses the POST method, rather than GET. Also, “string” isn’t a recognized 
content-type, I think.

Your example might work if you changed it to use POST and text/plain:


http:send-request(

tokenizertaggerparserdata=Děti pojedou k babičce. Už se těší.

)

Kendall

From:  on behalf of Giuseppe Celano 

Date: Monday, August 14, 2017 at 8:05 AM
To: BaseX 
Subject: Re: [basex-talk] HTTP module

Hi Andy,

Thanks for the help. If I pass an entire text via the url, though, I get the 
error message "Request-URI Too Large".

Best,
Giuseppe

Universität Leipzig
Institute of Computer Science, Digital Humanities
Augustusplatz 10
04109 Leipzig
Deutschland
E-mail: 
cel...@informatik.uni-leipzig.de
E-mail: giuseppegacel...@gmail.com
Web site 1: 
http://www.dh.uni-leipzig.de/wo/team/
Web site 2: 
https://sites.google.com/site/giuseppegacelano/

On 14 Aug 2017, at 14:11, Giuseppe Celano 
> 
wrote:

Hi,

I am accessing a RESTful API via the following command:

curl -F data=@example.txt  -F tokenizer= -F tagger= 
-F parser= 
http://lindat.mff.cuni.cz/services/udpipe/api/process
 > example2.txt

I am wondering what the best way is to do that in BaseX. The service also has a 
URL syntax, as shown in the following example:

http://lindat.mff.cuni.cz/services/udpipe/api/process?tokenizer=D%C4%9Bti%20pojedou%20k%20babi%C4%8Dce.%20U%C5%BE%20se%20t%C4%9B%C5%A1%C3%AD.

I have tried:

http:send-request(https://urldefense.proofpoint.com/v2/url?u=http-3A__lindat.mff.cuni.cz_services_udpipe_api_process-3Ftokenizer-26amp-3Btagger-26amp-3Bparser-26amp-3Bdata-3DD-25C4-259Bti-2520pojedou-2520k-2520babi-25C4-258Dce.-2520U-25C5-25BE-2520se-2520t-25C4-259B-25C5-25A1-25C3-25AD-27_=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=oFx2aqo7jCo5sUYE-dtOz0f9n3lLCHBvHn5wCV_mz_U=rtjKIcEd_N_VB8XayzehrSAD34ew4ynTrog-moDSHXc=>>)

and works perfectly;  but I was trying to put the body of the request in 
http:body, but it does not work:

http:send-request(

tokenizertaggerparserdata=Děti pojedou k babičce. Už se těší.

)

I could invoke the curl command in BaseX, but maybe there is a more elegant way 
to send the content of the file (than adding it to the URL). Thanks.

Ciao,
Giuseppe


Universität Leipzig
Institute of Computer Science, Digital Humanities
Augustusplatz 10
04109 Leipzig
Deutschland
E-mail: 
cel...@informatik.uni-leipzig.de
E-mail: giuseppegacel...@gmail.com
Web site 1: 
http://www.dh.uni-leipzig.de/wo/team/
Web site 2: 
https://sites.google.com/site/giuseppegacelano/




[basex-talk] db:replace modified date

2017-08-13 Thread Kendall Shaw
After debugging a query for a while, I figured out that db:replace isn’t 
changing the modification date of an XML resource, when the content hasn’t 
changed. The case is like this:

db:replace(‘db’, ‘abc.xml’, doc(‘file:/tmp/abc.xml’))

Is that normal, or do I have an option set that results in that behavior? 
ADDCACHE is false.

Kendall



[basex-talk] jobs:result deadlock

2017-08-06 Thread Kendall Shaw
Can someone elaborate on this sentence in the documentation about jobs:result:

“Please note that this query can easily cause a deadlock if the asynchronously 
executed query will be queued. “

Referring to this example:

let $query := jobs:eval('(1 to 1000)[. = 1]', map{}, map{ 'cache': true() })
return (
  jobs:wait($query),
  jobs:result($query)
)

And this about jobs:wait

“If the function is called with the id of a queued job, or repeatedly executed 
job, it may stall and never terminate.”

Can jobs:eval above be queued before jobs:wait is evaluated within the let 
expression?

Kendall


Re: [basex-talk] Timezone and job start time

2017-07-29 Thread Kendall Shaw
Hi Christian,

Ah, ok. It is just storing the time in UTC. That is consistent with the way 
resource modification times are stored. So, the default behavior is what I want.

Thanks,
Kendall

On 7/29/17, 3:01 PM, "Christian Grün" <christian.gr...@gmail.com> wrote:

Hi Kendall,

> If there is a way to use the default timezone that would be better.

If you specify no timezone, the default timezone is used indeed. If I
run the following query…

  jobs:eval('1', map {}, map { 'start': '12:00:00' })

…the jobs:list-details() function will show you the start time of your
query as UTC:

  1

Nonetheless, you can also specify a timezone in the time string. All
values are allowed that are legal arguments for xs:dateTime(). The
next query will run the embedded query five seconds after query
execution:

  let $date := current-dateTime() + xs:dayTimeDuration('PT5S')
  return (
$date,
jobs:eval('1', map {}, map { 'start': string($date) })
  )

On my system, it output something like:

  2017-07-29T23:46:56.327+02:00
  job991

Hope this helps,
Christian





> Meanwhile,
>
> I made a module so that I can use source from JDK 1.8.x:
>
>
>
> package somewhere;
>
>
>
> import java.time.LocalDateTime;
>
> import java.time.ZonedDateTime;
>
> import java.time.ZoneId;
>
> import java.time.format.DateTimeFormatter;
>
>
>
> import org.basex.query.QueryException;
>
> import org.basex.query.QueryModule;
>
>
>
> public class Time extends QueryModule {
>
>
>
>   public String zonedTime(String pattern) throws QueryException {
>
> return  ZonedDateTime.from(LocalDateTime.now()
>
> .withHour(20)
>
> .withMinute(0)
>
> .withSecond(0)
>
> 
.atZone(ZoneId.systemDefault()))
>
>  .withZoneSameInstant(ZoneId.of("UTC"))
>
>  .format(DateTimeFormatter.ofPattern(pattern));
>
>   }
>
> }
>
> and, then in XQuery:
>
>
>
> jobs:eval(‘trace(“WENT”)’, map {}, map {‘id’: ‘somejob’, ‘start’:
> t:zoned-time(‘HH:mm:ss’)})
>
>
>
> Kendall
>
>
>
> From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall 
Shaw
> <kendall.s...@workday.com>
> Date: Friday, July 28, 2017 at 2:37 PM
> To: BaseX <basex-talk@mailman.uni-konstanz.de>
> Subject: [basex-talk] Timezone and job start time
>
>
>
> declare namespace tz = "java:java.time.ZonedDateTime";
>
>
>
> tz:now()
>
>
>
> returns 2017-07-28T14:23:08.334-07:00[America/Los_Angeles]
>
>
>
> Logs in dba seem to use the local time zone to display the date.
>
>
>
> The timestamp on resources is in UTC time, which is good.
>
>
>
> modified-date=”2017-07-28T21:17:53.347Z”
>
>
>
> But, do I have to use UTC time for scheduling jobs?
>
>
>
> For example:
>
>
>
> job:eval(‘…’, map {}, map {‘start’: ‘20:00:00’})
>
>
>
> schedules the job for 5AM instead of 10PM, I think.
>
>
>
> If I can assume the time is UTC then I can figure out how to schedule the
> correct time. But, can I assume that it is UTC, or can I specify a Zoned
> time without a date?
>
>
>
> Kendall
>
>
>
>




Re: [basex-talk] Timezone and job start time

2017-07-29 Thread Kendall Shaw
And:

t:time(20, ‘HH:mm:ss’)

which is 8pm not 10pm…

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Saturday, July 29, 2017 at 1:27 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Timezone and job start time

Oops, I mean:

package workday;

import java.math.BigInteger;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

import org.basex.query.QueryException;
import org.basex.query.QueryModule;

public class Time extends QueryModule {

  public String zonedTime(BigInteger hour, String pattern) throws 
QueryException {
return  ZonedDateTime.from(LocalDateTime.now()
.withHour(hour.intValue())
.withMinute(0)
.withSecond(0)
.atZone(ZoneId.systemDefault()))
 .withZoneSameInstant(ZoneId.of("UTC"))
 .format(DateTimeFormatter.ofPattern(pattern));
  }
}


From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Saturday, July 29, 2017 at 1:17 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Timezone and job start time

I think I can assume it is UTC.

org/basex/util/DateTime.java contains:

  static { FULL.setTimeZone(TimeZone.getTimeZone("UTC")); }

If there is a way to use the default timezone that would be better. Meanwhile,
I made a module so that I can use source from JDK 1.8.x:

package somewhere;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

import org.basex.query.QueryException;
import org.basex.query.QueryModule;

public class Time extends QueryModule {

  public String zonedTime(String pattern) throws QueryException {
return  ZonedDateTime.from(LocalDateTime.now()
.withHour(20)
.withMinute(0)
.withSecond(0)
.atZone(ZoneId.systemDefault()))
 .withZoneSameInstant(ZoneId.of("UTC"))
 .format(DateTimeFormatter.ofPattern(pattern));
  }
}
and, then in XQuery:

jobs:eval(‘trace(“WENT”)’, map {}, map {‘id’: ‘somejob’, ‘start’: 
t:zoned-time(‘HH:mm:ss’)})

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Friday, July 28, 2017 at 2:37 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] Timezone and job start time

declare namespace tz = "java:java.time.ZonedDateTime";

tz:now()

returns 2017-07-28T14:23:08.334-07:00[America/Los_Angeles]

Logs in dba seem to use the local time zone to display the date.

The timestamp on resources is in UTC time, which is good.

modified-date=”2017-07-28T21:17:53.347Z”

But, do I have to use UTC time for scheduling jobs?

For example:

job:eval(‘…’, map {}, map {‘start’: ‘20:00:00’})

schedules the job for 5AM instead of 10PM, I think.

If I can assume the time is UTC then I can figure out how to schedule the 
correct time. But, can I assume that it is UTC, or can I specify a Zoned time 
without a date?

Kendall




Re: [basex-talk] Timezone and job start time

2017-07-29 Thread Kendall Shaw
Oops, I mean:

package workday;

import java.math.BigInteger;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

import org.basex.query.QueryException;
import org.basex.query.QueryModule;

public class Time extends QueryModule {

  public String zonedTime(BigInteger hour, String pattern) throws 
QueryException {
return  ZonedDateTime.from(LocalDateTime.now()
.withHour(hour.intValue())
.withMinute(0)
.withSecond(0)
.atZone(ZoneId.systemDefault()))
 .withZoneSameInstant(ZoneId.of("UTC"))
 .format(DateTimeFormatter.ofPattern(pattern));
  }
}


From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Saturday, July 29, 2017 at 1:17 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Timezone and job start time

I think I can assume it is UTC.

org/basex/util/DateTime.java contains:

  static { FULL.setTimeZone(TimeZone.getTimeZone("UTC")); }

If there is a way to use the default timezone that would be better. Meanwhile,
I made a module so that I can use source from JDK 1.8.x:

package somewhere;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

import org.basex.query.QueryException;
import org.basex.query.QueryModule;

public class Time extends QueryModule {

  public String zonedTime(String pattern) throws QueryException {
return  ZonedDateTime.from(LocalDateTime.now()
.withHour(20)
.withMinute(0)
.withSecond(0)
.atZone(ZoneId.systemDefault()))
 .withZoneSameInstant(ZoneId.of("UTC"))
 .format(DateTimeFormatter.ofPattern(pattern));
  }
}
and, then in XQuery:

jobs:eval(‘trace(“WENT”)’, map {}, map {‘id’: ‘somejob’, ‘start’: 
t:zoned-time(‘HH:mm:ss’)})

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Friday, July 28, 2017 at 2:37 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] Timezone and job start time

declare namespace tz = "java:java.time.ZonedDateTime";

tz:now()

returns 2017-07-28T14:23:08.334-07:00[America/Los_Angeles]

Logs in dba seem to use the local time zone to display the date.

The timestamp on resources is in UTC time, which is good.

modified-date=”2017-07-28T21:17:53.347Z”

But, do I have to use UTC time for scheduling jobs?

For example:

job:eval(‘…’, map {}, map {‘start’: ‘20:00:00’})

schedules the job for 5AM instead of 10PM, I think.

If I can assume the time is UTC then I can figure out how to schedule the 
correct time. But, can I assume that it is UTC, or can I specify a Zoned time 
without a date?

Kendall




Re: [basex-talk] Timezone and job start time

2017-07-29 Thread Kendall Shaw
I think I can assume it is UTC.

org/basex/util/DateTime.java contains:

  static { FULL.setTimeZone(TimeZone.getTimeZone("UTC")); }

If there is a way to use the default timezone that would be better. Meanwhile,
I made a module so that I can use source from JDK 1.8.x:

package somewhere;

import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

import org.basex.query.QueryException;
import org.basex.query.QueryModule;

public class Time extends QueryModule {

  public String zonedTime(String pattern) throws QueryException {
return  ZonedDateTime.from(LocalDateTime.now()
.withHour(20)
.withMinute(0)
.withSecond(0)
.atZone(ZoneId.systemDefault()))
 .withZoneSameInstant(ZoneId.of("UTC"))
 .format(DateTimeFormatter.ofPattern(pattern));
  }
}
and, then in XQuery:

jobs:eval(‘trace(“WENT”)’, map {}, map {‘id’: ‘somejob’, ‘start’: 
t:zoned-time(‘HH:mm:ss’)})

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Friday, July 28, 2017 at 2:37 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] Timezone and job start time

declare namespace tz = "java:java.time.ZonedDateTime";

tz:now()

returns 2017-07-28T14:23:08.334-07:00[America/Los_Angeles]

Logs in dba seem to use the local time zone to display the date.

The timestamp on resources is in UTC time, which is good.

modified-date=”2017-07-28T21:17:53.347Z”

But, do I have to use UTC time for scheduling jobs?

For example:

job:eval(‘…’, map {}, map {‘start’: ‘20:00:00’})

schedules the job for 5AM instead of 10PM, I think.

If I can assume the time is UTC then I can figure out how to schedule the 
correct time. But, can I assume that it is UTC, or can I specify a Zoned time 
without a date?

Kendall




[basex-talk] Timezone and job start time

2017-07-28 Thread Kendall Shaw
declare namespace tz = "java:java.time.ZonedDateTime";

tz:now()

returns 2017-07-28T14:23:08.334-07:00[America/Los_Angeles]

Logs in dba seem to use the local time zone to display the date.

The timestamp on resources is in UTC time, which is good.

modified-date=”2017-07-28T21:17:53.347Z”

But, do I have to use UTC time for scheduling jobs?

For example:

job:eval(‘…’, map {}, map {‘start’: ‘20:00:00’})

schedules the job for 5AM instead of 10PM, I think.

If I can assume the time is UTC then I can figure out how to schedule the 
correct time. But, can I assume that it is UTC, or can I specify a Zoned time 
without a date?

Kendall




Re: [basex-talk] Simple query

2017-03-10 Thread Kendall Shaw
Looking at the basex source code, LocalSession.close also does 
context.closeDB(). So, I think you only need LocalSession.close or the try 
block does it for you in your example.

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of AJ Weber 
<awe...@comcast.net>
Date: Friday, March 10, 2017 at 1:47 PM
To: "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Simple query


OK, changing this so that the code flows like yours works much, much better.  I 
now return all 3 documents I expect are in the database.

FOLLOW-UP Question:  How do I close the database properly with these classes?  
I had been doing a context.closeDB() when shutting-down.  Do I just do a 
localSession.close() now?  Or do I need to do both?

Thanks again!!!



On 3/10/2017 4:27 PM, AJ Weber wrote:

Well, one difference I spot is that I am opening (via the snippet I sent 
before) the database BEFORE creating a LocalSession and I am using the new 
Check(...).execute(context);

The "context" is kept in the object's class-level.

Your code creates the context, associates the new LocalSession with the 
context, and THEN opens the existing database.  (That's more akin to how a JDBC 
session would go...but I did not see any java examples with this, I followed 
the examples on the java page and only found LocalSession via a google search.)

There doesn't appear to be any details in the javadoc or anything I can find 
regarding how to use LocalSession, so I could be off base from that pov.

-AJ

On 3/10/2017 4:18 PM, Kendall Shaw wrote:
This worked for me, where “test-local” contains a document:

Context context = new Context();
LocalSession s = new LocalSession(context);
s.execute(new Check("test-local"));
try (Query q = s.query("for $doc in collection() return $doc")) {
while (q.more()) {
System.out.println(q.next());
}
}

But, why your code isn’t working could be useful to know. It seems like there 
are some details left out.

Kendall

From: 
<basex-talk-boun...@mailman.uni-konstanz.de><mailto:basex-talk-boun...@mailman.uni-konstanz.de>
 on behalf of AJ Weber <awe...@comcast.net><mailto:awe...@comcast.net>
Date: Friday, March 10, 2017 at 11:40 AM
To: 
"basex-talk@mailman.uni-konstanz.de"<mailto:basex-talk@mailman.uni-konstanz.de> 
<basex-talk@mailman.uni-konstanz.de><mailto:basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Simple query



On 3/10/2017 2:24 PM, Kendall Shaw wrote:
Michael Seiferle gave the answer already, I think. What would collection() be 
referring to? How would BaseX know what to return? Probably there is no 
database specified. Presumably, in the GUI you have opened a database.
Yes, I did not include my code to open the database.  There is a database open 
and this does not throw an exception, it just returns no results.

In my constructor of this class there is the following code:
new Check(this.MyID).execute(context);

(MyID is a String identifying the database I want to work with exclusively with 
this context passed.)

As I mentioned in a separate post, my query where matches(uri...) works 
fine...every time.  That query also does not have a specific collection in the 
query.




Kendall


From: 
<basex-talk-boun...@mailman.uni-konstanz.de><mailto:basex-talk-boun...@mailman.uni-konstanz.de>
 on behalf of AJ Weber <awe...@comcast.net><mailto:awe...@comcast.net>
Date: Friday, March 10, 2017 at 6:44 AM
To: Fabrice ETANCHAUD 
<fetanch...@groupefbo.com><mailto:fetanch...@groupefbo.com>, 
"basex-talk@mailman.uni-konstanz.de"<mailto:basex-talk@mailman.uni-konstanz.de> 
<basex-talk@mailman.uni-konstanz.de><mailto:basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Simple query

On 3/9/2017 3:46 AM, Fabrice ETANCHAUD wrote:
Hello Aaron,

You would learn faster by using the BaseXGUI application,
You will benefit from syntax highlighting, real time execution, and hits on 
function signatures.
I am trying the GUI now.  It is an excellent tool!

However, issuing the same exact XQuery in the GUI returns 3 documents (which is 
what I would have originally expected).

Maybe it is an issue with how I setup my query in java?  Here is my code:

try (LocalSession session = new LocalSession(this.context)) {
//test

try (Query q = session.query("for $doc in collection() return 
$doc")) {
while (q.more()) {
LOG.debug("RESULT: " + q.next());
}
}
}
catch (Exception e) {
LOG.error("Could not execute query " + statement, e);
}





Best regards,
Fabrice

De : 
basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni

Re: [basex-talk] Simple query

2017-03-10 Thread Kendall Shaw
This worked for me, where “test-local” contains a document:

Context context = new Context();
LocalSession s = new LocalSession(context);
s.execute(new Check("test-local"));
try (Query q = s.query("for $doc in collection() return $doc")) {
while (q.more()) {
System.out.println(q.next());
}
}

But, why your code isn’t working could be useful to know. It seems like there 
are some details left out.

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of AJ Weber 
<awe...@comcast.net>
Date: Friday, March 10, 2017 at 11:40 AM
To: "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Simple query



On 3/10/2017 2:24 PM, Kendall Shaw wrote:
Michael Seiferle gave the answer already, I think. What would collection() be 
referring to? How would BaseX know what to return? Probably there is no 
database specified. Presumably, in the GUI you have opened a database.
Yes, I did not include my code to open the database.  There is a database open 
and this does not throw an exception, it just returns no results.

In my constructor of this class there is the following code:
new Check(this.MyID).execute(context);

(MyID is a String identifying the database I want to work with exclusively with 
this context passed.)

As I mentioned in a separate post, my query where matches(uri...) works 
fine...every time.  That query also does not have a specific collection in the 
query.



Kendall


From: 
<basex-talk-boun...@mailman.uni-konstanz.de><mailto:basex-talk-boun...@mailman.uni-konstanz.de>
 on behalf of AJ Weber <awe...@comcast.net><mailto:awe...@comcast.net>
Date: Friday, March 10, 2017 at 6:44 AM
To: Fabrice ETANCHAUD 
<fetanch...@groupefbo.com><mailto:fetanch...@groupefbo.com>, 
"basex-talk@mailman.uni-konstanz.de"<mailto:basex-talk@mailman.uni-konstanz.de> 
<basex-talk@mailman.uni-konstanz.de><mailto:basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Simple query

On 3/9/2017 3:46 AM, Fabrice ETANCHAUD wrote:
Hello Aaron,

You would learn faster by using the BaseXGUI application,
You will benefit from syntax highlighting, real time execution, and hits on 
function signatures.
I am trying the GUI now.  It is an excellent tool!

However, issuing the same exact XQuery in the GUI returns 3 documents (which is 
what I would have originally expected).

Maybe it is an issue with how I setup my query in java?  Here is my code:

try (LocalSession session = new LocalSession(this.context)) {
//test

try (Query q = session.query("for $doc in collection() return 
$doc")) {
while (q.more()) {
LOG.debug("RESULT: " + q.next());
}
}
}
catch (Exception e) {
LOG.error("Could not execute query " + statement, e);
}




Best regards,
Fabrice

De : 
basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>
 [mailto:basex-talk-boun...@mailman.uni-konstanz.de] De la part de Aaron Weber
Envoyé : jeudi 9 mars 2017 00:31
À : 
basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>
Objet : [basex-talk] Simple query

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







Re: [basex-talk] Simple query

2017-03-10 Thread Kendall Shaw
Michael Seiferle gave the answer already, I think. What would collection() be 
referring to? How would BaseX know what to return? Probably there is no 
database specified. Presumably, in the GUI you have opened a database.

Kendall


From:  on behalf of AJ Weber 

Date: Friday, March 10, 2017 at 6:44 AM
To: Fabrice ETANCHAUD , 
"basex-talk@mailman.uni-konstanz.de" 
Subject: Re: [basex-talk] Simple query

On 3/9/2017 3:46 AM, Fabrice ETANCHAUD wrote:
Hello Aaron,

You would learn faster by using the BaseXGUI application,
You will benefit from syntax highlighting, real time execution, and hits on 
function signatures.
I am trying the GUI now.  It is an excellent tool!

However, issuing the same exact XQuery in the GUI returns 3 documents (which is 
what I would have originally expected).

Maybe it is an issue with how I setup my query in java?  Here is my code:

try (LocalSession session = new LocalSession(this.context)) {
//test

try (Query q = session.query("for $doc in collection() return 
$doc")) {
while (q.more()) {
LOG.debug("RESULT: " + q.next());
}
}
}
catch (Exception e) {
LOG.error("Could not execute query " + statement, e);
}



Best regards,
Fabrice

De : 
basex-talk-boun...@mailman.uni-konstanz.de
 [mailto:basex-talk-boun...@mailman.uni-konstanz.de] De la part de Aaron Weber
Envoyé : jeudi 9 mars 2017 00:31
À : 
basex-talk@mailman.uni-konstanz.de
Objet : [basex-talk] Simple query

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




Re: [basex-talk] Somewhat unusual question

2017-02-25 Thread Kendall Shaw
I think it’s important to the original question to point out that a problem is 
likely to includes mixtures of different types of data. BaseX has an SQL module 
and Marklogic includes modules for RDF and you can write extensions and use 
http to integrate external systems in various XML database systems.

For the skeptical person that we are pitching XQuery and BaseX to it’s probably 
best to be prepared to describe a solution that isn’t unnaturally forcing XML 
to fit as the solution for every problem.

Kendall

From: Graydon Saunders <graydon...@gmail.com>
Date: Saturday, February 25, 2017 at 5:09 PM
To: Kendall Shaw <kendall.s...@workday.com>
Cc: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Somewhat unusual question

Hi Kendal --

If you don't stick to attributes, it's not hard to represent that kind of 
relationship graph in XML:



karen


linda


sarah


wendy


cindy



This way you can have a lot of  elements (edges in the relationship 
graph) for an individual.  The XML graph and the represented graph don't match 
structurally and you'd have to go through and build maps or something in XQuery 
to manipulate the represented graph, but writing a function to get everybody 
who knows Cindy within a certain number of edges wouldn't be difficult.  
(Taking off the "certain number of edges" obliges you to write some sort of 
cycle detection mechanism, which is harder and presumably the people behind 
SPARQL have already done so.)

So not quite as syntactically compact but I don't think XML is obviously 
unsuitable for "represent an arbitrary graph".  You have to pick your XML 
vocabulary carefully but "arbitrary graph" and "carefully" go naturally 
together.

-- Graydon

On Sat, Feb 25, 2017 at 7:42 PM, Kendall Shaw 
<kendall.s...@workday.com<mailto:kendall.s...@workday.com>> wrote:
On 2/25/17, 12:55 PM, "Liam R. E. Quin" <l...@w3.org<mailto:l...@w3.org>> wrote:

On Sat, 2017-02-25 at 10:02 +, Kendall Shaw wrote:
> It’s interesting to me to know what sorts of applications seem like
> they would be a good match for XQuery’s data model but turned out not
> to be in some case.

I agree that's interesting - I'm afraid I have more experience with
what didn't work in SQL and did work with a forest store, probably
because I don't often encounter people whose projects didn't fit with
XML-related technologies. How do we find them?

 Aside from things like the 100,000 sensors scenario that you described, the 
friends example might be a case that is in the same area that XML makes sense.

With XPath having special support for hierarchical data, matching XML’s notion 
of element hierarchy, it’s perfect for data like:



  

  

  

  



So you can us $person//*/@name to get cindy’s sub-friends. Also, the document 
is constrained to be well-formed by the rules of XML document types, based on 
elements having only 1 parent. But, friends aren’t constrained to have only 
have 1 super-friend. And poor Wendy gets no sub-friends.

A less restricted graph representation can represent that where hierarchy 
doesn’t have special status:

@prefix : <people#> .
:cindy :name “cindy” ; :knows :karen .
:karen :name “karen” ; :knows :linda .
:linda :name “linda” ; :knows :sarah .
:sarah :name “sarah” ; :knows :wendy .
:wendy :name “wendy” :knows :cindy .

And with SPARQL, having special support for graph traversal, matching RDF’s 
notion of connected edges, it’s perfect for data like above.

So, you can use ?p :knows/:name ?name to get cindy’s friend’s friend’s friend’s 
friend’s etc. Also, Wendy gets to have a friend too.

Representing something similar in XML, ignoring RDF XML which makes it even 
more complicated:


  
  
  
  
  


The rules of XML document types don’t include special support for arbitrary 
attribute relationships, in the way that element hierarchy does have special 
status. You can write XQuery to navigate that data, but it’s not a simple 
expression and doesn’t use ancestor/descendant axes so maybe it’s not the best 
choice for the data.

The other way around, when most of the data is hierarchical it’s harder to use 
something like SPARQL with RDF than XPath with XML. And RDF is not necessarily 
the best representation for graphs where nodes and edges both have attributes.

Kendall









Re: [basex-talk] Somewhat unusual question

2017-02-25 Thread Kendall Shaw
On 2/25/17, 12:55 PM, "Liam R. E. Quin" <l...@w3.org> wrote:

On Sat, 2017-02-25 at 10:02 +0000, Kendall Shaw wrote: 
> It’s interesting to me to know what sorts of applications seem like
> they would be a good match for XQuery’s data model but turned out not
> to be in some case.

I agree that's interesting - I'm afraid I have more experience with
what didn't work in SQL and did work with a forest store, probably
because I don't often encounter people whose projects didn't fit with
XML-related technologies. How do we find them?

 Aside from things like the 100,000 sensors scenario that you described, the 
friends example might be a case that is in the same area that XML makes sense.

With XPath having special support for hierarchical data, matching XML’s notion 
of element hierarchy, it’s perfect for data like:



  

  

  

  



So you can us $person//*/@name to get cindy’s sub-friends. Also, the document 
is constrained to be well-formed by the rules of XML document types, based on 
elements having only 1 parent. But, friends aren’t constrained to have only 
have 1 super-friend. And poor Wendy gets no sub-friends.

A less restricted graph representation can represent that where hierarchy 
doesn’t have special status:

@prefix : <people#> .
:cindy :name “cindy” ; :knows :karen .
:karen :name “karen” ; :knows :linda .
:linda :name “linda” ; :knows :sarah .
:sarah :name “sarah” ; :knows :wendy .
:wendy :name “wendy” :knows :cindy .

And with SPARQL, having special support for graph traversal, matching RDF’s 
notion of connected edges, it’s perfect for data like above.

So, you can use ?p :knows/:name ?name to get cindy’s friend’s friend’s friend’s 
friend’s etc. Also, Wendy gets to have a friend too.

Representing something similar in XML, ignoring RDF XML which makes it even 
more complicated:


  
  
  
  
  


The rules of XML document types don’t include special support for arbitrary 
attribute relationships, in the way that element hierarchy does have special 
status. You can write XQuery to navigate that data, but it’s not a simple 
expression and doesn’t use ancestor/descendant axes so maybe it’s not the best 
choice for the data.

The other way around, when most of the data is hierarchical it’s harder to use 
something like SPARQL with RDF than XPath with XML. And RDF is not necessarily 
the best representation for graphs where nodes and edges both have attributes.

Kendall




 




Re: [basex-talk] Somewhat unusual question

2017-02-25 Thread Kendall Shaw
We users of BaseX probably all agree that it and XQuery are super and powerful. 
XML ,like RDF,  is not a perfect match for every problem. Wordstar is however 
the solution to every problem.

Kendall

On 2/25/17, 1:28 AM, "meumapple" <meumap...@gmail.com> wrote:

XML offers an elegant yet simple tree structure. You can find a way to 
express in XML the kinds of relationships you mention by simply using a 
different strategy (using not a parent element but, for example, attributes). 

In general, every format has limitations (so this is not an XML-related 
problem, but a more general one). I have also to add that while triples may 
suit your case, there are hundreds of other cases where they would simply add 
too much structure you would really prefer to get rid of.

In my experience, XQuery/XPath offers a superb/powerful and yet simple way 
to handle data (this is especially true in BaseX). XQuery/XPath data model is 
so terse that compared to others it looks so modern/intuitive/robust. I have 
recently had to code some Python, and it simply was so gratuitously intricate 
(and slow).

Joseph



Il giorno 25 feb 2017, alle ore 00:05, Kendall Shaw 
<kendall.s...@workday.com> ha scritto:

A more interesting example, maybe: If you compare XPath with this SPARQL 
fragment:

?x foaf:knows/foaf:name ?name .

All of my friend’s friend’s friend’s friend’s friend’s etc., with arbitrary 
depth, who know my friend with name x.

Friends are not limited to having 1  “befriender” in the way that elements 
have 1 parent, so it could make sense to represent some data as a less 
restricted form of graph than an XML element tree. 

Kendall

On 2/24/17, 10:07 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf 
of Kendall Shaw" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
kendall.s...@workday.com> wrote:

   For example, a program that regulates flow of water in a garden 
sprinkler is probably not a good match for xquery and an xml database. 

   On 2/24/17, 2:20 AM, "meumapple" <meumap...@gmail.com> wrote:

   Hi Kendall,

   I do not agree. A few considerations. If data are XML, I find it 
difficult to use a different language from XQuery. It is possible, of course, 
but much much more complex (why doing that?!). But native XML files are not the 
entire story. You can transform, for example, all of text data into an elegant 
XML working version and very very easily query it. I can do whatever I want 
with XQuery easily and deal with different kinds of data, so I do not agree at 
all. 



    
       Il giorno 24 feb 2017, alle ore 00:37, Kendall Shaw 
<kendall.s...@workday.com> ha scritto:

   What the application is makes all the difference. If the purpose 
does not have to do with XML and XML in a database, then XQuery and BaseX is 
less likely to be appropriate.

   Kendall

   On 2/23/17, 12:36 PM, "basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of Maximilian Gärber" <basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of mgaer...@arcor.de> wrote:

 Hi Marco,

 from my experience, the best way to handle these types of 
arguments is
 to make clear that there is nothing 'special' about XQuery. It is a
 query language.

 If you have to compare BaseX to something that most Java developers
 will know, I'd use Hibernate and HQL, a library and DSL that is all
 about querying data(bases).

 For C# developers, LINQ would probably ring a bell.

 Of course there is a lot more to it, and when it comes to web
 applications, you can use it in almost every layer (templating,
 routing, storage, etc).


 Regards,

 Max













 2017-02-22 13:43 GMT+01:00 Marco Lettere <m.lett...@gmail.com>:
> Hi to everyone,
> 
> probably this is not the right place for such a discussion but the BaseX
> communitiy is the one I'm better introduced to and the one I trust the 
most.
> So I hope that this somewhat unusual excursus will anyway be of interest 
to
> some of you.
> 
> As for myself I fell in love with XQuery and its power in terms of data
> manipulation many years ago. I wouldn't change it with anything else and 
BTW
> we're using it (thanks to the incredible BaseX runtime) much beyond
> data-processing being it the backbone of all our micro-service oriented
> architectures.
> 
> Now, to the point, in the near future I probably will be called to face a
> somewhat skeptical customer who will argue ab

Re: [basex-talk] Somewhat unusual question

2017-02-25 Thread Kendall Shaw
On 2/24/17, 7:15 PM, "Liam R. E. Quin" <l...@w3.org> wrote:

On Fri, 2017-02-24 at 18:07 +0000, Kendall Shaw wrote:
> For example, a program that regulates flow of water in a garden
> sprinkler is probably not a good match for xquery and an xml
> database.
Funnily enough, sensors these days often report results using EXI, and
an embedded XQuery engine might be a fine way to go. People used to use
mxquery for such applications.
 
A lot of tooling choice comes down to warm fuzzies and familiarity.

If you're actually querying XML, then an XML database and XQuery do
make an obvious choice. I find it can help to say it's a "fast forest
store" with XML as an interchange and loading format, to try & prevent
the misunderstanding that the software reads the entire database as
pointy-bracket XML with each query and is glacially slow. I wish we'd
used a forest metaphor for naming XQuery...

So, maybe, if representing a problem in terms of XQuery’s data model has you 
using a forest of interrelated stumps, then the tree aspect of forests is not a 
good match for the problem.

The original post was asking for examples of ways that XQuery is a good 
solution for an unknown problem. Generally, if I found myself think that 
technology x is the solution to every problem, I would proceed as if I am 
probably wrong about that.

It’s interesting to me to know what sorts of applications seem like they would 
be a good match for XQuery’s data model but turned out not to be in some case.

Kendall



Re: [basex-talk] Somewhat unusual question

2017-02-24 Thread Kendall Shaw
A more interesting example, maybe: If you compare XPath with this SPARQL 
fragment:

?x foaf:knows/foaf:name ?name .

All of my friend’s friend’s friend’s friend’s friend’s etc., with arbitrary 
depth, who know my friend with name x.

Friends are not limited to having 1  “befriender” in the way that elements have 
1 parent, so it could make sense to represent some data as a less restricted 
form of graph than an XML element tree. 

Kendall

On 2/24/17, 10:07 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Kendall Shaw" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
kendall.s...@workday.com> wrote:

For example, a program that regulates flow of water in a garden sprinkler 
is probably not a good match for xquery and an xml database. 

On 2/24/17, 2:20 AM, "meumapple" <meumap...@gmail.com> wrote:

Hi Kendall,

I do not agree. A few considerations. If data are XML, I find it 
difficult to use a different language from XQuery. It is possible, of course, 
but much much more complex (why doing that?!). But native XML files are not the 
entire story. You can transform, for example, all of text data into an elegant 
XML working version and very very easily query it. I can do whatever I want 
with XQuery easily and deal with different kinds of data, so I do not agree at 
all. 




Il giorno 24 feb 2017, alle ore 00:37, Kendall Shaw 
<kendall.s...@workday.com> ha scritto:

What the application is makes all the difference. If the purpose does 
not have to do with XML and XML in a database, then XQuery and BaseX is less 
likely to be appropriate.

Kendall

On 2/23/17, 12:36 PM, "basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of Maximilian Gärber" <basex-talk-boun...@mailman.uni-konstanz.de on 
behalf of mgaer...@arcor.de> wrote:

  Hi Marco,

  from my experience, the best way to handle these types of arguments is
  to make clear that there is nothing 'special' about XQuery. It is a
  query language.

  If you have to compare BaseX to something that most Java developers
  will know, I'd use Hibernate and HQL, a library and DSL that is all
  about querying data(bases).

  For C# developers, LINQ would probably ring a bell.

  Of course there is a lot more to it, and when it comes to web
  applications, you can use it in almost every layer (templating,
  routing, storage, etc).


  Regards,

  Max













  2017-02-22 13:43 GMT+01:00 Marco Lettere <m.lett...@gmail.com>:
> Hi to everyone,
> 
> probably this is not the right place for such a discussion but the 
BaseX
> communitiy is the one I'm better introduced to and the one I trust 
the most.
> So I hope that this somewhat unusual excursus will anyway be of 
interest to
> some of you.
> 
> As for myself I fell in love with XQuery and its power in terms of 
data
> manipulation many years ago. I wouldn't change it with anything else 
and BTW
> we're using it (thanks to the incredible BaseX runtime) much beyond
> data-processing being it the backbone of all our micro-service 
oriented
> architectures.
> 
> Now, to the point, in the near future I probably will be called to 
face a
> somewhat skeptical customer who will argue about the technological 
choice of
> XQuery.
> 
> My point will be to make a comparison with the technologies they're
> currently using and I would like to demonstrate that for a rather 
XML- (and
> in general data-) intensive workflow XQuery is perfectly suitable and
> probably better than many other alternatives.
> 
> I would tend to exclude XSLT because it would face similar 
opposition. I
> would also exclude languages at a lower level of abstraction like 
Java,
> Python, Javascript, C/C++ and so on for obvious architectural reasons.
> 
> But then only templating languages/engines come to my mind. Those 
would
> still be probably novel technologies to learn and wouldn't offer the
> structural, syntactic and semantic power of XQuery anyway.
> 
> So I ask you kindly, in order to complete my preparation on these 
matters,
> is there anyone that has experience with other tools or languages 
that can
> be compared with XQuery when used for XML querying, generation,
> transformation, templating, composition and so on?
> 
> Thanks a lot!
> 
> Marco.








Re: [basex-talk] Somewhat unusual question

2017-02-24 Thread Kendall Shaw
For example, a program that regulates flow of water in a garden sprinkler is 
probably not a good match for xquery and an xml database. 

On 2/24/17, 2:20 AM, "meumapple" <meumap...@gmail.com> wrote:

Hi Kendall,

I do not agree. A few considerations. If data are XML, I find it difficult 
to use a different language from XQuery. It is possible, of course, but much 
much more complex (why doing that?!). But native XML files are not the entire 
story. You can transform, for example, all of text data into an elegant XML 
working version and very very easily query it. I can do whatever I want with 
XQuery easily and deal with different kinds of data, so I do not agree at all. 




Il giorno 24 feb 2017, alle ore 00:37, Kendall Shaw 
<kendall.s...@workday.com> ha scritto:

What the application is makes all the difference. If the purpose does not 
have to do with XML and XML in a database, then XQuery and BaseX is less likely 
to be appropriate.

Kendall

On 2/23/17, 12:36 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf 
of Maximilian Gärber" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
mgaer...@arcor.de> wrote:

  Hi Marco,

  from my experience, the best way to handle these types of arguments is
  to make clear that there is nothing 'special' about XQuery. It is a
  query language.

  If you have to compare BaseX to something that most Java developers
  will know, I'd use Hibernate and HQL, a library and DSL that is all
  about querying data(bases).

  For C# developers, LINQ would probably ring a bell.

  Of course there is a lot more to it, and when it comes to web
  applications, you can use it in almost every layer (templating,
  routing, storage, etc).


  Regards,

  Max













  2017-02-22 13:43 GMT+01:00 Marco Lettere <m.lett...@gmail.com>:
> Hi to everyone,
> 
> probably this is not the right place for such a discussion but the BaseX
> communitiy is the one I'm better introduced to and the one I trust the 
most.
> So I hope that this somewhat unusual excursus will anyway be of interest 
to
> some of you.
> 
> As for myself I fell in love with XQuery and its power in terms of data
> manipulation many years ago. I wouldn't change it with anything else and 
BTW
> we're using it (thanks to the incredible BaseX runtime) much beyond
> data-processing being it the backbone of all our micro-service oriented
> architectures.
> 
> Now, to the point, in the near future I probably will be called to face a
> somewhat skeptical customer who will argue about the technological choice 
of
> XQuery.
> 
> My point will be to make a comparison with the technologies they're
> currently using and I would like to demonstrate that for a rather XML- 
(and
> in general data-) intensive workflow XQuery is perfectly suitable and
> probably better than many other alternatives.
> 
> I would tend to exclude XSLT because it would face similar opposition. I
> would also exclude languages at a lower level of abstraction like Java,
> Python, Javascript, C/C++ and so on for obvious architectural reasons.
> 
> But then only templating languages/engines come to my mind. Those would
> still be probably novel technologies to learn and wouldn't offer the
> structural, syntactic and semantic power of XQuery anyway.
> 
> So I ask you kindly, in order to complete my preparation on these matters,
> is there anyone that has experience with other tools or languages that can
> be compared with XQuery when used for XML querying, generation,
> transformation, templating, composition and so on?
> 
> Thanks a lot!
> 
> Marco.






Re: [basex-talk] Somewhat unusual question

2017-02-23 Thread Kendall Shaw
What the application is makes all the difference. If the purpose does not have 
to do with XML and XML in a database, then XQuery and BaseX is less likely to 
be appropriate.

Kendall

On 2/23/17, 12:36 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Maximilian Gärber"  wrote:

Hi Marco,

from my experience, the best way to handle these types of arguments is
to make clear that there is nothing 'special' about XQuery. It is a
query language.

If you have to compare BaseX to something that most Java developers
will know, I'd use Hibernate and HQL, a library and DSL that is all
about querying data(bases).

For C# developers, LINQ would probably ring a bell.

Of course there is a lot more to it, and when it comes to web
applications, you can use it in almost every layer (templating,
routing, storage, etc).


Regards,

Max













2017-02-22 13:43 GMT+01:00 Marco Lettere :
> Hi to everyone,
>
> probably this is not the right place for such a discussion but the BaseX
> communitiy is the one I'm better introduced to and the one I trust the 
most.
> So I hope that this somewhat unusual excursus will anyway be of interest 
to
> some of you.
>
> As for myself I fell in love with XQuery and its power in terms of data
> manipulation many years ago. I wouldn't change it with anything else and 
BTW
> we're using it (thanks to the incredible BaseX runtime) much beyond
> data-processing being it the backbone of all our micro-service oriented
> architectures.
>
> Now, to the point, in the near future I probably will be called to face a
> somewhat skeptical customer who will argue about the technological choice 
of
> XQuery.
>
> My point will be to make a comparison with the technologies they're
> currently using and I would like to demonstrate that for a rather XML- 
(and
> in general data-) intensive workflow XQuery is perfectly suitable and
> probably better than many other alternatives.
>
> I would tend to exclude XSLT because it would face similar opposition. I
> would also exclude languages at a lower level of abstraction like Java,
> Python, Javascript, C/C++ and so on for obvious architectural reasons.
>
> But then only templating languages/engines come to my mind. Those would
> still be probably novel technologies to learn and wouldn't offer the
> structural, syntactic and semantic power of XQuery anyway.
>
> So I ask you kindly, in order to complete my preparation on these matters,
> is there anyone that has experience with other tools or languages that can
> be compared with XQuery when used for XML querying, generation,
> transformation, templating, composition and so on?
>
> Thanks a lot!
>
> Marco.
>




Re: [basex-talk] Gzip/RESTXQ

2017-02-23 Thread Kendall Shaw
As far as I know you have to explicitly decompress and search through the 
content. For example:

convert:binary-to-string(db:retrieve(…))

Kendall

On 2/23/17, 12:44 AM, "meumapple" <meumap...@gmail.com> wrote:

Hi Kendall,

Thanks for that. Just a question: can the compressed data on your server be 
searched if a RESTXQ function is supposed to perform a simple query on them 
before serving? Thanks.

Best,
Joseph


Il giorno 23 feb 2017, alle ore 02:22, Kendall Shaw 
<kendall.s...@workday.com> ha scritto:

There is some point at which the time it takes to compress is worse in some 
measure than serving uncompressed data.

What I did was store precompressed data and serve that, instead of enabling 
compression. So if that is an option you can use:

web:response-header(map {'media-type': 'application/wordstar'}, map 
{'Content-Encoding': 'gzip'})
 ,  db:retrieve('test-binary', 'out.bin')

where out.bin contains gzipped data.

The web server might then serve the compressed data if Accept-Encoding 
contains deflate or gzip

Kendall

On 2/21/17, 10:53 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf 
of Christian Grün" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
christian.gr...@gmail.com> wrote:

   Hi joseph,

> I am wondering whether for RESTXQ one should enable gzip encoding to 
improve data transmission: if the database is used for storage (where the data 
are in binary form), is the gzip option still useful?

   Compression is always useful if you transfer data that can still be
   reduced in size. In other words, if you store JPG files, compression
   won’t help so much, but it will surely shrink JSON or WAV files.

   Cheers,
   Christian






Re: [basex-talk] Gzip/RESTXQ

2017-02-22 Thread Kendall Shaw
There is some point at which the time it takes to compress is worse in some 
measure than serving uncompressed data.

What I did was store precompressed data and serve that, instead of enabling 
compression. So if that is an option you can use:

web:response-header(map {'media-type': 'application/wordstar'}, map 
{'Content-Encoding': 'gzip'})
  ,  db:retrieve('test-binary', 'out.bin')

where out.bin contains gzipped data.

The web server might then serve the compressed data if Accept-Encoding contains 
deflate or gzip

Kendall

On 2/21/17, 10:53 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Christian Grün"  wrote:

Hi joseph,

> I am wondering whether for RESTXQ one should enable gzip encoding to 
improve data transmission: if the database is used for storage (where the data 
are in binary form), is the gzip option still useful?

Compression is always useful if you transfer data that can still be
reduced in size. In other words, if you store JPG files, compression
won’t help so much, but it will surely shrink JSON or WAV files.

Cheers,
Christian




Re: [basex-talk] Restxq handling accept-encoding

2016-11-17 Thread Kendall Shaw
So, to avoid having the web server compress content at runtime, it appears that 
I can do this:

declare
  %rest:path('/test-binary')
  %rest:GET
  function w:test-binary()
{
  web:response-header(map {'media-type': 'application/json'}, map 
{'Content-Encoding': 'gzip'})
  ,  db:retrieve('test-binary', 'out.bin')
};

where out.bin contains gzipped json text.

I would then serve the gzipped resource if Accept-Encoding contains deflate or 
gzip and otherwise serve the text resource.

Is there any problem with that approach?

Kendall

On 11/16/16, 10:35 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Kendall Shaw" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
kendall.s...@workday.com> wrote:

Thank you. I’m using tomcat, not for any particular reason. There I added:

compression=”on”

compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json"

to the connector element in server.xml. For now, that’s good enough. 
Eventually, I’ll want to figure out how to store a compressed resource and 
serve that if compression is request.

Kendall

On 11/16/16, 1:45 AM, "Christian Grün" <christian.gr...@gmail.com> wrote:

Hi Kendall,

This is usually handled by the web server (by default, Jetty). Maybe 
this helps?

  
https://urldefense.proofpoint.com/v2/url?u=http-3A__blog.max.berger.name_2010_01_jetty-2D7-2Dgzip-2Dfilter.html=DgIFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=6JsUJinjuwLxS__1HSp55O2G4zm8DoUtTk-zEVzV8cQ=ZWuB0REriC5VtRp4dTHd-HoaJ70qXUAVfj49wV_AggI=
 

Cheers,
Christian



    On Wed, Nov 16, 2016 at 2:29 AM, Kendall Shaw 
<kendall.s...@workday.com> wrote:
> I should clarify that I’m asking about content negotiation. 
%rest:produces
> is described as constraining based on the Accept header. Should I 
explicitly
> look for Accept-Encoding and produce binary data that is in one of the
> requested compressed formats, or is there something in basex’s restxq
> implementation that does this?
>
>
>
> Kendall
>
>
>
    > From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of 
Kendall Shaw
> <kendall.s...@workday.com>
> Date: Tuesday, November 15, 2016 at 4:58 PM
> To: BaseX <basex-talk@mailman.uni-konstanz.de>
> Subject: [basex-talk] Restxq handling accept-encoding
>
>
>
> To return compressed text data, should I explicitly look for 
Accept-Encoding
> and use java to deflate or gzip output of
> convert:binary-to-string(db:retrieve(…))?
>
>
>
> Kendall
>
>






Re: [basex-talk] Restxq handling accept-encoding

2016-11-16 Thread Kendall Shaw
Thank you. I’m using tomcat, not for any particular reason. There I added:

compression=”on”
compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json"

to the connector element in server.xml. For now, that’s good enough. 
Eventually, I’ll want to figure out how to store a compressed resource and 
serve that if compression is request.

Kendall

On 11/16/16, 1:45 AM, "Christian Grün" <christian.gr...@gmail.com> wrote:

Hi Kendall,

This is usually handled by the web server (by default, Jetty). Maybe this 
helps?

  
https://urldefense.proofpoint.com/v2/url?u=http-3A__blog.max.berger.name_2010_01_jetty-2D7-2Dgzip-2Dfilter.html=DgIFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=6JsUJinjuwLxS__1HSp55O2G4zm8DoUtTk-zEVzV8cQ=ZWuB0REriC5VtRp4dTHd-HoaJ70qXUAVfj49wV_AggI=
 

Cheers,
Christian



On Wed, Nov 16, 2016 at 2:29 AM, Kendall Shaw <kendall.s...@workday.com> 
wrote:
> I should clarify that I’m asking about content negotiation. %rest:produces
> is described as constraining based on the Accept header. Should I 
explicitly
> look for Accept-Encoding and produce binary data that is in one of the
> requested compressed formats, or is there something in basex’s restxq
> implementation that does this?
>
>
>
> Kendall
>
>
>
    > From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall 
Shaw
> <kendall.s...@workday.com>
> Date: Tuesday, November 15, 2016 at 4:58 PM
> To: BaseX <basex-talk@mailman.uni-konstanz.de>
> Subject: [basex-talk] Restxq handling accept-encoding
>
>
>
> To return compressed text data, should I explicitly look for 
Accept-Encoding
> and use java to deflate or gzip output of
> convert:binary-to-string(db:retrieve(…))?
>
>
>
> Kendall
>
>




Re: [basex-talk] Restxq handling accept-encoding

2016-11-15 Thread Kendall Shaw
I should clarify that I’m asking about content negotiation. %rest:produces is 
described as constraining based on the Accept header. Should I explicitly look 
for Accept-Encoding and produce binary data that is in one of the requested 
compressed formats, or is there something in basex’s restxq implementation that 
does this?

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Tuesday, November 15, 2016 at 4:58 PM
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] Restxq handling accept-encoding

To return compressed text data, should I explicitly look for Accept-Encoding 
and use java to deflate or gzip output of 
convert:binary-to-string(db:retrieve(…))?

Kendall



Re: [basex-talk] Text resources

2016-10-26 Thread Kendall Shaw
Err… I mean:

convert:binary-to-string(db:retrieve(‘some’,’some.txt’))

Can I skip the base64 part?

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Wednesday, October 26, 2016 at 5:05 PM
To: "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] Text resources

Is this how I should retrieve text that is stored using db:store, within xquery?

stream:materialize(db:retrieve(‘some’,’some.txt’))

?

Kendall


[basex-talk] Text resources

2016-10-26 Thread Kendall Shaw
Is this how I should retrieve text that is stored using db:store, within xquery?

stream:materialize(db:retrieve(‘some’,’some.txt’))

?

Kendall


Re: [basex-talk] java binding standardfunc and querymodule

2016-09-26 Thread Kendall Shaw
To answer my own question, maybe, see: ModuleDemo.java in the examples.

With that I can operate on an ANode or a Value, at least.

For now, that is all that I need. I will have to look into what method 
signatures are recognized.

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Kendall Shaw 
<kendall.s...@workday.com>
Date: Monday, September 26, 2016 at 1:21 PM
To: "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] java binding standardfunc and querymodule

The documentation describes extending QueryModule for writing a module in java. 
I want to write functions that are passed items.

If I look at the concat function it uses Expr.atomItem passing QueryContext and 
InputInfo.

Is there a way to get at InputInfo from a class that extends QueryModule? Or, 
another way to write functions that transform items?

Kendall


[basex-talk] Accessing file within repository or package

2016-09-22 Thread Kendall Shaw
I have a module packaged as a XAR and installed in the repo. In xquery I want 
to load xslt. This did not work:

http://example.com/hellaworld;
 abbrev="hella"
 version="1.0.0"
 spec="1.0"
 xmlns="http://expath.org/ns/pkg;>
  Hella world functions
  
  
http://example.com/hellaworld/hella.xsl
hella.xsl
  
  
http://example.com/hellaworld
hella.xq
  


Then using the import-uri with doc, e.g.:

(: within hella.xq in the package :)
xslt:transform($some, doc(‘http://example.com/hellaworld/hella.xsl’))


It does work, to use a path relative to the root of tomcat which I’m running 
basex in:

doc(‘webapps/basex/repo/http-example.com-hellaworld-1.0.0/hella/hella.xsl’)

but, I hope there is another way. How can I reference another file that is 
within the XAR package?

Kendall


[basex-talk] ignoring macos turds via webdav

2016-08-19 Thread Kendall Shaw
Finder and /bin/cp  leave turds wherever they go in some situations.

If I use finder or cp in macos to write a file to a basex db mounted via 
webdav, the log shows something like:

[propfind ] …/a.xml
[put] …/a.xml
[propfind] …/._a.xml
[lock] .../a.xml
[propfind] .../a.xml
[propfind] …/._.
[propfind] …/


Then finder complains “some data could not be  read or written”, or cp 
complains “interrupted system call”.

I imagine some sort of intermediate between Milton and basex could respond in a 
way that ignores the turds and responds as expected to macos.

Assuming that it is the turds that are causing the problem, do you know of an 
existing server-side solution?

Kendall



[basex-talk] Using BaseXServer and BaseXHTTP at the same time?

2016-08-18 Thread Kendall Shaw
Hi,

Does the fact that basexhttp  starts servers on 1984 and 8984 mean that I can 
have one program using client/server and another using rest using the same 
databases at the same time?

Kendall


Re: [basex-talk] Detect if the database is open

2016-06-19 Thread Kendall Shaw
Hi,

I think of opening a database, in general, as something you wouldn’t want to do 
every time you do any operation. I would expect:

open the database
do stuff
do stuff
do stuff
do stuff
do stuff
close the database

not

open the database and do stuff
open the database and do stuff
open the database and do stuff
open the database and do stuff
close the database


 Is using CHECK when the database is already open comparable in CPU cycles to 
testing a boolean variable that says open true or false? I understand that the 
time it takes for most commands to execute would make code logic usually 
insignificant.
  
Kendall

On 6/18/16, 4:54 AM, "Christian Grün" <christian.gr...@gmail.com> wrote:

>Hi Kendall,
>
>I would indeed recommend you to use the CHECK command before doing any
>other operations. This command does exactly what you seem to be
>looking for (checking if the databases is opened; if not, open it).
>
>Does this help?
>Christian
>
>
>
>On Wed, Jun 15, 2016 at 7:03 PM, Kendall Shaw <kendall.s...@workday.com> wrote:
>> Using ClientSession from java, I do this to check if the database is open:
>>
>>
>>
>> try {
>>
>> replace(somewhere, new ArrayInput(bytes));
>>
>> } catch (IOException e) {
>> String msg = e.getMessage();
>>
>> if (msg == null || !msg.contains(“No database opened”))
>>
>>   throw e;
>>
>> execute(new Check(databaseName));
>>
>> replace(somewhere, new ArrayInput(bytes));
>>
>> }
>>
>>
>>
>> Is there a better way to detect if the database is open than testing the
>> exception message text?
>>
>>
>>
>> Kendall
>>
>>



Re: [basex-talk] XdmItem

2016-04-12 Thread Kendall Shaw
The default answer is effectively no.

From: 
<basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>>
 on behalf of Kendall Shaw 
<kendall.s...@workday.com<mailto:kendall.s...@workday.com>>
Date: Wednesday, April 6, 2016 at 3:38 PM
To: 
"basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>" 
<basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>>
Subject: [basex-talk] XdmItem

Is XdmItem going to move out of tests to be part of the API at some point?

Kendall


[basex-talk] XdmItem

2016-04-06 Thread Kendall Shaw
Is XdmItem going to move out of tests to be part of the API at some point?

Kendall


Re: [basex-talk] Catalog Resolution Under Windows

2016-03-13 Thread Kendall Shaw

new URL(“file:” + catalogPath)






Appending text together seems to not be the best way to construct a URI.

On 3/13/16, 1:02 PM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Kendall Shaw" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
kendall.s...@workday.com> wrote:

>I remember trying to figure out if the catalog files are supposed to be URIs 
>or file paths (in commons resolver), and I think it was 
>Catalog.parseCatalogFile that had a problem. It tries essentially:
>
>catalogPath = path.replace(‘\\', ‘/‘)
>
>new URL(baseURL, catalogPath)
>
>and if that is a malformed URL, it tries:
>
>new URL(“file:”, catalogPath)
>
>So, with a canonical windows file path, the URL that it uses is:
>
>file:c:/somewhere/some.file
>
>
>
>
>And then later somewhere that URL is not resolved.
>
>Kendall
>
>On 3/13/16, 12:27 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
>Eliot Kimber" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
>ekim...@contrext.com> wrote:
>
>>I was just trying that now (the trailing quote was my typo but was also a
>>red herring).
>>
>>Yes, the value must be a URL and I've verified that using file:/c:/...
>>works.
>>
>>I'm trying to put together a code patch that does this automatically when
>>a normal filename is specified because this is pretty bad Simon Says
>>behavior. It doesn't help that the Javadoc for the Apache CatalogManager
>>isn't itself explicit that the catalog files property is in fact URLs, not
>>OS-specific file paths.
>>
>>Cheers,
>>
>>E.
>>
>>
>>Eliot Kimber, Owner
>>Contrext, LLC
>>http://contrext.com
>>
>>
>>
>>
>>On 3/13/16, 5:19 PM, "Imsieke, Gerrit, le-tex"
>><basex-talk-boun...@mailman.uni-konstanz.de on behalf of
>>gerrit.imsi...@le-tex.de> wrote:
>>
>>>Hi Eliot,
>>>
>>>I didn¹t recently try it on Windows myself, but just two observations.
>>>
>>>On 13.03.2016 01:13, Eliot Kimber wrote:
>>>> CATFILE = C:/workspace/DITA-OT2.x/catalog-dita.xml"
>>>
>>>There is a trailing quote sign here, is this intentional? Don¹t know the
>>>effects of unbalanced quotes here.
>>>
>>>In any case, it might be necessary to give the location as a file: URI,
>>>as in file:///C:/workspace/DITA-OT2.x/catalog-dita.xml
>>>Did you already try that?
>>>
>>>Gerrit
>>>
>>
>>


Re: [basex-talk] Catalog Resolution Under Windows

2016-03-13 Thread Kendall Shaw
I remember trying to figure out if the catalog files are supposed to be URIs or 
file paths (in commons resolver), and I think it was Catalog.parseCatalogFile 
that had a problem. It tries essentially:

catalogPath = path.replace(‘\\', ‘/‘)

new URL(baseURL, catalogPath)

and if that is a malformed URL, it tries:

new URL(“file:”, catalogPath)

So, with a canonical windows file path, the URL that it uses is:

file:c:/somewhere/some.file




And then later somewhere that URL is not resolved.

Kendall

On 3/13/16, 12:27 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Eliot Kimber"  wrote:

>I was just trying that now (the trailing quote was my typo but was also a
>red herring).
>
>Yes, the value must be a URL and I've verified that using file:/c:/...
>works.
>
>I'm trying to put together a code patch that does this automatically when
>a normal filename is specified because this is pretty bad Simon Says
>behavior. It doesn't help that the Javadoc for the Apache CatalogManager
>isn't itself explicit that the catalog files property is in fact URLs, not
>OS-specific file paths.
>
>Cheers,
>
>E.
>
>
>Eliot Kimber, Owner
>Contrext, LLC
>http://contrext.com
>
>
>
>
>On 3/13/16, 5:19 PM, "Imsieke, Gerrit, le-tex"
>gerrit.imsi...@le-tex.de> wrote:
>
>>Hi Eliot,
>>
>>I didn¹t recently try it on Windows myself, but just two observations.
>>
>>On 13.03.2016 01:13, Eliot Kimber wrote:
>>> CATFILE = C:/workspace/DITA-OT2.x/catalog-dita.xml"
>>
>>There is a trailing quote sign here, is this intentional? Don¹t know the
>>effects of unbalanced quotes here.
>>
>>In any case, it might be necessary to give the location as a file: URI,
>>as in file:///C:/workspace/DITA-OT2.x/catalog-dita.xml
>>Did you already try that?
>>
>>Gerrit
>>
>
>


Re: [basex-talk] Add docments and retrieve results using java

2016-02-22 Thread Kendall Shaw
It looks like the basex-test projects shows how to do what I want. Using 
QueryProcessor and the Xdm classes.

Kendall

From: 
<basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>>
 on behalf of Kendall Shaw 
<kendall.s...@workday.com<mailto:kendall.s...@workday.com>>
Date: Monday, February 22, 2016 at 4:56 PM
To: 
"basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>" 
<basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>>
Subject: [basex-talk] Add docments and retrieve results using java

How can I incrementally import XML documents into the database, using java? 
And, how can I incrementally retrieve query results and XML documents from the 
database, using java?

Either I am missing it, or XQJ does not allow you to store data into a 
database. Should I use xmldb API? Or, should I use the native API? If so how do 
I incrementally read and write, instead of loading everything into a string or 
reading and writing to/from files?

Kendall



[basex-talk] Add docments and retrieve results using java

2016-02-22 Thread Kendall Shaw
How can I incrementally import XML documents into the database, using java? 
And, how can I incrementally retrieve query results and XML documents from the 
database, using java?

Either I am missing it, or XQJ does not allow you to store data into a 
database. Should I use xmldb API? Or, should I use the native API? If so how do 
I incrementally read and write, instead of loading everything into a string or 
reading and writing to/from files?

Kendall



Re: [basex-talk] basex-xqj source?

2016-02-22 Thread Kendall Shaw
Oops. There is no source code…

From: 
<basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>>
 on behalf of Kendall Shaw 
<kendall.s...@workday.com<mailto:kendall.s...@workday.com>>
Date: Monday, February 22, 2016 at 3:51 PM
To: 
"basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>" 
<basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>>
Subject: Re: [basex-talk] basex-xqj source?

Oh, it’s here:

http://xqj.net/basex/download.jsp

Kendall

From: 
<basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>>
 on behalf of Kendall Shaw 
<kendall.s...@workday.com<mailto:kendall.s...@workday.com>>
Date: Monday, February 22, 2016 at 3:27 PM
To: 
"basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>" 
<basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>>
Subject: [basex-talk] basex-xqj source?

Hi,

Where can I find source code for the basex xqj implementation? I want to see 
what it is doing.

Thanks,
Kendall


Re: [basex-talk] basex-xqj source?

2016-02-22 Thread Kendall Shaw
Oh, it’s here:

http://xqj.net/basex/download.jsp

Kendall

From: 
<basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>>
 on behalf of Kendall Shaw 
<kendall.s...@workday.com<mailto:kendall.s...@workday.com>>
Date: Monday, February 22, 2016 at 3:27 PM
To: 
"basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>" 
<basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>>
Subject: [basex-talk] basex-xqj source?

Hi,

Where can I find source code for the basex xqj implementation? I want to see 
what it is doing.

Thanks,
Kendall


[basex-talk] basex-xqj source?

2016-02-22 Thread Kendall Shaw
Hi,

Where can I find source code for the basex xqj implementation? I want to see 
what it is doing.

Thanks,
Kendall


[basex-talk] metadata

2016-02-13 Thread Kendall Shaw
Unless there is now a standard way to associate metadata with documents and 
collections, is there a preferred method?

I could try to ensure that there is always a unique id that can be derived from 
combination of an id attribute or element in the document + the document’s 
document uri, then have separate metadata documents that are associated with 
the unique id. Is there an obviously better approach?

Kendall


Re: [basex-talk] Computed namespaces: which one is wrong?

2013-10-09 Thread Kendall Shaw

I think there is a trailing S in that URL. Without the S:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=22032


On 10/09/2013 08:09 AM, Christian Grün wrote:

Hi Marco,

yes, the 7.7 behavior is correct, it’s the result from a recent W3
decision [1]. You’ll probably have to rewrite your query as follows:

   a xmlns=ee/

Hope this helps,
Christian

[1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=22032S
___

2013/10/9 Marco Lettere marco.lett...@dedalus.eu:

Hello all,
in 7.6 I used to write code like the following one:

a
   {namespace {  } { ee }}
/a

it uses to return this as (the expcted) result:

a xmlns=ee/

In 7.7 the same code snipped returns a runtime exception stating that
namespace '' has been declared twice. I assume it's because a default
namespace is created under the hood on the root node. Is it?

Could I please have any help on this?
Thanks a lot,
M.
___
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





--
ThisIsHardToRead, asIsThis. This_is_easier, unless_it_is_underlined. 
This.is.easy. This-is-easy-too. Almost as easy to read as this.

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


Re: [basex-talk] Config file and data dir (with BaseXServer in Java)

2013-03-24 Thread Kendall Shaw

On 03/24/2013 12:15 PM, Florent Georges wrote:

   Hi,

   When I start a BaseXServer in Java, it creates a config file
~/.basex and a data directory ~/BaseXData.  Is there any way to
ask BaseX not to create the config file, and to use a specific
another data directory?

   Or at least to tell it where to look for the config file
(instead of going to ~/.basex)?  I couldn't find either in the
documentation.


If you look at org.basex.test.SandboxTest.java you can see the location 
of the data directory being specified. BaseXServer has a constructor 
that takes a Context. Presumably, you could use a context initialized as 
it is in SandboxTest to change the location.


So far, I am using LocalSession and the data directory is created where 
I specify, and ~/.basex and ~/BaseXData are not created.


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


Re: [basex-talk] Using BaseX in Java - doc?

2013-03-21 Thread Kendall Shaw

Hi,

I have to stop introducing myself with negative comments.

If people developing basex like the wildcards then that is a good enough 
reason to use them. My problem with wildcard imports is that I can't see 
what classes are imported by looking at the source code. I can use 
eclipse and find where things are. But, in that case, eclipse would by 
default be collapsing the imports making the source you see less 
cluttered than the imports with wildcards.


On the other hand, if wildcard imports are used because people are 
manually typing in the import statements and it is easier to type in 
wildcards, then such people who are not the author, or are the author a 
week into the future, would not be able to see what classes were 
imported because of the wildcards.


So, if it is based on the idea that everyone will use eclipse and it 
reduces clutter, it does the opposite for those people. If it is to make 
it easier for people not using eclipse, then people who work that way 
will have the problem of not seeing what classes are imported from 
looking at the source.


For the eclipse people, it's slightly less cluttered and slightly easier 
to not use wildcards. For the people not using eclipse, it shifts the 
burden from the person adding the import to everyone in the future.


Wow. Lot's of words.

About the examples, unless I missed it they all start with someone 
having manually done something like run a server. So, I was happy that 
the tests showed how to use a sandbox which was more like where I 
personally would like to start from, learning about basex.


Kendall



On 03/21/2013 01:28 PM, Dirk Kirsten wrote:

Hi,

There are lots of examples on this page in the wiki:
http://docs.basex.org/wiki/Java_Examples. You might be especially
interested in the local examples, if you do not wish to start a server. And
yes, you can embed it completely.

What is the problem with wildcard imports? I didn't know this is an issue.

Cheers,
Dirk


On Thu, Mar 21, 2013 at 7:09 PM, Kendall Shaw ques...@sonic.net wrote:


On 03/21/2013 10:34 AM, Florent Georges wrote:


Hi,

I was looking on http://docs.basex.org/ after documentation on
integrating BaseX within a Java application, but couldn't find
any.  Did I miss them?

In a few words, I have a Java webapp running in Tomcat, and I'd
like to use a BaseX database for the storage.  Can I embed it
completely?  Do I have to start a server as a completely separate
process?

Regards,


Hopefully someone has a better answer than this. I am looking at that
right now, too. It looks to me like you can embed it using LocalSession. I
am basing this on org.basex.test.server.**LocalSessionTest in the tests
in basex directory on github.

There are other examples there of starting client and server.

I wish that the code did not use wildcard imports everywhere.

Kendall

__**_
BaseX-Talk mailing list
basex-t...@mailman.uni-**konstanz.de BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.**de/mailman/listinfo/basex-talkhttps://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