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.  No duplicate elements

    Posted Thu May 05, 2005 06:46 PM

    Is there a way to define in TSD4 that a element with a specific attribute may only occur once ?
    I assume there is, but I can’t find it.

    Example:
    Allowed - lexon id attributes are different

    <context id="115" label="SmallXchangeStoryA1">
    <lexon id="1366" term1="Service" role1="ByMeansOf" role2="" term2="WebSite" />
    <lexon id="1395" term1="BusnessInstitution" role1="Have" role2="" term2="Headquarter" />
    </context>

    Not allowed - lexon id attributes are equal

    <context id="115" label="SmallXchangeStoryA1">
    <lexon id="1366" term1="Service" role1="ByMeansOf" role2="" term2="WebSite" />
    <lexon id="1366" term1="StockExchange" role1="SubtypeOf" role2="SupertypeOf" term2="Service" />
    </context>

    Thanks !


    #API-Management
    #Tamino
    #webMethods


  • 2.  RE: No duplicate elements

    Posted Fri May 06, 2005 01:23 PM

    Hi,
    From TSD4.2 (Tamino Version 4.2) there is the logical schema property “tsd:unique”. You can specify, at the doctype level, which elements/attributes must be unique per xml instance. You can set the tsd:unique property in the Schema Editor by selecting the doctype node and clicking “Insert, TSD Unique”. You must then set the field XPaths of the elements/attributes that comprise the unique “key”.
    There’s more in the documentation under Tamino XML Schema Reference Guide/Tamino Extensions…/tsd:unique.
    HTH


    #webMethods
    #Tamino
    #API-Management


  • 3.  RE: No duplicate elements

    Posted Fri May 06, 2005 01:56 PM

    Thanks for the quick reply !

    Aaah, I’m testing it with the XML StarterKit (=Tamino 4.1.4.1). That’s why i couldn’t find it.

    Well that brings me to another problem. Because now i’ll have to check the id attributes myself.

    I would like to get the highest id attribute from a lexon.
    I’ve tried the max() function as well in XQuery as in X-Query but I always the a NaN result. The count() function, however, does return a valid result.

    max(//lexon[@id])

    I also think I know why that is:
    count() requires a node sequence
    while
    max() requires a sequence of items

    So now is my question:
    How could i retrieve the highest lexon id value (as example shown in my previous post) ?


    #API-Management
    #Tamino
    #webMethods


  • 4.  RE: No duplicate elements

    Posted Fri May 06, 2005 02:14 PM

    Hi Paul

    Bill’s proposal is unfortunately only partly correct as tsd:unique
    (which is supported since Tamino 4.2)

    1. is a constraint across all documents in a doctype
    2. allows only for cardinality 1 of referenced nodes

    In XSD, the identity constraints (xsd:unique, xsd:key) will allow for the constraint you need applying to multiple occurences of a logical node within a single document.
    Unfortunately, this is not yet supported by Tamino 4.2, but - at least some good news - Tamino 4.4 will support that feature!

    Best regards
    Uli


    #Tamino
    #API-Management
    #webMethods


  • 5.  RE: No duplicate elements

    Posted Fri May 06, 2005 02:21 PM

    Sorry I missed that - thanks Uli.
    Bill.


    #webMethods
    #API-Management
    #Tamino


  • 6.  RE: No duplicate elements

    Posted Fri May 06, 2005 02:30 PM

    With regard to the max() problem, try max(context/lexon/@id).
    That should work.


    #webMethods
    #API-Management
    #Tamino


  • 7.  RE: No duplicate elements

    Posted Fri May 06, 2005 03:11 PM

    Thanks !! That works indeed !


    #API-Management
    #Tamino
    #webMethods