IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  counting FLWR results

    Posted Mon August 09, 2004 11:43 PM

    I had hoped to do something like:

    count(for $scene in document(“/db/myplay.xml”)/PLAY/ACT/SCENE
    where $scene/SPEECH[SPEAKER=“ONEGUY”] and $scene/SPEECH[SPEAKER=“OTHERGUY”]
    return 0)
    unfortunately though, when there are no results meeting the where clause the statement being counted returns false… which count() evaluates as 1 (counter intuitive I think)

    Any ideas on a way to rewrite this to give the ‘correct’ response of 0 when there are no shared scenes? I’ve been racking my brain for a day now.


    Thanks!

    Kevin
    kevin.is-a-geek.net


    #Tamino
    #API-Management
    #webMethods


  • 2.  RE: counting FLWR results

    Posted Tue August 10, 2004 04:05 PM

    Hi Kevin,

    unfortunately you do not tell us which XQuery implementation you use.
    I tried to reproduce this using Tamino 4.2 and everything seems fine,
    i.e. a FLWR that returns nothing contains zero results, and thus
    count(FLWR) is zero. count() however yields a static type error since
    count is supposed to have one argument. What tool are you using ?

    Regards,
    Juliane.


    #Tamino
    #API-Management
    #webMethods


  • 3.  RE: counting FLWR results

    Posted Tue August 10, 2004 05:39 PM

    Should implementation matter? surely this behavior would be in the spec…

    I’m using eXist 1.0

    I got around this by changing it up to:

    count(for $scene in document(“/db/myplay.xml”)/PLAY/ACT/SCENE/[SPEECH/SPEAKER=“ONEGUY”]
    where $scene/SPEECH[SPEAKER=“OTHERGUY”]
    return 0)

    The statements look equivalent to me but this one works… ideas why?

    Kevin


    #Tamino
    #webMethods
    #API-Management


  • 4.  RE: counting FLWR results

    Posted Wed August 25, 2004 11:32 AM

    Hi Kevin,

    yes the second query is equivalent except that the / preceding the [
    is wrong, I guess it is just a spelling mistake. I don’t know much
    about eXist but perhaps it does some optimization w.r.t. where
    clauses that is slightly buggy. These things happen. Your question
    might be interesting for the eXist guys.

    Regards, Juliane.

    PS: Of course, implementation matters. If you tried this one with
    Tamino, we should do something about it.


    #API-Management
    #webMethods
    #Tamino