I am reading the book "Prolog and Natural-Language Analysis" (pdf) by Pereira and Shieber and I got stuck on a remark in Problem 2.7 which reads:
In semantic network representations, we often want to ask [...] “What relationships hold between Ford and the class of companies?”
Modify your representation of semantic networks to allow both this new kind of question and the kind in the previous problem. HINT: Treat semantic network relations as Prolog individuals. This is an important Prolog programming technique, sometimes called reification in philosophical circles.
I am not familiar with this reification
technique.
OK, let's assume this database of facts and rules:
isa('Ole Black', 'Mustangs').
isa('Lizzy', 'Automobiles').
isa('Ford','Companies').
isa('GM','Companies').
isa('1968','Dates').
ako('Model T', 'Automobiles').
ako('Mustangs', 'Automobiles').
ako('Companies', 'Legal Persons').
ako('Humans', 'Legal Persons').
ako('Humans', 'Physical Objects').
ako('Automobiles', 'Physical Objects').
ako('Legal Persons', 'Universal').
ako('Dates', 'Universal').
ako('Physical Objects', 'Universal').
have_mass('Physical Objects').
self_propelled('Automobiles').
company(X) :- isa(X,'Companies').
legal_persons(X) :- ako(X,'Legal Persons').
How do I write a query that, in the code above finds that the relationship between 'Ford'
and 'Companies'
is isa
?
Of course I could always write something like
fact(isa, 'Ford','Companies').
and query ?- fact(X, 'Ford','Companies').
but somehow I do not think that this is the right way to do it.
Can anybody explain me how to do it properly?