<s> from pyswip import * <EOL> def main ( ) : <EOL> p = Prolog ( ) <EOL> father = Functor ( "<STR_LIT>" , <NUM_LIT:2> ) <EOL> mother = Functor ( "<STR_LIT>" , <NUM_LIT:2> ) <EOL> assertz = Functor ( "<STR_LIT>" , <NUM_LIT:1> ) <EOL> p . assertz ( "<STR_LIT>" ) <EOL> p . assertz ( "<STR_LIT>" ) <EOL> p . assertz ( "<STR_LIT>" ) <EOL> X = Variable ( ) ; Y = Variable ( ) ; Z = Variable ( ) <EOL> listing = Functor ( "<STR_LIT>" , <NUM_LIT:1> ) <EOL> call ( listing ( father ) ) <EOL> q = Query ( father ( "<STR_LIT>" , Y ) , mother ( Z , Y ) ) <EOL> while q . nextSolution ( ) : <EOL> print Y . value , Z . value <EOL> q . closeQuery ( ) <EOL> print "<STR_LIT>" <EOL> for s in p . query ( "<STR_LIT>" ) : <EOL> print s [ "<STR_LIT:Y>" ] , s [ "<STR_LIT>" ] <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
