-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Suppose we have a knowledge base:
(a title1 tutorial1)
(a creator Alice)
(b title2 tutorial2)
(b creator Bob)
(c title1 tutorial3)
(c title2 tutorial3Updated)
- I want a query to get something like this:
[tutorial1, tutorial2, tutorial3, tutorial3Updated]
- and query, which will give something like that:
[(tutorial1, tutorial3), (tutorial2, tutorial3Updated)]
I can do something like that as a wrong attempt to solve the first task:
!(unify &self (, ($x title1 $title) ($y title2 $title2)) (superpose ($title $title2)) Fail)
But it will obviously generate an explicit set of nondeterministic results in the form of
[tutorial2, tutorial1, tutorial3Updated, tutorial1, tutorial2, tutorial3, tutorial3Updated, tutorial3]
Same as if I try to solve the second task by this
!(match &self (, ($x title1 $title) ($y title2 $title2)) ($title $title2))
The result is all possible pairs of titles 1 and 2:
[(tutorial1 tutorial3Updated), (tutorial1 tutorial2), (tutorial3 tutorial3Updated), (tutorial3 tutorial2)]
But what I want is to get set of titles which is
- union of title1 and title2 types of titles
- 2 tuples with title1 names and title2 names respectively.
An order of names in the union and tuples in the resulting output "list" does not matter.