unary association

Help
Hao
2011-04-17
2013-04-29
  • Hao
    Hao
    2011-04-17

    hey any one knows how to define a unary association in USE?

     
  • Lars Hamann
    Lars Hamann
    2011-04-26

    Hi,

    you can create a reflexive / unary association just like other associations,
    except that you must define role names, e. g.,

    model sample
    class A
    end
    association AA between
      A[*] role a1
      A[*] role a2
    end
    

    Regards!
    Lars

     
  • Lars Hamann
    Lars Hamann
    2011-04-26

    model sample
    class A 
    end 
    association AA between
     A\[\*\] role a1
     A\[\*\] role a2 
    end
    
     
  • Lars Hamann
    Lars Hamann
    2011-04-26

    Please ignore the backslashes in my previous post.
    I really have to figure out how BBCode is working at sourceforge ;-)

    A preview function would be very helpful.

     
  • Hao
    Hao
    2011-04-26

    That  works…but what about I want to have a directed association from one class to another class?

     
  • Lars Hamann
    Lars Hamann
    2011-04-27

    USE doesn't support directed associations because OCL allows to ignore the navigability.

    When I have an issue like duplicate role names, e. g., when modeling the UML meta model, I use a role name like "notNavigableX_className". X is a counter if needed.