How to prevent a repetitive relationship


#1

When establishing a new relationship between two instances $x $y, how to confirm whether already exists the same relationship $x $y, like this:

test_rule sub rule
when
{if ($x, $y) isa not relationship;}
then
{($x, $y) isa relationship;};

#2

Sorry we forgot to reply to this, @peterluck3

If you want to make sure Relationships are unique, you should assign a key to a relation-type. e.g.

marriage isa relationship,
key identifier,
relates husband,
relates wife;

You then check if an marriage relationship already exists with a given identifier.