Retrieve Entity type dynamically


#1

I have setup the model in such a way that each entity will have a master instance. Irrespective of which specific instance I start search within a entity type, I want to navigate to the master instance.

Example: Imagine Person -> Employee relationship.
My query starts with match $x isa Person has identifier “StudentEmployee”;
Second part of the query should be something like
$y isa $type($x) has identifier “MasterEmployee”. Meaning creating another instance of Person/Employee based on previous match clause but find the master record instead. Even though type is Person, due to inheritance it should retrieve Employee record.

I need this dynamism since both Person and Employee are proper entities and neither of them is abstract. You can think of my use case being similar to a search engine types. I search across attributes for matching text and then find entities first. Then move up to the master instance to navigate across the relationships and find linked entities and relationships.


#2

This is solved. I was able to create an inference rule which links any instance to its master instance for the same entity. Please consider this as closed.