Error: More relations same roles and role player


#1

Hi guys,

we have created an ontology with a relation A between entity B and C.

The relation A can persiste multiple time across same entity so it has resource date also, but when we create second instance we receive following error:

You have created one or more relations with the following roles and role player

Maybe is not possible to create an ontology with this kind of relation?

Thanks for your help.

Francesco


#2

Hi @fcioffi,

So in the current release we do not actually allow relations composed of exactly the same roles and role players. I.e. relations are unique to their type and roles/role players. We actually debating wether we should loosen this restriction or not. You may be able to contribute to this discussion actually. What’s your use case that requires “duplicate” relations?

The relation A can persiste multiple time across same entity so it has resource date also

For this use case what you might be able to do is only create the relation between B and C once. Then whenever you need to add a new relation due to a different time of persistence (or whatever) you can actually attach the time resource to the relation itself. So with this approach you can have multiple time stamps but maintain a leaner database by only having one core relation. Will that work for you?

Regards,

Filipe


#3

Hi Filipe

thanks for your response.

We are trying to map with an ontology the human behaviour in a conversational engine enjoyed by a bot.

The relation that we imagine is between an user and a conversational node. The conversational-node is abstracted from concrete conversational-node and an user can enjoy the same node more times during the time.

So the interaction relation can exists more times. Now we can try to implement your suggestion finding if the relation already exists or not and if it exists adding a date resource.

Do you think that is right or maybe exists an alternative?

Regards,
Francesco


#4

Given the current restrictions that relations must be unique then yes I think that is the way to do it. If you find that this does not work for you do let us know and why it does not work. As I said before we are currently discussing loosening that restriction.

Hope that helps


#5

Hi @filipe and @fcioffi
Just to add another example to discussion: in my ontology I have an entity called “frame”; a “frame” can be related to others “frames” - each relation would be an “element”. But “frameA” can be related to “frameB” through different “elements”. As an relation can be “named” when I define the ontology, I thought it would be allowed; but it is not. Even “elements” having different names, it has a structural validation error.
Of course, it is simple to create the “element” as an entity, but it will be necessary two more relations (frame->element and element->frame).
Thanks,
Ely


#6

Hi Guys,

We actually had a meeting about allowing duplicate relations just a few days ago and we have realised that it is potentially a larger endeavour that we originally anticipated.

There is a middle ground we are considering introducing in the meantime while we formally iron out duplicate relations. Which is to allow duplicate relations which have different resources attached to them. Would that work for you use cases?

Regards,

Filipe


#7

Hi @filipe and @fcioffi
Sadly it doesn’t work at my usecase, because different ‘elements’ can connect the same two frames. But I understand that is a specific modelling question and, of course, can be modeled through entities. But I must say I had cases in the past when the proposed solution - duplicate relations with different resources - would be useful. I think the possibility of relating relations (as in the philosophers example) is a very useful tool.
Thanks,
Ely


#8

Hi @filipe,

sorry for the late response. Yes it’s my case. When a relation born between same entities it ha different mean so it has different resources / attributes.

Thanks,
FC


#9

@filipe

Not sure if I’m coming up against this as well, but in modelling the employment data, I’ve got a classic employer & employee relationship and it appears to be coming up with “You have created one or more relations with the following roles and role player” when the employee has worked for the same company more than once.

To say this is a bit of a stumbling block would be a massive understatement, we need to be able to cope with this situation as it happens quite frequently with temps & contractors.

Any update on where you are with the ability to have multiple relationships between the same two entities?

TIA

Steve.


#10

Hi @MGSteve,

This is intentional. Relationships are uniquely identified via their type and their roleplayers. So in this case you would have to model things differently. Your options include:

  1. Adding another roleplyer to make the relationship unqiue, for example the start and end dates of the employment or
  2. Provide your Relationship Type with a key. When a Relationship type has a key then you can have multiple relationships with the same roleplayers but different keys.

Hope that helps.

Regards,

Filipe


#11

Hi @filipe,

Thanks for that, sorry to ask probably a really basic question, could you give an example of what you mean by a key?

Here’s the relevant part of the Ontology I’m working on.

 insert
    system_id sub resource, datatype string;
    name sub resource, datatype string;
    id_key sub resource, datatype string;
    status sub resource, datatype string;
    current_salary sub resource, datatype double;
    salary sub resource, datatype double;
    notice_period sub resource, datatype string;
    town sub resource, datatype string;
    postcode sub resource, datatype string;

# Employment Fields
    job_title sub resource, datatype string;
    vacancy_type sub resource, datatype string;
    start_date sub resource, datatype string;
    end_date sub resource, datatype string;

# Define Roles

insert employee sub role;
insert employer sub role;

# Define Entities
insert person sub entity has system_id, has name, has status, has current_salary, has notice_period, has town, has postcode, plays employee;
insert company sub entity has name, has system_id has town, has postcode plays employer; 

# Define Relationships
insert employment sub relation, relates employee,  relates employer,  has start_date,  has end_date, has vacancy_type, has job_title, has salary;

TIA

Steve.


#12

@MGSteve

You can do the following:

# Define Key
insert my-key sub  resource, datatype string;

# Define Roles
insert employee sub role;
insert employer sub role;

# Define Relationships
insert employment sub relation, relates employee,  relates employer, key my-key;

Now when adding relations of type employment you can add do the following to allow duplicate relations:

insert
$x isa person;
$y isa company;
(employee: $x, employer: $y) isa employment has my-key "employment-1"
(employee: $x, employer: $y) isa employment has my-key "employment-2"

So now you have two relations with the same role-players.