Ticket #108 (closed defect: fixed)

Opened 2 months ago

Last modified 2 months ago

association navigability code seems to be out of sync with UML 2.1.2

Reported by: wrobe..@pld-linux.org Assigned to: wrobe..@pld-linux.org
Priority: blocker Milestone: Gaphor 0.13.0
Component: Gaphor Version:
Keywords: Cc: arjan@yirdis.nl

Description

create two use cases and association between them. try to change navigability of one of the ends

Traceback (most recent call last):
  File "/home/wrobell/opt/share/python2.5/site-packages/gaphor-0.13.0.dev_r2226-py2.5.egg/gaphor/transaction.py", line 13, in _transactional
    func(*args, **kwargs)
  File "/home/wrobell/opt/share/python2.5/site-packages/gaphor-0.13.0.dev_r2226-py2.5.egg/gaphor/adapters/propertypages.py", line 1060, in _on_navigability_change
    end.navigability = (None, False, True)[combo.get_active()]
  File "/home/wrobell/opt/share/python2.5/site-packages/gaphor-0.13.0.dev_r2226-py2.5.egg/gaphor/diagram/association.py", line 437, in _set_navigability
    assert 0, 'Should never be reached'
AssertionError: Should never be reached
Traceback (most recent call last):
  File "/home/wrobell/opt/share/python2.5/site-packages/gaphor-0.13.0.dev_r2226-py2.5.egg/gaphor/transaction.py", line 13, in _transactional
    func(*args, **kwargs)
  File "/home/wrobell/opt/share/python2.5/site-packages/gaphor-0.13.0.dev_r2226-py2.5.egg/gaphor/adapters/propertypages.py", line 1060, in _on_navigability_change
    end.navigability = (None, False, True)[combo.get_active()]
  File "/home/wrobell/opt/share/python2.5/site-packages/gaphor-0.13.0.dev_r2226-py2.5.egg/gaphor/diagram/association.py", line 437, in _set_navigability
    assert 0, 'Should never be reached'
AssertionError: Should never be reached

Attachments

Change History

03/05/08 08:54:35 changed by wrobe..@pld-linux.org

  • owner changed from arj..@yirdis.nl to wrobe..@pld-linux.org.

03/06/08 00:28:59 changed by arj..@yirdis.nl

Problem is in source:gaphor/trunk/gaphor/diagram/classes/association.py just before line 437:

            # if navigable
            if isinstance(opposite.type, UML.Class):
                if subject.class_:
                    del subject.class_
            elif isinstance(opposite.type, UML.Interface):
                if subject.interface_:
                    del subject.interface_
            else:
                assert 0, 'Should never be reached'

No case for the Use Case :).

03/06/08 01:16:04 changed by wrobe..@pld-linux.org

  • status changed from new to assigned.

UseCase? is a classifier, therefore UseCase?.classifier attribute should be deleted/set.

but Property.interface_ and Property.class_ override Property.classifier, isn't it?

we probably just should set Property.classifier and get rid of above conditionals, then Property.{class_,interface_} will be set automatically, isn't it?

03/06/08 11:55:24 changed by wrobe..@pld-linux.org

  • cc set to arj..@yirdis.nl.

should navigability of an association end be possible to change in case of just classifier?

03/06/08 12:40:25 changed by wrobe..@pld-linux.org

  • summary changed from association navigability does not work to association navigability code seems to be out of sync with UML 2.1.2.
  • milestone set to Gaphor 0.13.0.

few notes

  • uml2.gaphor misses Association.navigableOwnedEnd in classes diagram
  • uml2.gaphor interface diagram, there is Property.interface_ diagram, it is not defined in UML specification (UML 2.1.2, page 38)
  • Property misses Property::isNavigable() : Boolean query (UML 2.1.2, page 126)

answering my last question, Property::isNavigable checks if classifier is empty, so it seems that it should be possible to change navigability of a an association end in case of any classifier, but

  • how to change navigability in case of UseCase?? setting a Property.classifier gives us
      File "./gaphor/UML/properties.py", line 56, in __set__
        self._set(obj, value)
      File "./gaphor/UML/properties.py", line 504, in _set
        raise AttributeError, 'Can not set values on a union'
    AttributeError: Can not set values on a union
    
  • how to change navigability in case of Interface as there should be no Property.interface_ attribute?

(follow-up: ↓ 8 ) 03/10/08 00:27:46 changed by arj..@yirdis.nl

I noticed some other things that have changed since UML 2.0 and 2.1.2 (e.g. Implementation is renamed to InterfaceRealization).

Property.interface_ should be known as Property.interface in the UML model (or have they changed that one too?).

We should probably do some updating of the model. But it may be best to save that for 0.14.0. I've created a ticket (#109) for that purpose.

Property.classifier is defined as derived union. From gaphor/UML/uml2.py:

Property.classifier = derivedunion('classifier', 0, 1, Property.useCase, Property.actor, Property.interface_, Property.datatype, Property.class_)

03/10/08 05:19:25 changed by wrobe..@pld-linux.org

Property.interface (Property.inteface_) does not exist in UML anymore it seems (page 38, Interfaces diagram).

I would like to fix classifiers' associations before for gaphor 0.13.0.

(in reply to: ↑ 6 ; follow-up: ↓ 9 ) 03/10/08 09:19:24 changed by wrobe..@pld-linux.org

Replying to arj..@yirdis.nl: ...

Property.classifier is defined as derived union. From gaphor/UML/uml2.py: {{{ Property.classifier = derivedunion('classifier', 0, 1, Property.useCase, Property.actor, Property.interface_, Property.datatype, Property.class_) }}}

I cannot spot any of Property.{actor,interface_,useCase} attributes to be defined in UML specification. Property.{class_,datatype} are still there.

(in reply to: ↑ 8 ; follow-up: ↓ 10 ) 03/11/08 00:37:50 changed by arj..@yirdis.nl

Replying to wrobe..@pld-linux.org:

I cannot spot any of Property.{actor,interface_,useCase} attributes to be defined in UML specification. Property.{class_,datatype} are still there.

They're probably 2.0 stuff, removed in 2.1 or something. They're in the the model anyway:

Property.useCase = association('useCase', UseCase, upper=1, opposite='ownedAttribute')
Property.interface_ = association('interface_', Interface, upper=1, opposite='ownedAttribute')
Property.actor = association('actor', Actor, upper=1, opposite='ownedAttribute')
Actor.ownedAttribute = association('ownedAttribute', Property, composite=True, opposite='actor')

I think it's best to stick to the current model as is and update it for the next release (this will have some serious impact, most notably in the storage module).

... so much for a "standard" ;(

(in reply to: ↑ 9 ) 03/11/08 04:57:35 changed by wrobe..@pld-linux.org

Replying to arj..@yirdis.nl:

Replying to wrobe..@pld-linux.org:

I cannot spot any of Property.{actor,interface_,useCase} attributes to be defined in UML specification. Property.{class_,datatype} are still there.

They're probably 2.0 stuff, removed in 2.1 or something. They're in the the model anyway: {{{ Property.useCase = association('useCase', UseCase?, upper=1, opposite='ownedAttribute') Property.interface_ = association('interface_', Interface, upper=1, opposite='ownedAttribute') Property.actor = association('actor', Actor, upper=1, opposite='ownedAttribute') Actor.ownedAttribute = association('ownedAttribute', Property, composite=True, opposite='actor') }}} I think it's best to stick to the current model as is and update it for the next release (this will have some serious impact, most notably in the storage module). ... so much for a "standard" ;(

well, everything is fluid :) probably we should use Association.navigableOwnedEnd, now. but i will use Property.{actor,useCase} to fix this bug.

03/16/08 15:07:06 changed by wrobe..@pld-linux.org

  • status changed from assigned to closed.
  • resolution set to fixed.

fixed in changesets [2270] and [2271]


Add/Change #108 (association navigability code seems to be out of sync with UML 2.1.2)




Action