#!/usr/bin/python """Eep RDF API: Inference Engine Tests""" __author__ = 'Sean B. Palmer' __license__ = 'Copyright (C) 2001 Sean B. Palmer. GNU GPL 2' import eep, query, infer, template def test(): store = eep.parse("""<#Sean> <#likes> <#TheSimpsons> . <#Sean> <#likes> <#TheSemanticWeb> . <#Aaron> <#name> "Aaron" . <#Aaron> <#likes> <#ThePlex> . <#Sean> <#name> "Sean" .""") r = template.rule('?x <#name> ?y .\n?x <#likes> ?z .', '

(?z) is liked by (?y)

\n') print template.format("", template.filter(r, store), "") store = eep.parse("""<#Bob> <#sonOf> <#Fred> . <#Fred> <#sonOf> <#John> . <#John> <#sonOf> <#Wayne> .""") r = template.rule('?x <#sonOf> ?y .\n?y <#sonOf> ?z .', '

(?x) is the grandchild of (?z)

\n') print template.format("", template.filter(r, store), "") if __name__=="__main__": test()