Search code examples
schemavaticle-typedb

Can I use a relation in TypeDB(formerly Grakn) several times?


I'm putting up my TypeDB schema and I have the entity problem which is caused by many different things, e.g. by a certain practice or a certain factor.

I specified the relation causing like:

 causing sub relation, 
   relates causer, 
   relates caused, 

I don't see in the documentation whether now both entities practice AND factor can play the role causer. It would be great if someone could answer this or point me to a more extensive documentation TypeDB or even an extensive example.


Solution

  • The relationship roles that each entity can play are defined on the entity definitions themselves.

    So, if you wanted both practice and factor entities to play 'causer' you would define:

    practice plays causing:causer;
    factor plays causing:causer;
    

    Here is the documentation on role definitions: https://docs.vaticle.com/docs/schema/concepts#entity-to-play-a-role