Book a Demo

Author Topic: Compound alternate identifiers  (Read 2544 times)

speekna

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Compound alternate identifiers
« on: December 28, 2006, 04:34:55 pm »
How can I define a constraint that documents an alternate business key composed of multiple attributes for a class?  
Is there a way to do this in a domain model - i.e., from a business perspective - as well as a data model?

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Compound alternate identifiers
« Reply #1 on: December 29, 2006, 12:47:50 am »
Quote
How can I define a constraint that documents an alternate business key composed of multiple attributes for a class?  
Is there a way to do this in a domain model - i.e., from a business perspective - as well as a data model?
speekna,

I'm not sure what you are trying to achieve here... However, assuming you are trying to define (what I have defined as) a Domain Key - that is, a unique identifier of an instance of a class based on the values of the public attributes that are visible in the domain of discourse; then you can use an analogous method to the Data Modelling extensions:

Create an operation that defines which attributes make up the Domain Key and assign it the stereotype DK.  

Now, how you use that information is up to you.  There's no intrinsic support for such things in EA.

HTH,
Paolo
[size=0]©2006 Paolo Cantoni, -Semantica-[/size]
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

speekna

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Compound alternate identifiers
« Reply #2 on: December 30, 2006, 03:27:36 pm »
Thanks Paolo!  Now - how can I specify what class attributes to use in the operation?  I just looked at all the operations help - can't see anything there.

BTW - I thought the way to specify a domain key might be to specify a class constraint - but I can't see how to specify a class attribute in one of it's constraints either.

Appreciate the help...

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Compound alternate identifiers
« Reply #3 on: December 30, 2006, 07:35:35 pm »
Quote
Thanks Paolo!  Now - how can I specify what class attributes to use in the operation?  I just looked at all the operations help - can't see anything there.
I would name the operation the name you would give the key (as if it were a Database Key name), each operation parameter would have the name and datatype of the attribute I intended to use as the component of the key.  This is analogous to the Data Modelling profile EA normally uses.  I would apply the stereotype «DK» (for DomainKey) to the operation.
Quote
BTW - I thought the way to specify a domain key might be to specify a class constraint - but I can't see how to specify a class attribute in one of it's constraints either.

Appreciate the help...
The constraints area is, essentially, free text  You could add a type of constraint DomainKey via Settings|General types>Constraints... and place the set of attributes in the free text, comma separated.  Howe ever, since a domain key is an n-ary identity tuple you are, almost by definition, creating a parameterized operations.  So why not extend the existing mechanism for defining keys?

HTH,
Paolo

BTW: If you aren't clear on how EA does the DataModelling profile, create a class stereotyped as «table» (or drag a Table toolbox item) and create a primary key.
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!