Re: [basex-talk] eq vs =

2018-12-13 Thread E. Wray Johnson
The value comparison operators (eq, lt, etc.) are designed for comparing single 
values (i.e. sequences of one value each). The general comparison operators (=, 
<, etc.) are designed for comparing sequences of more than one value.

E. Wray Johnson

> On Dec 13, 2018, at 4:16 AM, Leo Studer  wrote:
> 
> Hello
> 
> Could someone explain me why this woks
> 
> //country[@population = max(//@population)]/name
> 
> Whereas this does not
> 
> //country[@population eq max(//@population)]/name
> 
> 
> Thanks in advance
> Leo


Re: [basex-talk] id generation and updates

2017-11-27 Thread E. Wray Johnson
I cannot get db:output to work.
Error is [XPST0008] Undefined variable $c for the following sample code:

copy $c := element test { element id { }}
> modify (
>   replace value of node $c/id with generate-id($c)
> )
> return db:output ($c/id), insert node $c into db:open('sample', 'tests')
>

On Sat, Nov 18, 2017 at 4:00 AM, Christian Grün <christian.gr...@gmail.com>
wrote:

> You might want to try db:output. See our documentation on performing
> returning updates and returning output.
>
>
>
> Am 18.11.2017 01:44 schrieb "E. Wray Johnson" <wray.john...@gmail.com>:
>
>> How can I white a single XQUERY statement that assigns an auto-generated
>> id to a node (using either generate-id(), or random:uuid() ) then inserts
>> the node into a database and then returns the auto-generated id.
>>
>> I can do the id assignment and insert operation just fine using { }, I
>> just don't know how to return the id afterward
>>
>


Re: [basex-talk] Issue preserving namespaces with json:parse

2017-11-24 Thread E. Wray Johnson
I already knew what was wrong.
I am looking/hoping for a solution.

Why does this code work and my earlier code not work?

declare namespace gml="http://www.opengis.net/gml;;
> import module namespace geo = "http://expath.org/ns/geo;;
> declare option output:method 'json';
> let $x :=
> element json { attribute type {'object'},
>   element coords {attribute type {'object'},
> element gml:Point {attribute type {'object'},
>   element gml:coordinates { "0,0" }
> }
>   }
> }
> let $y :=  json:serialize($x)
> return json:parse($y)
>

I tried without success, adding declare option output:method 'json';





On Fri, Nov 24, 2017 at 11:45 AM, Christian Grün <christian.gr...@gmail.com>
wrote:

> Run…
>
>   let $opt := map { "lax": true() }
>   return json:parse('{ "coords":{
>   "gml:Point":{
> "gml:coordinates":"0,0"
>   } } }', $opt )/json/coords/*
>
> …and I’m pretty sure you’ll see what is wrong if you compare the
> result with the examples in the documentation
> (http://docs.basex.org/wiki/Geo_Module#geo:distance).
>
>
>
> On Fri, Nov 24, 2017 at 5:31 PM, E. Wray Johnson <wray.john...@gmail.com>
> wrote:
> > What is wrong with this code?
> >
> > import module namespace geo = 'http://expath.org/ns/geo';
> > declare namespace gml='http://www.opengis.net/gml';
> >
> > let $opt := map { "lax": true() }
> > let $y :=  json:parse('{ "coords":{
> > "gml:Point":{
> >   "gml:coordinates":"0,0"
> > } } }', $opt )
> >
> > let $x :=  json:parse('{ "coords":{
> > "gml:Point":{
> >   "gml:coordinates":"-123.45,45.343"
> > } } }', $opt )
> >
> > return geo:distance($x/json/coords/*, $y/json/coords/*)
>


[basex-talk] Issue preserving namespaces with json:parse

2017-11-24 Thread E. Wray Johnson
What is wrong with this code?

import module namespace geo = 'http://expath.org/ns/geo';
declare namespace gml='http://www.opengis.net/gml';

let $opt := map { "lax": true() }
let $y :=  json:parse('{ "coords":{
"gml:Point":{
  "gml:coordinates":"0,0"
} } }', $opt )

let $x :=  json:parse('{ "coords":{
"gml:Point":{
  "gml:coordinates":"-123.45,45.343"
} } }', $opt )

return geo:distance($x/json/coords/*, $y/json/coords/*)


Re: [basex-talk] Loading data

2017-11-20 Thread E. Wray Johnson
The source/input data structure (i.e. element/property names) will not
typically match the output/database structure.
Also some fields (e.g. longitude and latitude will be transformed into a
gml:Point/gml:coordinate node.

On Mon, Nov 20, 2017 at 3:43 PM, Kendall Shaw <kendall.s...@workday.com>
wrote:

> 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>
> 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> on behalf of "E.
> Wray Johnson" <wray.john...@gmail.com>
> *Date: *Sunday, November 19, 2017 at 5:15 AM
> *To: *Michael Seiferle <m...@basex.org>
> *Cc: *BaseX <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 <(704)%20293-9008>
>
>
> On Nov 19, 2017, at 6:30 AM, Michael Seiferle <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/2bf258763c704f8ffd3ea9a3e8
> 1d25e2c6f6/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

Re: [basex-talk] Loading data

2017-11-20 Thread E. Wray Johnson
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>
wrote:

> 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: *<basex-talk-boun...@mailman.uni-konstanz.de> on behalf of "E.
> Wray Johnson" <wray.john...@gmail.com>
> *Date: *Sunday, November 19, 2017 at 5:15 AM
> *To: *Michael Seiferle <m...@basex.org>
> *Cc: *BaseX <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 <(704)%20293-9008>
>
>
> On Nov 19, 2017, at 6:30 AM, Michael Seiferle <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/2bf258763c704f8ffd3ea9a3e8
> 1d25e2c6f6/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/2bf258763c704f8ffd3ea9a3e8
> 1d25e2c6f6/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 this helps ;-)
>
>
>
> Best from Konstanz
>
>
>
> Michael
>
>
>
> Am 19.11.2017 um 06:25 schrieb E. Wray Johnson <wray.john...@gmail.com>:
>
>
>
>  I have a JSON file
> https://gist.githubusercontent.com/Miserlou/c5cd8364bf9b2420bb29/raw/
> 2bf2

Re: [basex-talk] Loading data

2017-11-19 Thread E. Wray Johnson
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 <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
> 
> 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 <wray.john...@gmail.com>:
>> 
>>  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.
>> 
> 


[basex-talk] Loading data

2017-11-18 Thread 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] Spatial Reference not working

2017-11-18 Thread E. Wray Johnson
https://github.com/locationtech/jts/blob/master/modules/core/src/main/java/org/locationtech/jts/io/gml2/GeometryStrategies.java

On Tue, Nov 14, 2017 at 4:53 AM, Christian Grün <christian.gr...@gmail.com>
wrote:

> Hi Wray,
>
> The project you referenced seems to be a from the original JTS library
> [1]. If there is an offical JTS branch/fork that provides support for
> SRIDs, we could think about switching to that version.
>
> Best,
> Christian
>
> [1] https://github.com/simplegeo/jts
>
>
>
> On Tue, Nov 14, 2017 at 12:53 AM, Christian Grün
> <christian.gr...@gmail.com> wrote:
> > Thanks for the hint! I’ll look at this later this day.
> >
> >
> > Am 14.11.2017 00:51 schrieb "E. Wray Johnson" <wray.john...@gmail.com>:
> >>
> >> According to this:
> >>
> >>
> >> https://github.com/B3Partners/jump-b3p/blob/master/src/main/
> java/com/vividsolutions/jump/io/GMLReader.java
> >>
> >> Around Line 202-218
> >>
> >> BaseX needs to turn on the capability per line 217-281 (I suggest by
> >> default) or allow users to turn it on.
> >>
> >> On Mon, Nov 13, 2017 at 6:38 PM, Christian Grün
> >> <christian.gr...@gmail.com> wrote:
> >>>
> >>> The Geo Module is basically a light-weight wrapper for the JTS Topology
> >>> Suite: geo:srid calls getSRID() (see [1]). Maybe you could ask on the
> jts
> >>> mailing list and give us some feedback?
> >>>
> >>> [1]
> >>> https://github.com/BaseXdb/basex/blob/master/basex-api/
> src/main/java/org/expath/ns/Geo.java
> >>>
> >>>
> >>>
> >>> Am 14.11.2017 12:23 vorm. schrieb "E. Wray Johnson"
> >>> <wray.john...@gmail.com>:
> >>>
> >>> I am sorry, I did not make myself clear.  It always returns 0.  There
> is
> >>> a way to set the spatial reference.  Typically with the srsName
> attribute on
> >>> the geometry.  In this example that would be the gml:Polygon element.
> >>> However, none of the valid values is recognized by JTS. It is as if the
> >>> srsName attribute is not getting to JTS.
> >>>
> >>> On Mon, Nov 13, 2017 at 5:41 PM, Christian Grün
> >>> <christian.gr...@gmail.com> wrote:
> >>>>
> >>>> > I can’t get the geo:srid() to work.  I have tried many combinations
> of
> >>>> > @srsName values.  Can anyone provide examples?
> >>>>
> >>>> Try e.g. this:
> >>>>
> >>>>   import module namespace geo='http://expath.org/ns/geo';
> >>>>   declare namespace gml='http://www.opengis.net/gml';
> >>>>   geo:srid(
> >>>> 
> >>>>   
> >>>> 
> >>>>   -150,50 -150,60 -125,60 -125,50
> >>>> -150,50
> >>>> 
> >>>>   
> >>>> 
> >>>>   )
> >>>
> >>>
> >>>
> >>
> >
>


Re: [basex-talk] id generation and updates

2017-11-18 Thread E. Wray Johnson
That should work. Thanks.

Wray Johnson
(m) 704-293-9008

> On Nov 18, 2017, at 4:19 AM, Xavier-Laurent SALVADOR 
> <xavierlaurent.salva...@gmail.com> wrote:
> 
> Hi all,
> I don't know if that helps. 
> 
> 1- Here is how we (Isilex) do multiple tests before inserting a node while we 
> redirect at the same time the user to another web Page using db:output :
> 
> try { 
>  db:output(/),   (:Redirection:)
>   if($isi:testid2) 
>then 
>   if 
> (db:open('site')//texts[name=$idPage]/text[@lang=$lg]) 
>   then 
>   for $x in 
> db:open('site')//texts[name=$idPage]/text[@lang=$lg] 
>   return replace node $x with 
> html:parse($node, map { 'nons': true() }) (:Insert 1:)
>   
>   else if (db:open('pages')//page[name=$idPage]) 
>   
>   then 
>   replace node 
> db:open('pages')//page[name=$idPage] with 
>   
> html:parse(normalize-space($node), map { 'nons': true() }) 
>   else if (not(fetch:xml(normalize-space($node), 
> map{'chop': true()})//name = ('','Titre de la page','Page 
> title','Nom','Name'))) 
>   then 
>   insert node 
> html:parse(normalize-space($node), map{'nons': true()}) into 
> db:open('pages')/root   (:Insert 2:)
>   else 
> db:output(/err:save) 
>else 
> db:output(isi:template(isi:t('unauthorized_access'))) 
>}
> catch * { fn:error(xs:QName('err:save'), $node) } };
> 
> 2- Here is how we save a file onto a disk and at the same time we redirect a 
> user to another web page:
>  
>(db:output(/myUrl)
> ,
> file:write($filePath,$css,map { "method": "text"})
>)
> 
> Hope We helped,
> 
> 
> 
> 
> 2017-11-18 10:00 GMT+01:00 Christian Grün <christian.gr...@gmail.com>:
>> You might want to try db:output. See our documentation on performing 
>> returning updates and returning output.
>> 
>> 
>> 
>> Am 18.11.2017 01:44 schrieb "E. Wray Johnson" <wray.john...@gmail.com>:
>>> How can I white a single XQUERY statement that assigns an auto-generated id 
>>> to a node (using either generate-id(), or random:uuid() ) then inserts the 
>>> node into a database and then returns the auto-generated id.
>>> 
>>> I can do the id assignment and insert operation just fine using { }, I just 
>>> don't know how to return the id afterward
> 
> 
> 
> -- 
> Ce message peut contenir des informations réservées exclusivement à son 
> destinataire. Toute diffusion  sans autorisation est interdite. Si vous n'en 
> êtes pas le destinataire, merci de prendre contact avec l'expéditeur et de 
> détruire ce message.
> 
> This email may contain material for the sole use of the intended recipient. 
> Any forwarding without express permission is prohibited. If you are not the 
> intended recipient, please contact the sender and delete all copies.


[basex-talk] id generation and updates

2017-11-17 Thread E. Wray Johnson
How can I white a single XQUERY statement that assigns an auto-generated id
to a node (using either generate-id(), or random:uuid() ) then inserts the
node into a database and then returns the auto-generated id.

I can do the id assignment and insert operation just fine using { }, I just
don't know how to return the id afterward


Re: [basex-talk] Update/Delete JSON

2017-11-15 Thread E. Wray Johnson
Christian,

Can you give an example of how to convert JSON data to atomic XQuery items
(sepecifically strings, numbers and booleans)?  Is it as simple as removing
the curly brackets to bound an object?

On Wed, Nov 15, 2017 at 11:05 AM, Kendall Shaw 
wrote:

> On 11/15/17, 4:24 AM, "basex-talk-boun...@mailman.uni-konstanz.de on
> behalf of Christian Grün"  behalf of christian.gr...@gmail.com> 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
>
>


[basex-talk] basex-node binding objects

2017-11-15 Thread E. Wray Johnson
Andy,


   1. I am pelase that JSON result objects are mapped to JavaScript
   objects.  Are undefined values handled (e.g. XQuery () vs JavaScript
   undefined)?
   2. I am using basex-node and having trouble binding objects in a query.
   I would like to have the object result in an XQUERY map.  It would be nice
   if undefined values as defined above are handled as well.  For now I have
   to do something like this'$x := map '
   +JSON.stringify(obj).replace('undefined', '()').

I hope this make sense.


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

2017-11-13 Thread E. Wray Johnson
How can database updating be done inside map:for-each ?


Re: [basex-talk] Spatial Reference not working

2017-11-13 Thread E. Wray Johnson
According to this:

https://github.com/B3Partners/jump-b3p/blob/master/src/main/java/com/vividsolutions/jump/io/GMLReader.java

Around Line 202-218

BaseX needs to turn on the capability per line 217-281 (I suggest by
default) or allow users to turn it on.

On Mon, Nov 13, 2017 at 6:38 PM, Christian Grün <christian.gr...@gmail.com>
wrote:

> The Geo Module is basically a light-weight wrapper for the JTS Topology
> Suite: geo:srid calls getSRID() (see [1]). Maybe you could ask on the jts
> mailing list and give us some feedback?
>
> [1] https://github.com/BaseXdb/basex/blob/master/
> basex-api/src/main/java/org/expath/ns/Geo.java
>
>
>
> Am 14.11.2017 12:23 vorm. schrieb "E. Wray Johnson" <
> wray.john...@gmail.com>:
>
> I am sorry, I did not make myself clear.  It always returns 0.  There is a
> way to set the spatial reference.  Typically with the srsName attribute on
> the geometry.  In this example that would be the gml:Polygon element.
> However, none of the valid values is recognized by JTS. It is as if the
> srsName attribute is not getting to JTS.
>
> On Mon, Nov 13, 2017 at 5:41 PM, Christian Grün <christian.gr...@gmail.com
> > wrote:
>
>> > I can’t get the geo:srid() to work.  I have tried many combinations of
>> @srsName values.  Can anyone provide examples?
>>
>> Try e.g. this:
>>
>>   import module namespace geo='http://expath.org/ns/geo';
>>   declare namespace gml='http://www.opengis.net/gml';
>>   geo:srid(
>> 
>>   
>> 
>>   -150,50 -150,60 -125,60 -125,50
>> -150,50
>> 
>>   
>> 
>>   )
>>
>
>
>


Re: [basex-talk] Spatial Reference not working

2017-11-13 Thread E. Wray Johnson
I am sorry, I did not make myself clear.  It always returns 0.  There is a
way to set the spatial reference.  Typically with the srsName attribute on
the geometry.  In this example that would be the gml:Polygon element.
However, none of the valid values is recognized by JTS. It is as if the
srsName attribute is not getting to JTS.

On Mon, Nov 13, 2017 at 5:41 PM, Christian Grün 
wrote:

> > I can’t get the geo:srid() to work.  I have tried many combinations of
> @srsName values.  Can anyone provide examples?
>
> Try e.g. this:
>
>   import module namespace geo='http://expath.org/ns/geo';
>   declare namespace gml='http://www.opengis.net/gml';
>   geo:srid(
> 
>   
> 
>   -150,50 -150,60 -125,60 -125,50
> -150,50
> 
>   
> 
>   )
>


Re: [basex-talk] Update operations on JSON objects are not working

2017-11-13 Thread E. Wray Johnson
Thanks.  I figured out what I was doing wrong.

On Mon, Nov 13, 2017 at 5:36 PM Christian Grün <christian.gr...@gmail.com>
wrote:

> The update keyword is a so-called “non-updating expression”; the
> result will not have any effect on the database. You can use the
> simple map operator…
>
> db:open('db','country')/json[countryId = 1] ! (
>replace value of node countryName with 'Aldorria',
>insert node 1000 into .
> )
>
> …or FLWOR expressions, etc. to change nodes in the database.
>
> See e.g. [1] to learn more about XQuery Update.
> ___
>
> [1] http://docs.basex.org/wiki/XQuery_Update
>
>
> On Sun, Nov 12, 2017 at 6:12 AM, E. Wray Johnson <wray.john...@gmail.com>
> wrote:
> > I have tried many ways of updating JSON objects and none seem to work.
> > Using the BaseX GUI, the Result window seems to show the correct outcom,
> but
> > the database is not modified.  What am I missing? Do I need to explicitly
> > start/stop a transaction?
> >
> > XQUERY:
> > db:open('db','country')/json[countryId = 1]
> > update {
> >replace value of node countryName with 'Aldorria',
> >insert node 1000 into .
> > }
> >
> >
> > Result:
> > 
> >   1
> >   Aldorria
> >   1234
> >   Zeldon
> > 
>


Re: [basex-talk] GEO module not found with BaseX GUI

2017-11-12 Thread E. Wray Johnson
Any of the samples from the documentation also create the problem.

Wray Johnson
(m) 704-293-9008

> On Nov 12, 2017, at 3:29 PM, Christian Grün <christian.gr...@gmail.com> wrote:
> 
> Thanks.
> 
> Wray, I’m still interested in finding out why the gui script behaves
> differently than the server script (but are nearly identical). Could
> you possibly send me your start scripts and the XQuery expression with
> the Geo module import that caused the problems you reported?
> 
> 
> 
> On Sat, Nov 11, 2017 at 11:46 PM, E. Wray Johnson
> <wray.john...@gmail.com> wrote:
>> Windows 7
>> 
>> Wray Johnson
>> 
>>> On Nov 11, 2017, at 4:38 PM, karol stachura <k...@geoinformatyka.com.pl> 
>>> wrote:
>>> 
>>> Hello,
>>> 
>>> Windows 10 Home version 1703 compilation: 15063.674
>>> 
>>> jre1.8.0_151
>>> 
>>> Regards,
>>> 
>>> Karol Stachura
>>> 
>>> 
>>> W dniu 2017-11-11 o 20:10, Christian Grün pisze:
>>>> Dear Karol,
>>>> 
>>>> Thanks for the interesting hint; I have just revised the scripts and
>>>> uploaded new snapshots [1].
>>>> 
>>>> I am wondering right now why the (questionable) forward slashes never
>>>> caused any problems on our systems. May I ask which version of Windows
>>>> you are using?
>>>> 
>>>> Next (@E. Wray), I am wondering why the Geo Module was contained in
>>>> the class path when using the BaseX server, because all Windows start
>>>> scripts were using forward slashes. Any thoughts are welcome.
>>>> 
>>>> Best,
>>>> Christian
>>>> 
>>>> [1] http://files.basex.org/releases/latest/
>>>> 
>>>> 
>>>> 
>>>> On Sat, Nov 11, 2017 at 6:51 PM, karol stachura
>>>> <k...@geoinformatyka.com.pl> wrote:
>>>>> Try to change slash to backslash in basexgui.bat (windows)
>>>>> 
>>>>> In my case this solved the problem.
>>>>> 
>>>>> Regards,
>>>>> 
>>>>> Karol Stachura
>>>>> 
>>>>> 
>>>>> W dniu 2017-11-11 o 16:58, Christian Grün pisze:
>>>>> 
>>>>> I installed 8.6.7 on a clean system (Windows 10), and the Geo module is
>>>>> correctly detected when running basexgui.bat. I can confirm, however, that
>>>>> it is not found when running BaseX.exe.
>>>>> 
>>>>> Maybe it helps to delete and reinstall BaseX? If it doesn’t, feel free to
>>>>> provide me with some steps how to reproduce the issue.
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Am 11.11.2017 16:49 schrieb "E. Wray Johnson" <wray.john...@gmail.com>:
>>>>>> Yes this problem occurs when running basexgui.bat, but it doesn’t if I 
>>>>>> run
>>>>>> basexserver.bat.
>>>>>> I am running official version 8.6.7.
>>>>>> I have not tried the latest snapshot.
>>>>>> It does not make a difference the directory from which it runs.
>>>>>> 
>>>>>> 
>>>>>> On Sat, Nov 11, 2017 at 10:42 AM Christian Grün
>>>>>> <christian.gr...@gmail.com> wrote:
>>>>>>> Sorry for keeping you waiting. So this problem occurs when running
>>>>>>> basexgui.bat, but it doesn’t if you run basexserver.bat? Does it make a
>>>>>>> difference from which directory you start the scripts? And I guess the
>>>>>>> problem also occurs with the latest snapshot?
>>>>>>> 
>>>>>>> Thanks in advance,
>>>>>>> Christian
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Am 11.11.2017 16:37 schrieb "E. Wray Johnson" <wray.john...@gmail.com>:
>>>>>>>> This happens in the BaseX GUI not Server.
>>>>>>>> 
>>>>>>>> Error:
>>>>>>>> Stopped at D:/projects/xquery/geo test.xq, 1/57:
>>>>>>>> [XQST0059] Module not found: http://expath.org/ns/geo.
>>>>>>>> 
>>>>>>>> Query:
>>>>>>>> import module namespace geo = "http://expath.org/ns/geo;; declare
>>>>>>>> namespace gml='http://www.opengis.net/gml'; for $x in
>>>>>>>> db:open('geonames2','country') where index-of(['US'], 
>>>>>>>> $x/json/countryCode)>0
>>>>>>>> return geo:envelope(  ($x/west, 
>>>>>>>> $x/south),
>>>>>>>> ($x/east, $x/south), ($x/east, $x/north), ($x/west, $x/north), 
>>>>>>>> ($x/west,
>>>>>>>> $x/south)  )
>>>>>>>> 
>>>>>>>> OS: Windows 7
>>>>>>>> Installation Method: Windows installer
>>>>>>>> Launch: basexgui.bat
>>>>>>>> 
>>>>>>>> I had this problem long ago.
>>>>>>>> 
>>>>>>>> 
>>>>>>>> https://www.mail-archive.com/search?l=basex-talk@mailman.uni-konstanz.de=subject:%22%5C%5Bbasex%5C-talk%5C%5D+Geo+Module+Not+found%22=newest=1
>>>>> 
>>> 


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

2017-11-12 Thread E. Wray Johnson
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?
  1. How can I change the 'name' or 'birth'?
  2. How can I add a 'population' number?
  2. How can I delete either of these documents using 'code' as the
   unique identifier?


[basex-talk] Update operations on JSON objects are not working

2017-11-11 Thread E. Wray Johnson
I have tried many ways of updating JSON objects and none seem to work.
Using the BaseX GUI, the Result window seems to show the correct outcom,
but the database is not modified.  What am I missing? Do I need to
explicitly start/stop a transaction?

XQUERY:
db:open('db','country')/json[countryId = 1]
update {
   replace value of node countryName with 'Aldorria',
   insert node 1000 into .
}


Result:

  1
  Aldorria
  1234
  Zeldon



[basex-talk] Update/Delete JSON

2017-11-11 Thread E. Wray Johnson
What is the best way to update JSON objects (only some object values) by unique 
id? 

What is the best way to delete JSON objects by unique id?

Wray Johnson
(m) 704-293-9008

[basex-talk] Spatial Reference not working

2017-11-11 Thread E. Wray Johnson
I can’t get the geo:srid() to work.  I have tried many combinations of @srsName 
values.  Can anyone provide examples?

E. Wray Johnson



Re: [basex-talk] GEO module not found with BaseX GUI

2017-11-11 Thread E. Wray Johnson
Windows 7

Wray Johnson

> On Nov 11, 2017, at 4:38 PM, karol stachura <k...@geoinformatyka.com.pl> 
> wrote:
> 
> Hello,
> 
> Windows 10 Home version 1703 compilation: 15063.674
> 
> jre1.8.0_151
> 
> Regards,
> 
> Karol Stachura
> 
> 
> W dniu 2017-11-11 o 20:10, Christian Grün pisze:
>> Dear Karol,
>> 
>> Thanks for the interesting hint; I have just revised the scripts and
>> uploaded new snapshots [1].
>> 
>> I am wondering right now why the (questionable) forward slashes never
>> caused any problems on our systems. May I ask which version of Windows
>> you are using?
>> 
>> Next (@E. Wray), I am wondering why the Geo Module was contained in
>> the class path when using the BaseX server, because all Windows start
>> scripts were using forward slashes. Any thoughts are welcome.
>> 
>> Best,
>> Christian
>> 
>> [1] http://files.basex.org/releases/latest/
>> 
>> 
>> 
>> On Sat, Nov 11, 2017 at 6:51 PM, karol stachura
>> <k...@geoinformatyka.com.pl> wrote:
>>> Try to change slash to backslash in basexgui.bat (windows)
>>> 
>>> In my case this solved the problem.
>>> 
>>> Regards,
>>> 
>>> Karol Stachura
>>> 
>>> 
>>> W dniu 2017-11-11 o 16:58, Christian Grün pisze:
>>> 
>>> I installed 8.6.7 on a clean system (Windows 10), and the Geo module is
>>> correctly detected when running basexgui.bat. I can confirm, however, that
>>> it is not found when running BaseX.exe.
>>> 
>>> Maybe it helps to delete and reinstall BaseX? If it doesn’t, feel free to
>>> provide me with some steps how to reproduce the issue.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Am 11.11.2017 16:49 schrieb "E. Wray Johnson" <wray.john...@gmail.com>:
>>>> Yes this problem occurs when running basexgui.bat, but it doesn’t if I run
>>>> basexserver.bat.
>>>> I am running official version 8.6.7.
>>>> I have not tried the latest snapshot.
>>>> It does not make a difference the directory from which it runs.
>>>> 
>>>> 
>>>> On Sat, Nov 11, 2017 at 10:42 AM Christian Grün
>>>> <christian.gr...@gmail.com> wrote:
>>>>> Sorry for keeping you waiting. So this problem occurs when running
>>>>> basexgui.bat, but it doesn’t if you run basexserver.bat? Does it make a
>>>>> difference from which directory you start the scripts? And I guess the
>>>>> problem also occurs with the latest snapshot?
>>>>> 
>>>>> Thanks in advance,
>>>>> Christian
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Am 11.11.2017 16:37 schrieb "E. Wray Johnson" <wray.john...@gmail.com>:
>>>>>> This happens in the BaseX GUI not Server.
>>>>>> 
>>>>>> Error:
>>>>>> Stopped at D:/projects/xquery/geo test.xq, 1/57:
>>>>>> [XQST0059] Module not found: http://expath.org/ns/geo.
>>>>>> 
>>>>>> Query:
>>>>>> import module namespace geo = "http://expath.org/ns/geo;; declare
>>>>>> namespace gml='http://www.opengis.net/gml'; for $x in
>>>>>> db:open('geonames2','country') where index-of(['US'], 
>>>>>> $x/json/countryCode)>0
>>>>>> return geo:envelope(  ($x/west, 
>>>>>> $x/south),
>>>>>> ($x/east, $x/south), ($x/east, $x/north), ($x/west, $x/north), ($x/west,
>>>>>> $x/south)  )
>>>>>> 
>>>>>> OS: Windows 7
>>>>>> Installation Method: Windows installer
>>>>>> Launch: basexgui.bat
>>>>>> 
>>>>>> I had this problem long ago.
>>>>>> 
>>>>>> 
>>>>>> https://www.mail-archive.com/search?l=basex-talk@mailman.uni-konstanz.de=subject:%22%5C%5Bbasex%5C-talk%5C%5D+Geo+Module+Not+found%22=newest=1
>>> 
> 


Re: [basex-talk] GEO module not found with BaseX GUI

2017-11-11 Thread E. Wray Johnson
That worked.
Thanks

Wray Johnson


> On Nov 11, 2017, at 12:51 PM, karol stachura <k...@geoinformatyka.com.pl> 
> wrote:
> 
> Try to change slash to backslash in basexgui.bat (windows)
> 
> In my case this solved the problem.
> Regards,
> 
> Karol Stachura
> 
> 
> W dniu 2017-11-11 o 16:58, Christian   Grün pisze:
>> I installed 8.6.7 on a clean system (Windows 10), and the Geo module is 
>> correctly detected when running basexgui.bat. I can confirm, however, that 
>> it is not found when running BaseX.exe.
>> 
>> Maybe it helps to delete and reinstall BaseX? If it doesn’t, feel free to 
>> provide me with some steps how to reproduce the issue.
>> 
>> 
>> 
>> 
>> 
>> Am 11.11.2017 16:49 schrieb "E. Wray Johnson" <wray.john...@gmail.com>:
>>> Yes this problem occurs when running basexgui.bat, but it doesn’t if I run 
>>> basexserver.bat.
>>> I am running official version 8.6.7.
>>> I have not tried the latest snapshot.
>>> It does not make a difference the directory from which it runs.
>>> 
>>> 
>>>> On Sat, Nov 11, 2017 at 10:42 AM Christian Grün 
>>>> <christian.gr...@gmail.com> wrote:
>>>> Sorry for keeping you waiting. So this problem occurs when running 
>>>> basexgui.bat, but it doesn’t if you run basexserver.bat? Does it make a 
>>>> difference from which directory you start the scripts? And I guess the 
>>>> problem also occurs with the latest snapshot?
>>>> 
>>>> Thanks in advance,
>>>> Christian
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Am 11.11.2017 16:37 schrieb "E. Wray Johnson" <wray.john...@gmail.com>:
>>>>> This happens in the BaseX GUI not Server.
>>>>> 
>>>>>> Error:
>>>>>> Stopped at D:/projects/xquery/geo test.xq, 1/57:
>>>>>> [XQST0059] Module not found: http://expath.org/ns/geo.
>>>>>> 
>>>>>> Query:
>>>>>> import module namespace geo = "http://expath.org/ns/geo;; declare 
>>>>>> namespace gml='http://www.opengis.net/gml'; for $x in 
>>>>>> db:open('geonames2','country') where index-of(['US'], 
>>>>>> $x/json/countryCode)>0 return geo:envelope(  
>>>>>> ($x/west, $x/south), 
>>>>>> ($x/east, $x/south), ($x/east, $x/north), ($x/west, $x/north), ($x/west, 
>>>>>> $x/south)  )
>>>>>> 
>>>>>> OS: Windows 7
>>>>>> Installation Method: Windows installer
>>>>>> Launch: basexgui.bat
>>>>>> 
>>>>>> I had this problem long ago.
>>>>>> 
>>>>>> https://www.mail-archive.com/search?l=basex-talk@mailman.uni-konstanz.de=subject:%22%5C%5Bbasex%5C-talk%5C%5D+Geo+Module+Not+found%22=newest=1
> 


Re: [basex-talk] GEO module not found with BaseX GUI

2017-11-11 Thread E. Wray Johnson
Yes this problem occurs when running basexgui.bat, but it doesn’t if I run
basexserver.bat.
I am running official version 8.6.7.
I have not tried the latest snapshot.
It does not make a difference the directory from which it runs.


On Sat, Nov 11, 2017 at 10:42 AM Christian Grün <christian.gr...@gmail.com>
wrote:

> Sorry for keeping you waiting. So this problem occurs when running
> basexgui.bat, but it doesn’t if you run basexserver.bat? Does it make a
> difference from which directory you start the scripts? And I guess the
> problem also occurs with the latest snapshot?
>
> Thanks in advance,
> Christian
>
>
>
>
>
> Am 11.11.2017 16:37 schrieb "E. Wray Johnson" <wray.john...@gmail.com>:
>
>> This happens in the BaseX GUI not Server.
>>
>> Error:
>> Stopped at D:/projects/xquery/geo test.xq, 1/57:
>> [XQST0059] Module not found: http://expath.org/ns/geo.
>>
>> Query:
>> import module namespace geo = "http://expath.org/ns/geo;; declare
>> namespace gml='http://www.opengis.net/gml'; for $x in
>> db:open('geonames2','country') where index-of(['US'],
>> $x/json/countryCode)>0 return geo:envelope( 
>> ($x/west, $x/south), ($x/east, $x/south), ($x/east,
>> $x/north), ($x/west, $x/north), ($x/west, $x/south)
>>  )
>>
>> OS: Windows 7
>> Installation Method: Windows installer
>> Launch: basexgui.bat
>>
>> I had this problem long ago.
>>
>> https://www.mail-archive.com/search?l=basex-talk@mailman.
>> uni-konstanz.de=subject:%22%5C%5Bbasex%5C-talk%5C%5D+Geo+
>> Module+Not+found%22=newest=1
>>
>>


Re: [basex-talk] GEO module not found with BaseX GUI

2017-11-11 Thread E. Wray Johnson
This happens in the BaseX GUI not Server.

> Error:
> Stopped at D:/projects/xquery/geo test.xq, 1/57:
> [XQST0059] Module not found: http://expath.org/ns/geo.
> 
> Query:
> import module namespace geo = "http://expath.org/ns/geo;; declare namespace 
> gml='http://www.opengis.net/gml'; for $x in db:open('geonames2','country') 
> where index-of(['US'], $x/json/countryCode)>0 return geo:envelope( 
>  ($x/west, $x/south), ($x/east, $x/south), 
> ($x/east, $x/north), ($x/west, $x/north), ($x/west, 
> $x/south)  )
> 
> OS: Windows 7
> Installation Method: Windows installer
> Launch: basexgui.bat
> 
> I had this problem long ago.
> 
> https://www.mail-archive.com/search?l=basex-talk@mailman.uni-konstanz.de=subject:%22%5C%5Bbasex%5C-talk%5C%5D+Geo+Module+Not+found%22=newest=1


[basex-talk] GEO module not found with BaseX GUI

2017-11-10 Thread E. Wray Johnson
Error:
Stopped at D:/projects/xquery/geo test.xq, 1/57:
[XQST0059] Module not found: http://expath.org/ns/geo.

Query:
import module namespace geo = "http://expath.org/ns/geo;; declare namespace
gml='http://www.opengis.net/gml'; for $x in db:open('geonames2','country')
where index-of(['US'], $x/json/countryCode)>0 return geo:envelope(
 ($x/west, $x/south), ($x/east, $x/south),
($x/east, $x/north), ($x/west, $x/north), ($x/west,
$x/south)  )

OS: Windows 7
Installation Method: Windows installer
Launch: basexgui.bat

I had this problem long ago.

https://www.mail-archive.com/search?l=basex-talk@mailman.uni-konstanz.de=subject:%22%5C%5Bbasex%5C-talk%5C%5D+Geo+Module+Not+found%22=newest=1


Re: [basex-talk] REST API not working

2016-09-02 Thread E. Wray Johnson
OK, I was running basexserver instead of basexhttp.
It's been months since I used basex and simply forgot.

On Fri, Sep 2, 2016 at 9:59 PM, E. Wray Johnson <wray.john...@gmail.com>
wrote:

> http://localhost:8984/rest/
>
> Still hanging.
> Where is the log file where I can see what's going on?
>
> Wray Johnson
>
>
> On Sep 2, 2016, at 8:36 PM, E. Wray Johnson <wray.john...@gmail.com>
> wrote:
>
> C:\Users\Administrator>basexserver -d
> BaseX 8.5.3 [Server]
> Server was started (port: 1984).
>
> On Thu, Sep 1, 2016 at 5:13 AM, Dirk Kirsten <d...@basex.org> wrote:
>
>> Hello,
>>
>> How do you start the basex server? Could you please start it in debug
>> mode and post us the console output?
>> Cheers, Dirk
>>
>>
>> On 08/31/2016 04:41 PM, E. Wray Johnson wrote:
>>
>> I apologize, by 12 I meant Windows Server 2012.
>> BaseX version is 8.5.3
>> By TCP vs REST I mean for REST I was using default port 8984 instead of
>> the default server TCP port 1984
>> For example: http://*admin*:*admin*@localhost:8984/*rest  *OR
>> http://localhost:8984/
>> *rest *
>> I run basexserver from DOS Command Prompt
>> *. *
>> I am using a web browser to test as I have many times before with version
>> 8.4
>> I know the server is listening because it hangs and does not return,
>> which does not occur when the server is stopped.
>>
>> On Wed, Aug 31, 2016 at 9:15 AM, Dirk Kirsten <d...@basex.org> wrote:
>>
>>> Hello,
>>>
>>> Windows 12? I am an long-time linux-only user, but isn't the most
>>> current windows version 10 or am I missing the news completely?
>>>
>>> You will have to be much more specific. Please specify which BaseX
>>> version you use, please post how you start the basexserver and the
>>> console output and how you try to reach the REST endpoint. Also, I don't
>>> know what you mean by you are not confusing TCP and REST port. This
>>> statement doesn't really make sense, as REST uses TCP...
>>>
>>> Cheers
>>>
>>> Dirk
>>>
>>>
>>> On 08/31/2016 02:09 PM, E. Wray Johnson wrote:
>>> > Windows 12 server, running basexserver. Server is listening but hangs
>>> and never returns anything. When server is killed behavior is different so
>>> I can tell the server was listening on the REST port when running.  I am
>>> not confusing the TCP port with REST port.
>>>
>>> --
>>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
>>> |   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
>>> `-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22
>>>
>>>
>>
>>
>> --
>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
>> |   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
>> `-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22
>>
>>
>
>


Re: [basex-talk] REST API not working

2016-09-02 Thread E. Wray Johnson
http://localhost:8984/rest/

Still hanging.
Where is the log file where I can see what's going on?

Wray Johnson


> On Sep 2, 2016, at 8:36 PM, E. Wray Johnson <wray.john...@gmail.com> wrote:
> 
> C:\Users\Administrator>basexserver -d
> BaseX 8.5.3 [Server]
> Server was started (port: 1984).
> 
>> On Thu, Sep 1, 2016 at 5:13 AM, Dirk Kirsten <d...@basex.org> wrote:
>> Hello,
>> 
>> How do you start the basex server? Could you please start it in debug mode 
>> and post us the console output?
>> Cheers, Dirk
>> 
>> 
>>> On 08/31/2016 04:41 PM, E. Wray Johnson wrote:
>>> I apologize, by 12 I meant Windows Server 2012.
>>> BaseX version is 8.5.3
>>> By TCP vs REST I mean for REST I was using default port 8984 instead of the 
>>> default server TCP port 1984
>>> For example: http://admin:admin@localhost:8984/rest  OR 
>>> http://localhost:8984/rest
>>> I run basexserver from DOS Command Prompt.
>>> I am using a web browser to test as I have many times before with version 
>>> 8.4 
>>> I know the server is listening because it hangs and does not return, which 
>>> does not occur when the server is stopped.
>>> 
>>> On Wed, Aug 31, 2016 at 9:15 AM, Dirk Kirsten <d...@basex.org> wrote:
>>>> Hello,
>>>> 
>>>> Windows 12? I am an long-time linux-only user, but isn't the most
>>>> current windows version 10 or am I missing the news completely?
>>>> 
>>>> You will have to be much more specific. Please specify which BaseX
>>>> version you use, please post how you start the basexserver and the
>>>> console output and how you try to reach the REST endpoint. Also, I don't
>>>> know what you mean by you are not confusing TCP and REST port. This
>>>> statement doesn't really make sense, as REST uses TCP...
>>>> 
>>>> Cheers
>>>> 
>>>> Dirk
>>>> 
>>>> 
>>>> On 08/31/2016 02:09 PM, E. Wray Johnson wrote:
>>>> > Windows 12 server, running basexserver. Server is listening but hangs 
>>>> > and never returns anything. When server is killed behavior is different 
>>>> > so I can tell the server was listening on the REST port when running.  I 
>>>> > am not confusing the TCP port with REST   port.
>>>> 
>>>> --
>>>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
>>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
>>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
>>>> |   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
>>>> `-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22
>> 
>> -- 
>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
>> |   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
>> `-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22
> 
> 


[basex-talk] Fwd: REST API not working

2016-09-02 Thread E. Wray Johnson
C:\Users\Administrator>basexserver -d
BaseX 8.5.3 [Server]
Server was started (port: 1984).

On Thu, Sep 1, 2016 at 5:13 AM, Dirk Kirsten <d...@basex.org> wrote:

> Hello,
>
> How do you start the basex server? Could you please start it in debug mode
> and post us the console output?
> Cheers, Dirk
>
>
> On 08/31/2016 04:41 PM, E. Wray Johnson wrote:
>
> I apologize, by 12 I meant Windows Server 2012.
> BaseX version is 8.5.3
> By TCP vs REST I mean for REST I was using default port 8984 instead of
> the default server TCP port 1984
> For example: http://*admin*:*admin*@localhost:8984/*rest  *OR
> http://localhost:8984/
> *rest *
> I run basexserver from DOS Command Prompt
> *. *
> I am using a web browser to test as I have many times before with version
> 8.4
> I know the server is listening because it hangs and does not return, which
> does not occur when the server is stopped.
>
> On Wed, Aug 31, 2016 at 9:15 AM, Dirk Kirsten <d...@basex.org> wrote:
>
>> Hello,
>>
>> Windows 12? I am an long-time linux-only user, but isn't the most
>> current windows version 10 or am I missing the news completely?
>>
>> You will have to be much more specific. Please specify which BaseX
>> version you use, please post how you start the basexserver and the
>> console output and how you try to reach the REST endpoint. Also, I don't
>> know what you mean by you are not confusing TCP and REST port. This
>> statement doesn't really make sense, as REST uses TCP...
>>
>> Cheers
>>
>> Dirk
>>
>>
>> On 08/31/2016 02:09 PM, E. Wray Johnson wrote:
>> > Windows 12 server, running basexserver. Server is listening but hangs
>> and never returns anything. When server is killed behavior is different so
>> I can tell the server was listening on the REST port when running.  I am
>> not confusing the TCP port with REST port.
>>
>> --
>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
>> |   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
>> `-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22
>>
>>
>
>
> --
> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
> |   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
> `-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22
>
>


Re: [basex-talk] REST API not working

2016-08-31 Thread E. Wray Johnson
I apologize, by 12 I meant Windows Server 2012.
BaseX version is 8.5.3
By TCP vs REST I mean for REST I was using default port 8984 instead of the
default server TCP port 1984
For example: http://*admin*:*admin*@localhost:8984/*rest  *OR
http://localhost:8984/
*rest*
I run basexserver from DOS Command Prompt
*.*
I am using a web browser to test as I have many times before with version
8.4
I know the server is listening because it hangs and does not return, which
does not occur when the server is stopped.

On Wed, Aug 31, 2016 at 9:15 AM, Dirk Kirsten <d...@basex.org> wrote:

> Hello,
>
> Windows 12? I am an long-time linux-only user, but isn't the most
> current windows version 10 or am I missing the news completely?
>
> You will have to be much more specific. Please specify which BaseX
> version you use, please post how you start the basexserver and the
> console output and how you try to reach the REST endpoint. Also, I don't
> know what you mean by you are not confusing TCP and REST port. This
> statement doesn't really make sense, as REST uses TCP...
>
> Cheers
>
> Dirk
>
>
> On 08/31/2016 02:09 PM, E. Wray Johnson wrote:
> > Windows 12 server, running basexserver. Server is listening but hangs
> and never returns anything. When server is killed behavior is different so
> I can tell the server was listening on the REST port when running.  I am
> not confusing the TCP port with REST port.
>
> --
> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
> |   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
> `-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22
>
>


[basex-talk] REST API not working

2016-08-31 Thread E. Wray Johnson
Windows 12 server, running basexserver. Server is listening but hangs and never 
returns anything. When server is killed behavior is different so I can tell the 
server was listening on the REST port when running.  I am not confusing the TCP 
port with REST port.

Re: [basex-talk] Java client and binary files

2016-01-29 Thread E. Wray Johnson
Yes the code I modified is indeed [1]
java/org/basex/examples/api/BaseXClient.java
<https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/api/BaseXClient.java>

The following line was needed to handle the first byte of the query result.
 if (in.read() > 0)

I do like your "client.execute("xquery db:retrieve" suggestion better as it
does not require me to change the example client code.

However, what I really need is a way to do db:store and db:replace via
Xquery with an InputStream (e.g. without requiring the open/close commands).


On Fri, Jan 29, 2016 at 4:50 AM, Christian Grün <christian.gr...@gmail.com>
wrote:

> Please be more specific: Could you give me the exact reference to the
> class you have extended?
>
> If it’s [1], the following might work:
>
> public void execute(final OutputStream output) throws IOException {
>   out.write(4);
>   send(id);
>   receive(in, output);
>   if(!ok()) throw new IOException(receive());
> }
>
> Did you try to use the BaseXClient.execute method as well?
>
> BaseXClient client = new BaseXClient("localhost", 1984, "admin",
> "admin");
> try {
>   ByteArrayOutputStream os = new ByteArrayOutputStream();
>   client.execute("xquery db:retrieve('db', 'file.bin)", os);
>   final byte[] data = os.toByteArray();
>   System.out.println("Size of binary data: " + data.length);
> } finally {
>   client.close();
> }
>
>
> [1]
> https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/api/BaseXClient.java
>
>
> On Thu, Jan 28, 2016 at 4:57 PM, E. Wray Johnson <wray.john...@gmail.com>
> wrote:
> > So the problem was my fault as I suspected.  And I fixed it and I am now
> > getting the correct data.  I was attempting to retrieve a binary/raw
> > document using a Java client without the open/close which locks a
> database
> > by switching from using a retrieve command to db:retrieve XQuery.  I
> added
> > the following method to the client Query object.  It works fine, but let
> me
> > know if you see anything wrong with it.  I particular, is the if(!ok())
> > needed?  I suggest this as an enhancement.  Also, is it possible to
> achieve,
> > by enhancement, similar results using db:store in an XQuery from Java
> client
> > and an InputStream?
> >
> > public void execute(final OutputStream output) throws
> >IOException {
> > out.write(4);
> > send(id);
> > if (in.read() > 0) {
> > receive(in, output);
> > }
> > info = receive();
> > if (!ok()) {
> > throw new IOException(info);
> > }
> > }
> >
> >
> > On Thu, Jan 28, 2016 at 10:01 AM, Christian Grün <
> christian.gr...@gmail.com>
> > wrote:
> >>
> >> > I am getting the incorrect data downloaded as Mike Engledew said he
> used
> >> > the
> >> > "raw" output method to fix.  However, "raw" is not listed as one of
> the
> >> > valid types for this option.
> >> > So how should I ensure binary files get downloaded. accurately?
> >>
> >> Any SSCCE?
> >>
> >>
> >> > On Thu, Jan 28, 2016 at 3:08 AM, Christian Grün
> >> > <christian.gr...@gmail.com>
> >> > wrote:
> >> >>
> >> >> See here: http://docs.basex.org/wiki/Serialization
> >> >>
> >> >> Am 28.01.2016 7:13 vorm. schrieb "E. Wray Johnson"
> >> >> <wray.john...@gmail.com>:
> >> >>>
> >> >>> With 8.4...
> >> >>>
> >> >>> declare option output:method "raw";
> >> >>>
> >> >>> I get
> >> >>>
> >> >>> [SEPM0016] Value of 'method' must be one of
> >> >>> (xml,xhtml,html,json,csv,text,adaptive,basex).
> >> >>>
> >> >>> On Sat, Jan 16, 2016 at 2:06 PM, Mike Engledew
> >> >>> <mike.engle...@gmail.com>
> >> >>> wrote:
> >> >>>>
> >> >>>> If like me your using BaseX 8.3.1 don't forget to add ...
> >> >>>>
> >> >>>> declare option output:method "raw";
> >> >>>>
> >> >>>> before the db:retrieve()  otherwise you won't get b

Re: [basex-talk] Java client and binary files

2016-01-29 Thread E. Wray Johnson
Yes, I figured that.  I would have been nice if the ADD(09), REPLACE(0C),
STORE(0D) protocol commands would have accepted a database name as a first
parameter, like their corresponding Database Module functions.  This would
make it easier to work on multiple databases.

On Fri, Jan 29, 2016 at 10:00 AM, Christian Grün <christian.gr...@gmail.com>
wrote:

> > However, what I really need is a way to do db:store and db:replace via
> > Xquery with an InputStream (e.g. without requiring the open/close
> commands).
>
> That will be difficult, because data to be inserted may occur anywhere
> inside an XQuery expression..
>
> >
> >
> > On Fri, Jan 29, 2016 at 4:50 AM, Christian Grün <
> christian.gr...@gmail.com>
> > wrote:
> >>
> >> Please be more specific: Could you give me the exact reference to the
> >> class you have extended?
> >>
> >> If it’s [1], the following might work:
> >>
> >> public void execute(final OutputStream output) throws IOException {
> >>   out.write(4);
> >>   send(id);
> >>   receive(in, output);
> >>   if(!ok()) throw new IOException(receive());
> >> }
> >>
> >> Did you try to use the BaseXClient.execute method as well?
> >>
> >> BaseXClient client = new BaseXClient("localhost", 1984, "admin",
> >> "admin");
> >> try {
> >>   ByteArrayOutputStream os = new ByteArrayOutputStream();
> >>   client.execute("xquery db:retrieve('db', 'file.bin)", os);
> >>   final byte[] data = os.toByteArray();
> >>   System.out.println("Size of binary data: " + data.length);
> >> } finally {
> >>   client.close();
> >> }
> >>
> >>
> >> [1]
> >>
> https://github.com/BaseXdb/basex/blob/master/basex-examples/src/main/java/org/basex/examples/api/BaseXClient.java
> >>
> >>
> >> On Thu, Jan 28, 2016 at 4:57 PM, E. Wray Johnson <
> wray.john...@gmail.com>
> >> wrote:
> >> > So the problem was my fault as I suspected.  And I fixed it and I am
> now
> >> > getting the correct data.  I was attempting to retrieve a binary/raw
> >> > document using a Java client without the open/close which locks a
> >> > database
> >> > by switching from using a retrieve command to db:retrieve XQuery.  I
> >> > added
> >> > the following method to the client Query object.  It works fine, but
> let
> >> > me
> >> > know if you see anything wrong with it.  I particular, is the
> if(!ok())
> >> > needed?  I suggest this as an enhancement.  Also, is it possible to
> >> > achieve,
> >> > by enhancement, similar results using db:store in an XQuery from Java
> >> > client
> >> > and an InputStream?
> >> >
> >> > public void execute(final OutputStream output) throws
> >> >IOException {
> >> > out.write(4);
> >> > send(id);
> >> > if (in.read() > 0) {
> >> > receive(in, output);
> >> > }
> >> > info = receive();
> >> > if (!ok()) {
> >> > throw new IOException(info);
> >> >         }
> >> > }
> >> >
> >> >
> >> > On Thu, Jan 28, 2016 at 10:01 AM, Christian Grün
> >> > <christian.gr...@gmail.com>
> >> > wrote:
> >> >>
> >> >> > I am getting the incorrect data downloaded as Mike Engledew said he
> >> >> > used
> >> >> > the
> >> >> > "raw" output method to fix.  However, "raw" is not listed as one of
> >> >> > the
> >> >> > valid types for this option.
> >> >> > So how should I ensure binary files get downloaded. accurately?
> >> >>
> >> >> Any SSCCE?
> >> >>
> >> >>
> >> >> > On Thu, Jan 28, 2016 at 3:08 AM, Christian Grün
> >> >> > <christian.gr...@gmail.com>
> >> >> > wrote:
> >> >> >>
> >> >> >> See here: http://docs.basex.org/wiki/Serialization
> >> >> >>
> >> >> >> Am 28.01.2016 7:13 vorm. schrieb "E. Wray Johnson"
> >> >> >> <wray.john...@gmail.com

Re: [basex-talk] Java client and binary files

2016-01-28 Thread E. Wray Johnson
So the problem was my fault as I suspected.  And I fixed it and I am now
getting the correct data.  I was attempting to retrieve a binary/raw
document using a Java client without the open/close which locks a database
by switching from using a retrieve command to db:retrieve XQuery.  I added
the following method to the client Query object.  It works fine, but let me
know if you see anything wrong with it.  I particular, is the if(!ok())
needed?  I suggest this as an enhancement.  Also, is it possible to
achieve, by enhancement, similar results using db:store in an XQuery from
Java client and an InputStream?

public void execute(final OutputStream output) throws
   IOException {
out.write(4);
send(id);
if (in.read() > 0) {
receive(in, output);
}
info = receive();
if (!ok()) {
throw new IOException(info);
}
}


On Thu, Jan 28, 2016 at 10:01 AM, Christian Grün <christian.gr...@gmail.com>
wrote:

> > I am getting the incorrect data downloaded as Mike Engledew said he used
> the
> > "raw" output method to fix.  However, "raw" is not listed as one of the
> > valid types for this option.
> > So how should I ensure binary files get downloaded. accurately?
>
> Any SSCCE?
>
>
> > On Thu, Jan 28, 2016 at 3:08 AM, Christian Grün <
> christian.gr...@gmail.com>
> > wrote:
> >>
> >> See here: http://docs.basex.org/wiki/Serialization
> >>
> >> Am 28.01.2016 7:13 vorm. schrieb "E. Wray Johnson"
> >> <wray.john...@gmail.com>:
> >>>
> >>> With 8.4...
> >>>
> >>> declare option output:method "raw";
> >>>
> >>> I get
> >>>
> >>> [SEPM0016] Value of 'method' must be one of
> >>> (xml,xhtml,html,json,csv,text,adaptive,basex).
> >>>
> >>> On Sat, Jan 16, 2016 at 2:06 PM, Mike Engledew <
> mike.engle...@gmail.com>
> >>> wrote:
> >>>>
> >>>> If like me your using BaseX 8.3.1 don't forget to add ...
> >>>>
> >>>> declare option output:method "raw";
> >>>>
> >>>> before the db:retrieve()  otherwise you won't get back what you put
> in.
> >>>> I learned this the hard way trying to extract binary files that were
> >>>> stored in codepage IBM1047 and it took me a while to figure out why
> they
> >>>> came back translated;
> >>>>
> >>>>
> >>>> On Fri, Jan 15, 2016 at 11:11 AM, E. Wray Johnson
> >>>> <wray.john...@gmail.com> wrote:
> >>>>>
> >>>>> When using the sample Java client to store/retrieve binary/raw files
> I
> >>>>> have to execute separate open/close commands.  It is my
> understanding that
> >>>>> this locks the database.  In a multi-user scenario, such locking is
> >>>>> undesirable as binary/raw files can be quite large.  And since there
> is no
> >>>>> alteration of the indexes etc during such operations, is there a
> better way?
> >>>>> Also, why isn't there a corresponding retrieve method on the Java
> client,
> >>>>> similar to the store method?
> >>>>>
> >>>>> My code to store:
> >>>>> BaseXClient session = new BaseXClient(host, port, username,
> password);
> >>>>> session.execute("open " + database);
> >>>>> session.store(path, inputStream);
> >>>>> session.execute("close");
> >>>>>
> >>>>> My code to retrieve:
> >>>>> BaseXClient session = new BaseXClient(host, port, username,
> password);
> >>>>> session.execute("open " + database);
> >>>>> session.execute("retrieve " + path, outputStream);
> >>>>> session.execute("close");
> >>>>>
> >>>>> Thanks in advance!
> >>>>>
> >>>>>
> >>>>
> >>>
> >
>


On Thu, Jan 28, 2016 at 3:08 AM, Christian Grün <christian.gr...@gmail.com>
wrote:

> See here: http://docs.basex.org/wiki/Serialization
> Am 28.01.2016 7:13 vorm. schrieb "E. Wray Johnson" <wray.john...@gmail.com
> >:
>
>> With 8.4...
>>
>> declare option output:method "raw";
>>
>> I get
>>
>> [SEPM0016] Value of 'method' must be one of
>> (xml,xhtml,html,j

[basex-talk] Java client and binary files

2016-01-15 Thread E. Wray Johnson
When using the sample Java client to store/retrieve binary/raw files I have
to execute separate open/close commands.  It is my understanding that this
locks the database.  In a multi-user scenario, such locking is undesirable
as binary/raw files can be quite large.  And since there is no alteration
of the indexes etc during such operations, is there a better way? Also, why
isn't there a corresponding retrieve method on the Java client, similar to
the store method?

My code to store:
BaseXClient session = new BaseXClient(host, port, username, password);
session.execute("open " + database);
session.store(path, inputStream);
session.execute("close");

My code to retrieve:
BaseXClient session = new BaseXClient(host, port, username, password);
session.execute("open " + database);
session.execute("retrieve " + path, outputStream);
session.execute("close");

Thanks in advance!


[basex-talk] XML embedded in JSON

2016-01-12 Thread E. Wray Johnson
We have JSON that has string/text values which are XML.  Is there a
way o have the XML as sub-elements value and not be encoded/escaped
string?

Wray Johnson


[basex-talk] XML Commands

2016-01-12 Thread E. Wray Johnson
How do you execute XML commands from the BaseX GUI?
Why can't multiple XML commands be executed from the BaseXClient.java?
How can database options (e.g. autooptimize) be changed from the GUI
without opening the database and locking it?


[basex-talk] Mimicking RDBMS uniqueness constraints

2016-01-08 Thread E. Wray Johnson
What is the best practice in BaseX to implement a uniqueness
constraint similar to a RDBMS?  Given a database, a path to the
documents, an optional RegEx expression on files in the path, and one
or more XPaths to the constraint elements/attributes.  Can I create an
index of this nature?  Can the index not allow duplicates?


[basex-talk] Remote vs local performance

2016-01-06 Thread E. Wray Johnson
Using a Java client, we are seeing operations take much longer (e.g.
2x+) when BaseX is remote vs when local (on the same machine).  All
machines are virtual Windows.  Any ideas why?


[basex-talk] archive:extract:-binary can cause OutOfMemoryException

2016-01-02 Thread E. Wray Johnson
I have written an XQuery that properly extracts binary(raw) archive
resource contents to binary(raw) resources.  However since
archive:extract:-binary returns the contents as xs:base64Binary and not
streamable items, large archive contents are loaded completely into memory
and will often cause an OutOfMemoryException.  I have increased the BaseX
JVM heap size and the problem goes away, but this is not acceptable in a
system where many users may be doing this concurrently.  archive:extract-to
seems to only extract to an external file-system location and not to
binary(raw) resources.  Example code is provided below that extracts to the
same database folder as the archive, however the target location of the
contents is not pertinent to the problem.

let $database := 'db'
let $archivePath := 'myfolder/myarchive.zip'
let $archive  := db:retrieve($database, $archivePath)
let $basePath := replace($archivePath, '[^/]+$', '')
let $entries  := archive:entries($archive)
let $contents := archive:extract-binary($archive)
for $entry at $pos in $entries
let $content := $contents[$pos]
let $target := $basePath || '/' || $entry/text()
return db:store($database, $target, $content)


[basex-talk] Problem with 3rd party jars in repository

2015-12-15 Thread E. Wray Johnson
I have a 3rd party jar which is open source, which has no startup eligible
classes.
The classes I need to use have class names (not package name) that are all
lower case.  This seems to be a problem for BaseX.
So, I tried to create a wrapper class, and the wrapper class loads but
BaseX cannot load the dependent 3rd party jar no matter what I try.
I have even tried putting the jar in the basex\lib folder.
I have been able to install my wrapper class and run it successfully, but
when I include the 3rd party jar, I get "Module not initialized" for the
classes in the 3rd party jar because they are in another package.  I have
tried packaging everything into one jar, but that did not help.  I have
added a main class to the manifest of the 3rd party jar and it loaded fine
but I cannot include the namespace in my xquery.  My example is similar to
the FOP.jar example on the file server, however I do not see query ussage
example of this example.  I have not yet tried the  expath-pkg.xml route.


[basex-talk] Extracting binary stored zip into database as binary stored elements not working

2015-12-11 Thread E. Wray Johnson
My zip file has files nested in subfolders.
First I used db:store to store delta.zip into the database.
My first problem was I got an error "
*invalid entry CRC: expected 0x0 but got..."*
The raw stored file was slightly larger
*than the original zip.*
So I replaced the zip file in the raw folder with the original one and the
first error went away.
Now I don't get any error bu the extracted file are not stored as binaries

What is wrong with this code?
I removed the updating annotation and returned $target instead of the
try/store/catch inside the loop and got the expected result path name

let $database := 'db'
let $extractTo := 'target.zip'

(: path to raw stored zip  :)
let $archivePath := 'alpha/bravo/charlie/delta.zip'

let $archive  := db:retrieve($database, $archivePath)
let $basePath := replace($archivePath, '[^/]+$', '') || $extractTo
let $entries  := archive:entries($archive)
let $contents := archive:extract-binary($archive)
return for-each-pair($entries, $contents, %updating function($entry,
$content) {
  let $target := $basePath || '/' || $entry/text()
  return try {
  db:store($database, $target, $content)
} catch * {
  ()
}
})


Re: [basex-talk] Extracting binary stored zip into database as binary stored elements not working

2015-12-11 Thread E. Wray Johnson
This is happening in the call to db:store where the path is

'alpha/bravo/charlie/delta.zip/subfolder/subfile.ext'

The error is:

Stopped at ., 1/216:
>> >  [FODC0002] Resource 'delta.zip' does not exist.

Could it have something to do with a default archive parser for archives in
the Java Client ?



On Fri, Dec 11, 2015 at 10:10 AM, Christian Grün 
wrote:

> > In the meantime can you shed some light into the >  [FODC0002] Resource
> > 'delta.zip' does not exist.' error?
>
> (cc to the list): It simply says that a database resource does not exist.
>
> Maybe you have more than one BaseX database directory in your
> environment? Could you try db:list('...db...') and check what results
> are returned in the GUI and via the client?
>
>
> > On Fri, Dec 11, 2015 at 9:53 AM, Christian Grün <
> christian.gr...@gmail.com>
> > wrote:
> >>
> >> > The raw stored file was slightly larger than the original zip.
> >>
> >> Do you have an example for that?
> >>
> >> > But when I submit the exact same query using the Java client I get the
> >> > following error:
> >> >
> >> > Stopped at ., 1/216:
> >> >  [FODC0002] Resource 'delta.zip' does not exist.
> >>
> >> It shouldn’t make a difference. I’ll probably need more info to track
> this
> >> down.
> >
> >
>


Re: [basex-talk] Extracting binary stored zip into database as binary stored elements not working

2015-12-11 Thread E. Wray Johnson
Both problems fixed.  Here is how:

   - I had transposed the 2 parameters in my Java method call.
   - I unzipped and the re-zipped the defective archive using WIndows'
   built-in zip and it no longer generates the error.  My only guess is that
   it was created using some non-standard zip utility.


On Fri, Dec 11, 2015 at 2:05 PM, E. Wray Johnson <wray.john...@gmail.com>
wrote:

> Steps:
>
>1. Create or choose a database (e.g. named 'db')
>2. Store in BaseX a raw zip file (e.g.
>'alpha/bravo/charlie/delta.zip').  My zip file has files in folders.
>3. Choose a target name that also has a ".zip" extension to similar to
>'include name of archive in path' behavior.  Note, it should not be the
>same as the raw zip file stored (e.g. 'delta.zip')
>4. Run the following in the BaseX GUI client - it will work
>5. Repeat 1 and 2 using the BaseX Java Client example - it does not
>work
>
>
> GUI CLIENT - DOES WORK
> 
> let $database := 'db'
> let $extractTo := 'target.zip'
> let $archivePath := 'alpha/bravo/charlie/delta.zip'
>
> let $archive  := db:retrieve($database, $archivePath)
> let $basePath := replace($archivePath, '[^/]+$', '') || $extractTo
> let $entries  := archive:entries($archive)
> let $contents := archive:extract-binary($archive)
> return for-each-pair($entries, $contents, %updating function($entry,
> $content) {
>   let $target := $basePath || '/' || $entry/text()
>   return try {
>   db:store($database, $target, $content)
> } catch * {
>   ()
> }
> })
>
>
> JAVA - DOES NOT WORK:
> ===
> // Usage: Create a BaseXClient object and call this method.
> // For example:
> // ExplodeArchive("db", "target.zip", "alpha/bravo/charlie/delta.zip", ..)
>
> private static void ExplodeArchive(final String database, String
> extractTo, String archivePath, BaseXClient session) throws IOException {
> try {
> String queryString =
> "let $database := '" + database +"' " +
> "let $extractTo := '" + extractTo + "' " +
> "let $archivePath := '"+ archivePath + "' " +
> "let $archive  := db:retrieve($database, $archivePath)
> " +
> "let $basePath := replace($archivePath, '[^/]+$', '')
> || $extractTo " +
> "let $entries  := archive:entries($archive) " +
> "let $contents := archive:extract-binary($archive) " +
> "for $entry at $pos in $entries " +
> "let $content := $contents[$pos] " +
> "let $target := $basePath || '/' || $entry/text() " +
> "return db:store($database, "+ "$target, $content)";
> final BaseXClient.Query query = session.query(queryString);
> query.execute();
> } finally {
> session.close();
> }
> }
>
>
>
>
> On Fri, Dec 11, 2015 at 1:28 PM, Christian Grün <christian.gr...@gmail.com
> > wrote:
>
>> Could you please provide me with a minimized example that shows the
>> problem, and which I can run both in the GUI and via the Java client?
>>
>>
>> On Fri, Dec 11, 2015 at 6:24 PM, E. Wray Johnson <wray.john...@gmail.com>
>> wrote:
>> > What is the format for an absolute path for db:store?
>> > Neither of the following works:
>> >
>> > '/db/alpha/bravo/charlie/delta.zip/subfolder/subfile.ext'
>> > and '/'alpha/bravo/charlie/delta.zip/subfolder/subfile.ext'
>> >
>> > However my original code works in the BaseX GUI, just not through the
>> Java
>> > Client.
>> >
>> > Could it have something to the with the period or .zip in the middle of
>> the
>> > path?
>> >
>> >
>> >
>> > On Fri, Dec 11, 2015 at 11:11 AM, Christian Grün <
>> christian.gr...@gmail.com>
>> > wrote:
>> >>
>> >> > This is happening in the call to db:store where the path is
>> >> > 'alpha/bravo/charlie/delta.zip/subfolder/subfile.ext'
>> >>
>> >> Hm, so this is the relative path to the local resource you want to
>> >> store? Does it work if you specify the absolute path?
>> >>
>> >> > Could it have something to do with a default archive parser for
>> archives
>> >> > in
>> >

Re: [basex-talk] Extracting binary stored zip into database as binary stored elements not working

2015-12-11 Thread E. Wray Johnson
What is the format for an absolute path for db:store?
Neither of the following works:

   - '/db/alpha/bravo/charlie/delta.zip/subfolder/subfile.ext'
   - and '/'alpha/bravo/charlie/delta.zip/subfolder/subfile.ext'

However my original code works in the BaseX GUI, just not through the Java
Client.

Could it have something to the with the period or .zip in the middle of the
path?


On Fri, Dec 11, 2015 at 11:11 AM, Christian Grün 
wrote:

> > This is happening in the call to db:store where the path is
> > 'alpha/bravo/charlie/delta.zip/subfolder/subfile.ext'
>
> Hm, so this is the relative path to the local resource you want to
> store? Does it work if you specify the absolute path?
>
> > Could it have something to do with a default archive parser for archives
> in
> > the Java Client ?
>
> The Java client (if it’s the one I believe it is) is very dumb; it
> just passes on everything to the server.
>
>
> >
> >
> >
> > On Fri, Dec 11, 2015 at 10:10 AM, Christian Grün <
> christian.gr...@gmail.com>
> > wrote:
> >>
> >> > In the meantime can you shed some light into the >  [FODC0002]
> Resource
> >> > 'delta.zip' does not exist.' error?
> >>
> >> (cc to the list): It simply says that a database resource does not
> exist.
> >>
> >> Maybe you have more than one BaseX database directory in your
> >> environment? Could you try db:list('...db...') and check what results
> >> are returned in the GUI and via the client?
> >>
> >>
> >> > On Fri, Dec 11, 2015 at 9:53 AM, Christian Grün
> >> > 
> >> > wrote:
> >> >>
> >> >> > The raw stored file was slightly larger than the original zip.
> >> >>
> >> >> Do you have an example for that?
> >> >>
> >> >> > But when I submit the exact same query using the Java client I get
> >> >> > the
> >> >> > following error:
> >> >> >
> >> >> > Stopped at ., 1/216:
> >> >> >  [FODC0002] Resource 'delta.zip' does not exist.
> >> >>
> >> >> It shouldn’t make a difference. I’ll probably need more info to track
> >> >> this
> >> >> down.
> >> >
> >> >
> >
> >
>


Re: [basex-talk] Extracting binary stored zip into database as binary stored elements not working

2015-12-11 Thread E. Wray Johnson
Steps:

   1. Create or choose a database (e.g. named 'db')
   2. Store in BaseX a raw zip file (e.g.
   'alpha/bravo/charlie/delta.zip').  My zip file has files in folders.
   3. Choose a target name that also has a ".zip" extension to similar to
   'include name of archive in path' behavior.  Note, it should not be the
   same as the raw zip file stored (e.g. 'delta.zip')
   4. Run the following in the BaseX GUI client - it will work
   5. Repeat 1 and 2 using the BaseX Java Client example - it does not work


GUI CLIENT - DOES WORK

let $database := 'db'
let $extractTo := 'target.zip'
let $archivePath := 'alpha/bravo/charlie/delta.zip'

let $archive  := db:retrieve($database, $archivePath)
let $basePath := replace($archivePath, '[^/]+$', '') || $extractTo
let $entries  := archive:entries($archive)
let $contents := archive:extract-binary($archive)
return for-each-pair($entries, $contents, %updating function($entry,
$content) {
  let $target := $basePath || '/' || $entry/text()
  return try {
  db:store($database, $target, $content)
} catch * {
  ()
}
})


JAVA - DOES NOT WORK:
===
// Usage: Create a BaseXClient object and call this method.
// For example:
// ExplodeArchive("db", "target.zip", "alpha/bravo/charlie/delta.zip", ..)

private static void ExplodeArchive(final String database, String extractTo,
String archivePath, BaseXClient session) throws IOException {
try {
String queryString =
"let $database := '" + database +"' " +
"let $extractTo := '" + extractTo + "' " +
"let $archivePath := '"+ archivePath + "' " +
"let $archive  := db:retrieve($database, $archivePath)
" +
"let $basePath := replace($archivePath, '[^/]+$', '')
|| $extractTo " +
"let $entries  := archive:entries($archive) " +
"let $contents := archive:extract-binary($archive) " +
"for $entry at $pos in $entries " +
"let $content := $contents[$pos] " +
"let $target := $basePath || '/' || $entry/text() " +
"return db:store($database, "+ "$target, $content)";
final BaseXClient.Query query = session.query(queryString);
query.execute();
} finally {
session.close();
}
}




On Fri, Dec 11, 2015 at 1:28 PM, Christian Grün <christian.gr...@gmail.com>
wrote:

> Could you please provide me with a minimized example that shows the
> problem, and which I can run both in the GUI and via the Java client?
>
>
> On Fri, Dec 11, 2015 at 6:24 PM, E. Wray Johnson <wray.john...@gmail.com>
> wrote:
> > What is the format for an absolute path for db:store?
> > Neither of the following works:
> >
> > '/db/alpha/bravo/charlie/delta.zip/subfolder/subfile.ext'
> > and '/'alpha/bravo/charlie/delta.zip/subfolder/subfile.ext'
> >
> > However my original code works in the BaseX GUI, just not through the
> Java
> > Client.
> >
> > Could it have something to the with the period or .zip in the middle of
> the
> > path?
> >
> >
> >
> > On Fri, Dec 11, 2015 at 11:11 AM, Christian Grün <
> christian.gr...@gmail.com>
> > wrote:
> >>
> >> > This is happening in the call to db:store where the path is
> >> > 'alpha/bravo/charlie/delta.zip/subfolder/subfile.ext'
> >>
> >> Hm, so this is the relative path to the local resource you want to
> >> store? Does it work if you specify the absolute path?
> >>
> >> > Could it have something to do with a default archive parser for
> archives
> >> > in
> >> > the Java Client ?
> >>
> >> The Java client (if it’s the one I believe it is) is very dumb; it
> >> just passes on everything to the server.
> >>
> >>
> >> >
> >> >
> >> >
> >> > On Fri, Dec 11, 2015 at 10:10 AM, Christian Grün
> >> > <christian.gr...@gmail.com>
> >> > wrote:
> >> >>
> >> >> > In the meantime can you shed some light into the >  [FODC0002]
> >> >> > Resource
> >> >> > 'delta.zip' does not exist.' error?
> >> >>
> >> >> (cc to the list): It simply says that a database resource does not
> >> >> exist.
> >> >>
> >> >> Maybe you have more than one BaseX database directory in your
> >

[basex-talk] Concurrency model

2015-12-10 Thread E. Wray Johnson
What is the best way to manage multiple users in a multi-threaded
environment like servlets?


Re: [basex-talk] Broken Links on website

2015-12-07 Thread E. Wray Johnson
The first link works now.

Wray Johnson
(m) 704-293-9008

> On Dec 7, 2015, at 12:50 PM, "Christian Grün"  
> wrote:
>
> Hi E. Wray,
>
>> The broken links are:
>>
>> http://xqj.net/basex/
>> https://github.com/BaseXdb/basex-examples/tree/master/src/main/java/org/basex/examples/xqj
>
> I have fixed the second link. The first one works for me; could you
> please try again?
> Christian


[basex-talk] Broken Links on website

2015-12-05 Thread E. Wray Johnson
On: http://docs.basex.org/wiki/Java_Examples

Links in the following text seem to be broken:

XQJ API
>
> The implementation of the BaseX XQJ API 
> (closed-source) has been written by Charles Foster. It uses the
> client/server architecture. The basex-examples repository contains various
> examples
> 
> on how to use XQJ.
>
The broken links are:

   - http://xqj.net/basex/
   -
   
https://github.com/BaseXdb/basex-examples/tree/master/src/main/java/org/basex/examples/xqj


[basex-talk] Geo Module Not found

2015-11-27 Thread E. Wray Johnson
I am getting the following error:

[XQST0059] Module 'http://expath.org/ns/geo' not found.

I used the Windows exe setup.

What am I missing?


Re: [basex-talk] Cant add raw files explicitly or text index ms office docs

2015-11-26 Thread E. Wray Johnson
Thanks!  Today is our Thanksgiving holiday so I am not working today.
I will look at this soon.

Consider a file filter that uses regular expression(s).

Wray Johnson
(m) 704-293-9008

> On Nov 26, 2015, at 11:43 AM, "Christian Grün" <christian.gr...@gmail.com> 
> wrote:
>
> Hi E. Wray,
>
> I have attached a little example for some XQuery code, which adds
> files, archives and archive contents to a database. It’s probably not
> the most efficient solution, so feel free to enhance it or ask more
> questions.
>
> I agree that your use case is an enticing one: We also use BaseX to
> process office files, and Rositsa Shadura wrote an interesting thesis
> on that topic [1]. As Dirk pointed out, it turned out that we didn’t
> want to choose one particular solution, and the XQuery approach is
> currently the most flexible one.
>
> Hope this helps,
> Christian
>
> [1] http://basex.org/about-us/publications
> ___
>
>> On Wed, Nov 25, 2015 at 5:43 PM, Dirk Kirsten <d...@basex.org> wrote:
>> Hello,
>>
>> which problems did you encounter? This problem should be solvable using a
>> small XQuery, basically putting what you describe in natural languages in
>> XQuery so our processor understands it.
>>
>> I don't think it would make any sense to add such a specific format. There
>> are simply way to many possible combinations - You want archive files
>> extracted, others might want not to do this. In the end we would end up with
>> a very complex definition language - And what's the point if we already have
>> a standardized query language like XQuery, which can achieve the same thing?
>>
>> Cheers
>> Dirk
>>
>> On 11/25/2015 05:38 PM, E. Wray Johnson wrote:
>>
>> Here is what I want to do: For a given folder and all its subfolders on my
>> physical dive, mirror its contents including the contents of archives,
>> parsing xml, json,html, text, etc. using their respective parser skipping
>> invalids, and adding all other files as raw. I want archive files (*.zip,
>> *.doxc) to be added as raw, however I want the text inside archive files
>> like docx (ms-word) to be indexed and any files in the archives files that
>> match a filter to be indexed.
>>
>> Note: It would be nice if there was a single db:add method that allowed me
>> to specify a map of filters to parsers with options, where all files that do
>> not match a filter (or are invalid) will be optionally added as raw.
> 


[basex-talk] Cant add raw files explicitly or text index ms office docs

2015-11-25 Thread E. Wray Johnson
Here is what I want to do: For a given folder and all its subfolders on my
physical dive, mirror its contents including the contents of archives,
parsing xml, json,html, text, etc. using their respective parser skipping
invalids, and adding all other files as raw. I want archive files (*.zip,
*.doxc) to be added as raw, however I want the text inside archive files
like docx (ms-word) to be indexed and any files in the archives files that
match a filter to be indexed.

Note: It would be nice if there was a single db:add method that allowed me
to specify a map of filters to parsers with options, where all files that
do not match a filter (or are invalid) will be optionally added as raw.