Reputation: 139
I have two sets of entities, entities1
and entities2
and I want to identify all relations that link the two together, from a specified set of relations.
This can be done by declaring the relation as a variable:
?entities1 ?relations ?entities2
However, this iterates over all possible relations, therefore making the query incredibly slow and inefficient.
This could also be done by declaring the relations needed using a OR operator:
?entities1 (relation1 | relation2 | ... | relation_n) ?entities2
This finds all of the cases where entities 1 and 2 are linked by one of our relations but the relation is not returned, therefore it's not known which relation was correct.
I need a method of finding the relations between each entity from a specified set of relations that can then be returned as a table with the headers (entity1, entity2, relation).
Any ideas?
Upvotes: 1
Views: 167
Reputation: 139
@UninformedUser kindly pointed out that a set of relations can be declared by using VALUES
meaning that the desired effect can be achieved as follows:
VALUES ?relation {:relation1 :relation2 ... :relation_n} ?entities1 ?relation ?entities2 .
Thanks for your help!
Upvotes: 3