Is it possible to associate an attribute with a relation?


#1

Is it possible to associate an attribute with a relation? This is required to express for example that Jonh and Ana are spouses since 2014, this date is an attribute of the relationship and not of the entities.


#2

Hello,

Yes, you are free to do so provided that the relation of interest is allowed to have the attribute of interest.
In your example, provided that the line:

marriage has date;

exists in your schema, you are free to assign an attribute to a given instance by either by referring to the relationship variable:

insert 
$Ana isa person;
$John isa person;
$r (spouse: $Ana, spouse: $John) isa marriage;
$r has date 2014;

or defining it together with the relationship itself:

insert 
$Ana isa person;
$John isa person;
(spouse: $Ana, spouse: $John) isa marriage has date 2014;

as the relationship id unambiguously identifies a relationship instance, provided you know the id, you can also do:

insert
$r id ...;
$r isa marriage;
$r has date 2014;