Book a Demo

Author Topic: how do model files?  (Read 6588 times)

Jüri

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
how do model files?
« on: April 23, 2008, 11:34:11 pm »
Does anybody have suggestion how do model files what will be used for transferring information between different companies?

The realization is not clear, will it be XML (then I could model XSD) or some txt file.
But I want that my model includes file spec (attributes, mandatory parts etc) as well.

One example:
We will have batch program what imports file and parser it to DB. That I could model by specifying operation. Now how to model input parameter when I want to specify following requirements:

File header with attributes (only one is allowed)
Sub-section header (there can be 1..* inside one file)
      Sub-section body (there can be 1..* inside one sub-section)
File footer with attributes (only one File Footer is allowed)
I also want to specify, which attributes are mandatory and what is the length of the text field etc.

Can it be done using UML at all? :-/

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: how do model files?
« Reply #1 on: April 24, 2008, 01:31:51 am »
Why not a stereotyped set of components, which are used as the data types of attributes of a stereotyped «document» class?
No, you can't have it!

Torsten Binias

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: how do model files?
« Reply #2 on: April 24, 2008, 01:33:58 am »
Hello Jüri,

I'm not sure if I understand your problem.

Why do you want to impose constraints on the physical structure of the file? As you say the realization is not yet clear. Maybe the technical realization does not need a footer.

If you just want to specify the contents of the file you can use Classes and Aggregations. But you cannot specify the order in which the attributes and associated classes will appear in your file.

If you really need to specify the parts of the technical structure and their ordering you can use XSD or BNF in my opinion.

HTH,
Torsten

Jüri

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: how do model files?
« Reply #3 on: April 24, 2008, 03:03:18 pm »
Thank you Torsten!

OK, let's forget footers for a while:)

I used classes and aggregations but I got into a problem when I wanted to visualize, that we have some program what takes this file. How I could visualize this part? if it is only one class, then no problem (I create operation and input parameter uses that class) but if it is a set of classes then... :-/

thank you!

Jüri

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: how do model files?
« Reply #4 on: April 24, 2008, 03:15:13 pm »
hmm, should I use then for that problem additional class whit composite aggregation relation from other classes?

this should be OK by my mind, I think:)

Torsten Binias

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: how do model files?
« Reply #5 on: April 24, 2008, 06:14:28 pm »
Hi Jüri,

using compositions is a good idea. I'd suggested that.

Additionally use can create a Dependency relationship between the class owning the operation and the class that represents your file.

Best regards,
Torsten

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: how do model files?
« Reply #6 on: May 07, 2008, 06:46:14 pm »
In more general terms I think we can state that you whish to model DTO's (Data Transfer Object) in your model. This DTO is an abstraction of the actual implementation (flat file, xml,...). It merely states which information should be contained, how it should be structured, and which constraints apply.
What I would do is create a class representing the whole DTO. Then you create classes for each section of you data structure and link them to the DTO class with compositions.
In these new classes you put the attributes needed for export, the constraints (mandatory, optional,...) and the mapping to your entity classes that contain the source of the information.
It is crucial in this case not to use the entity classes themselfs, but to create (partial) copies of them in the DTO classes. After all, your DTO is part of your interface to the outside world, which you want to be as stable as possible.