rest run query binding problem

Tuesday, 6 November 2018 · 3 messages
MG
Maximilian Gärber6 Nov 2018 15:04 #
Hello, given the query file [1] called by http://localhost:8984/rest?run=argon/create-database.xq&DB=test-db&CHOP=no&FTINDEX=no&TEXTINDEX=yes&ATTRINDEX=yes&TOKENINDEX=no 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 ()
CG
Christian Grün6 Nov 2018 15:48 #
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
Quoted text · Maximilian Gärber · 43 lines
On Tue, Nov 6, 2018 at 3:04 PM Maximilian Gärber <mgaerber at 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&FTINDEX=no&TEXTINDEX=yes&ATTRINDEX=yes&TOKENINDEX=no > > 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 ()
MG
Maximilian Gärber6 Nov 2018 16:17 #
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 at gmail.com>:
Quoted text · Christian Grün · 58 lines
> > 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 at 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&FTINDEX=no&TEXTINDEX=yes&ATTRINDEX=yes&TOKENINDEX=no > > > > 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 ()

⚡Generated with XQuery