in

The ORM Foundation

Get the facts!

Data Loss After Changing Entity Type to Value Type

Last post 11-01-2010 20:00 by Matthew Curland. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 10-31-2010 20:45

    Data Loss After Changing Entity Type to Value Type

    Lets say that I start out by defining an entity type called Location Name
    with RefMode = .name and Data Type = Text Variable. Then I have used the
    population editor to load a long list of building names. Later, I decide
    that I want Location Name to be a value type. Is there a way to make this
    conversion without loosing the list of building names that I have already
    loaded? I've tried such a conversion by starting with the entity type,
    deleting the RefMode entry and then selecting IsValueType=True; however,
    I keep loosing the building name data entries. Based on discussions with
    others, I could make some reasonable speculations about why the entries
    are lost. What I'm looking for is a way around the loss (guess I'm just
    getting to lazy to reenter the data).
    Filed under:
  • 10-31-2010 22:48 In reply to

    Re: Data Loss After Changing Entity Type to Value Type

    Just a thought... Instead of changing the entity type to a value type, expand the reference mode. Delete the entity type, and rename the value type, which should still have a sample population.
  • 11-01-2010 20:00 In reply to

    Re: Data Loss After Changing Entity Type to Value Type

    Answer

    As Clifford says, the goal here is to keep the ValueType intact. This will not preserve the relationship between the entity type and the other fact types, but at least you won't have to reenter the building data.

    1. Select a shape for the entity type you want to change to a value type.
    2. Set the 'ExpandRefMode' property to true. You'll see a fact type and a value type appear.
    3. (Order is important here) Delete the fact type, then the entity type.
    4. Rename the value type to the original entity type name.
    5. You'll have errors on the roles that used the original entity type. Double-click these errors in the Error List to activate an editor that will let you drop on the replacement value type, or just drag the roles yourself. Alternately, you can multi-select the roles (click accurately to select the role, not the fact type) and use the RolePlayer property to set them all at once.
    6. Fixup an fact type populations.

    I'd like to improve this area in general. Currently, the populations of existential fact types (those with roles in a preferred identifier) are implicitly populated based on the population of the identified entity type. An alternative approach is to fully populated these fact types, giving the the entity instance an identifier but no asserted population (the population is derived from the existential fact types instead of the current situation, which derives the fact population from the entity identifier population). This alternate approach would make it easier to switch identifiers without having to repopulate all role players. You probably won't see this in the near future, but I'd like to do it eventually because I know this is a pain point.

    -Matt

Page 1 of 1 (3 items)
© 2008-2014 The ORM Foundation: A UK not-for-profit organisation -------------- Terms of Service