Removing a role value from an instance of a relation


#1

How can I remove a role value from a relationship? In this example I have a relationship marriage with two roles spouse1 and spouse2. I have assigned two entities to the same role spouse2 and I would like to remove one of them. What is the graql code for that?

The commands below show the data I have in more details.

insert $x isa person; $x has identifier “Alice”;
Result: $x id “41459944” isa person;

insert $x isa person; $x has identifier “Bob”;
Result: $x id “41164888” isa person;

insert $x isa person; $x has identifier “Claire”;
Result: $x id “41464040” isa person;

match $x has identifier “Alice”; $y has identifier “Bob”;
Result: $x id “41459944” isa person; $y id “41164888” isa person;

match $x has identifier “Alice”; $y has identifier “Bob”; insert $m (spouse1: $x, spouse2: $y) isa marriage;
Result: $x id “41459944” isa person; $y id “41164888” isa person; $m id “41173080” (spouse2: id “41164888”, spouse1: id “41459944”) isa marriage;

match $x has identifier “Alice”; $y has identifier “Claire”; insert $m id “41173080” (spouse1: $x, spouse2: $y) isa marriage;
Result: $x id “41459944” isa person; $y id “41464040” isa person; $m id “41173080” (spouse2: id “41164888”, spouse2: id “41464040”, spouse1: id “41459944”) isa marriage;


#2

Hi @muhammad.alkarouri,

So at this stage there is no way to remove a role value (what we call roleplayer) from a relation. You have to delete the relation and add it back in.

We may add the ability to remove role players later but sadly I can’t give a timeline on that one at the moment.