0

I have information in AG knowlwedgebase like this

 Person1 hasBrother Person2
 Person1 hasSister Person 3

How can I write a rule in prolog to find out additional relations from the the above facts

Person2 hasSister Person3
Person3 hasBrother Person2
Person 3 is SiblingOf Person 2

I have tried like this but no success:

(<-(Family ?p1 relation ?p2)
(q ?p1 !ns:hasBrother ?p2)
(q ?p1 !ns:hasSister ?p2)
)

Can anyone help me out to write a rule to get additional transitive relations?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
user3356568
  • 119
  • 2
  • 14
  • 1
    The code that you "tried" (`<-(Family ?p1 ...`) doesn't look like any Prolog I've ever seen before. So it's unclear to me what you're asking for. – lurker Mar 11 '15 at 16:26
  • this is actually rule syntax when we use prolog under lisp – user3356568 Mar 11 '15 at 22:59
  • The query calls AG knowledgebase data. ok If you give me hint how we can find transitive relations in simple prolog syntax then I can convert into the above rule syntax. your help would highly be appreciated. Thanks – user3356568 Mar 11 '15 at 23:07
  • What you need has been asnwered [here](http://stackoverflow.com/questions/23539327/transitive-closure-over-a-symmetric-relation-in-prolog) – vmg Mar 13 '15 at 15:52
  • thanks vmg got idea – user3356568 Mar 19 '15 at 07:11

0 Answers0