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.  limit in xquery

    Posted Wed March 17, 2004 02:19 PM

    Hi

    I need to implement an XQuery which will return a subset of the whole data. in sql it would look like:

    select * from table LIMIT 5;

    how can this be done via XQuery (or the Java API)?

    Cheers
    Brian


    #webMethods-Tamino-XML-Server-APIs
    #webMethods
    #API-Management


  • 2.  RE: limit in xquery

    Posted Thu March 25, 2004 02:18 PM

    Hello Brian,
    I do not know the LIMIT expression.
    Maybe you mean not getting the complete
    result sequence of a query but only a defined
    number of items. This can be achieved by a cursor. In the Java API this is done
    by an XQuery method with an additional
    parameter:

    TResponse xquery(TXQuery xquery,int quantity)


    or by appending the following filter to a query

    (for $i in input()/ADoctype
    return $i
    )
    [position() > 10 and position() < 20 ]

    Is that what you mean?

    Walter


    #webMethods
    #webMethods-Tamino-XML-Server-APIs
    #API-Management


  • 3.  RE: limit in xquery

    Posted Fri March 26, 2004 01:52 PM

    Hi Walter

    Thanks for the info. That seems to help a lot. I am facing a further problem now when trying to sort the data. I am trying to run the following query, but tamino seems to crash when trying to run it. what is the prob?

    declare namespace tf=“http://namespaces.softwareag.com/tamino/TaminoFunction

    {
    (
    for $l in input()/schedule/locality/locality_name
    where $l/…/…/island = ‘island’
    and (
    tf:containsText($l, “")
    or tf:containsText($l, "
    ”)
    or tf:containsText($l, tf:phonetic(“k”))
    )

    return

    {$l/text()}
    { $l/…/pre/name }

    sort by (locality)
    ) [position() >= 1 and position() < 11 ]
    }


    #webMethods
    #webMethods-Tamino-XML-Server-APIs
    #API-Management