rest run query binding problem
Hello, given the query file [1] called by http://localhost:8984/rest?run=argon/create-database.xq&DB=test-db&CHOP=no&F... I get the error: Stopped at ., 3/18: [XPDY0002] No value assigned to $CHOP. When I change the value, e.g. to nono I get Invalid 'CHOP' value 'nono'; must be 'yes', 'no', or a boolean. Running on basex 9.1 [1] create-database.xq (:~ New database name. :) declare variable $DB as xs:string external; declare variable $CHOP as xs:string external; declare variable $FTINDEX as xs:string external; declare variable $TEXTINDEX as xs:string external; declare variable $ATTRINDEX as xs:string external; declare variable $TOKENINDEX as xs:string external; let $exists := db:exists($DB) let $meta := concat('~meta_', $DB) let $history := concat('~history_', $DB) return if(not($exists)) then ( db:create($meta), db:create($history), db:create($DB, (), (), map { 'chop' : $CHOP , 'ftindex' : $FTINDEX , 'textindex' : $TEXTINDEX , 'attrindex' : $ATTRINDEX , 'tokenindex' : $TOKENINDEX }) ) else ()
Hi Max, I guess this is because CHOP is also a valid serialization parameter [1], so it won’t be assigned as variable anymore. Does it work if you rename it to something like S-CHOP? Cheers, Christian [1] http://docs.basex.org/wiki/REST#Parameters On Tue, Nov 6, 2018 at 3:04 PM Maximilian Gärber <mgaerber@arcor.de> wrote:
Hello,
given the query file [1] called by
http://localhost:8984/rest?run=argon/create-database.xq&DB=test-db&CHOP=no&F...
I get the error:
Stopped at ., 3/18: [XPDY0002] No value assigned to $CHOP.
When I change the value, e.g. to nono I get
Invalid 'CHOP' value 'nono'; must be 'yes', 'no', or a boolean.
Running on basex 9.1
[1] create-database.xq
(:~ New database name. :) declare variable $DB as xs:string external; declare variable $CHOP as xs:string external; declare variable $FTINDEX as xs:string external; declare variable $TEXTINDEX as xs:string external; declare variable $ATTRINDEX as xs:string external; declare variable $TOKENINDEX as xs:string external;
let $exists := db:exists($DB) let $meta := concat('~meta_', $DB) let $history := concat('~history_', $DB)
return if(not($exists)) then ( db:create($meta), db:create($history), db:create($DB, (), (), map { 'chop' : $CHOP , 'ftindex' : $FTINDEX , 'textindex' : $TEXTINDEX , 'attrindex' : $ATTRINDEX , 'tokenindex' : $TOKENINDEX }) ) else ()
Yes, you are correct. Same also applies to the index parameters... Thank you. Am Di., 6. Nov. 2018 um 15:48 Uhr schrieb Christian Grün <christian.gruen@gmail.com>:
Hi Max,
I guess this is because CHOP is also a valid serialization parameter [1], so it won’t be assigned as variable anymore. Does it work if you rename it to something like S-CHOP?
Cheers, Christian
[1] http://docs.basex.org/wiki/REST#Parameters
On Tue, Nov 6, 2018 at 3:04 PM Maximilian Gärber <mgaerber@arcor.de> wrote:
Hello,
given the query file [1] called by
http://localhost:8984/rest?run=argon/create-database.xq&DB=test-db&CHOP=no&F...
I get the error:
Stopped at ., 3/18: [XPDY0002] No value assigned to $CHOP.
When I change the value, e.g. to nono I get
Invalid 'CHOP' value 'nono'; must be 'yes', 'no', or a boolean.
Running on basex 9.1
[1] create-database.xq
(:~ New database name. :) declare variable $DB as xs:string external; declare variable $CHOP as xs:string external; declare variable $FTINDEX as xs:string external; declare variable $TEXTINDEX as xs:string external; declare variable $ATTRINDEX as xs:string external; declare variable $TOKENINDEX as xs:string external;
let $exists := db:exists($DB) let $meta := concat('~meta_', $DB) let $history := concat('~history_', $DB)
return if(not($exists)) then ( db:create($meta), db:create($history), db:create($DB, (), (), map { 'chop' : $CHOP , 'ftindex' : $FTINDEX , 'textindex' : $TEXTINDEX , 'attrindex' : $ATTRINDEX , 'tokenindex' : $TOKENINDEX }) ) else ()
participants (2)
-
Christian Grün -
Maximilian Gärber