Sitelet https://github.com/ontopia/ontopia/issues/490
Skip to content

ReificationUtils contains too much logic #490

Description

@GoogleCodeExporter
ReificationUtils has a 'reify' method that holds extensive logic to be used 
when reifying an object, e.g. merging reifiable objects or topics when needed 
or throwing an exception if a reifier is being reused. Code that circumvents 
ReificationUtils by invoking ReifiableIF.setReifier directly can lead to 
unwanted behaviour or even corrupted data.

Consider this code:
TopicMapBuilderIF builder = getSomeBuilder();
AssociationIF a1 = builder.makeAssociation(builder.makeTopic());
AssociationIF a2 = builder.makeAssociation(builder.makeTopic());
TopicIF t1 = builder.makeTopic();
TopicIF t2 = builder.makeTopic();
a1.setReifier(t1);
a2.setReifier(t1); // accidents will happen
a2.setReifier(t2); // correct mistake
t1.remove();

DeletionUtils will check for reification when deleting a topic, but the 
'reified' field of t1 was overwritten to a2, so only the reifier of a2 is 
reset. The result of this is that a1.getReifier() will point to a non-existing 
topic, a proxy of what was once t1.

ReificationUtils nicely throws an error when trying to use a topic for 
reification that already reifies another reifiable object. Precisely that logic 
should be included in all .setReifier implementations to prevent missing or 
even faulty behaviour.

Original issue reported on code.google.com by p.kruijsen on 11 Dec 2013 at 10:14

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions