Hello ... I'm having the following problem ... I have a Prolog knowledge base that contains only facts like these:
alpha(6,5).
beta(7,6).
gamma(8,6).
........
and so on ....
basically, it's a generalized tree representation ... and it's guaranteed that the first parameter of each fact is unique in the entire knowledge base ... thus, there is only one fact that has first parameter = 8 (the gamma fact) ...
now, I would like to retrieve in one of my user queries the name of the fact that has as first parameter a certain number ... for example, given the number 8, i would like to obtain the name "gamma" because gamma is the only fact in the knowledge base that has 8 as its first parameter (or ID, since first parameters are unique) ... or better yet, is there a way to obtain the whole term gamma(8,6)?
thanks in advance for your time ...
alpha(6,5).
beta(7,6).
gamma(8,6).
........
and so on ....
basically, it's a generalized tree representation ... and it's guaranteed that the first parameter of each fact is unique in the entire knowledge base ... thus, there is only one fact that has first parameter = 8 (the gamma fact) ...
now, I would like to retrieve in one of my user queries the name of the fact that has as first parameter a certain number ... for example, given the number 8, i would like to obtain the name "gamma" because gamma is the only fact in the knowledge base that has 8 as its first parameter (or ID, since first parameters are unique) ... or better yet, is there a way to obtain the whole term gamma(8,6)?
thanks in advance for your time ...