Ticket #92 (closed defect: fixed)

Opened 11 months ago

Last modified 11 months ago

Gaphor saves file which is not loadable

Reported by: TikiT..@gmail.com Assigned to: arj..@yirdis.nl
Priority: major Milestone: Gaphor 0.13.0
Component: Gaphor Version:
Keywords: Cc:

Description

There is a use case when importing python code and saving the resulting diagram which results in an unreadable file. The version of the program is reported as 0.13.0.

Details:

  1. Imported an 18 file python project (~1600 loc, ~25 classes) via import option
  2. Saved resulting diagram
  3. Restarted gaphor
  4. Resulting error text looks as follows:
2008-01-15 07:45:06,768 ERROR Invalid ID for reference (DCE:530420CA-C1C3-11DC-B62A-00173188FB55) for element Property.presentation
2008-01-15 07:45:06,768 ERROR Invalid ID for reference (DCE:5350E6E4-C1C3-11DC-B62A-00173188FB55) for element Property.presentation
2008-01-15 07:45:06,769 ERROR Invalid ID for reference (DCE:5350E8F6-C1C3-11DC-B62A-00173188FB55) for element Property.presentation
...around 100 lines of this...

Reproducing:

I can't reproduce the error with a smaller set of files. When I have some time I'll sit down and figure out exactly what is causing it in the larger set, then post the example files.

Workaround:

pathch for: gaphor/storage/storage.py:

247c247,249
<                         raise ValueError, 'Invalid ID for reference (%s) for element %s.%s' % (refid, elem.type, name)
---
>                         ref = None
>                         log.error('Invalid ID for reference (%s) for element %s.%s' % (refid, elem.type, name))
>                         #raise ValueError, 'Invalid ID for reference (%s) for element %s.%s' % (refid, elem.type, name)

Possible Fixes:

During save check that references being written actually exist.

Attachments

err.tar.gz (1.4 kB) - added by TikiT..@gmail.com on 01/15/08 18:43:19.
Files to import to reproduce error

Change History

01/15/08 05:20:28 changed by arj..@yirdis.nl

Could you post the file that is causing the code to complain?

It is indeed possible that there is a bug in the import functionality that makes that not all elements are properly added to the ElementFactory? (the container which holds the whole model.

01/15/08 18:43:19 changed by TikiT..@gmail.com

  • attachment err.tar.gz added.

Files to import to reproduce error

01/15/08 18:46:34 changed by anonymous

To reproduce the error:

  1. Import both of the above files in a fresh run of gaphor
  2. Save the resulting diagram
  3. Open the diagram

01/15/08 23:42:16 changed by arj..@yirdis.nl

(In [2178]) Cleanup of pynsource (import) module. see #92.

01/16/08 00:13:08 changed by arj..@yirdis.nl

  • status changed from new to assigned.
  • summary changed from Graphor saves file which is not loadable to Gaphor saves file which is not loadable.
  • milestone set to Gaphor 0.13.0.

So, you're working with the trunk/ branch. I can not reproduce this error in the latest released version (0.12.4).

The problem is in the association.

The property is referenced by an AssociationEnd (diagram item) class, but this AssociationEnd is not saved in the file (This is correct).

The problem is somewhat more common and not (directly) related to the import module.

Although the construction of associations in the import module needed some cleanup (see [2178]).

The problem occurs when you construct an association like this:

 +------+        +------+
 |  C1  |&l;..@>---->|  C2  |
 +------+     foo+------+

Both !Properties that make up the ends of the association refer to presentation elements that have not been saved (which is correct). They should not have a presentation element at all.

Along the line, something changed...

01/16/08 00:20:12 changed by arj..@yirdis.nl

In the trunk version, AssociationEnd is inheriting from UML.Presentation. The 0.12 code uses SubjectSupport as base class.

01/16/08 00:40:29 changed by arj..@yirdis.nl

Ahh.. the old AssociationEnd implementation has it's own subject property, which overrules the bi-directional subject-presentation implementation.

This can be solved in two ways:

  • hack a custom subject implementation for AssociationEnd. This may be necessary for other helper classes (AssociationEnd is a helper class for Association).
  • introduce a __transient__ class level property, that tells the storage engine to ignore this object all together.

01/16/08 00:47:46 changed by arj..@yirdis.nl

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

(In [2179]) Make AssociationEnd transient by explicitly setting _id to None. Fixes #92.


Add/Change #92 (Gaphor saves file which is not loadable)




Action