test_re_ontology.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 
00004 import roslib; roslib.load_manifest('json_prolog')
00005 
00006 import rospy
00007 import json_prolog
00008 
00009 if __name__ == '__main__':
00010     rospy.init_node('test_re_ontology')
00011     prolog = json_prolog.Prolog()
00012 
00013     # read the list of actions for the plan SetATable
00014     query = prolog.query("plan_subevents('http://www.roboearth.org/kb/set_a_table.owl#SetATable', Actions)")
00015     for solution in query.solutions():
00016         print 'Found actions for plan SetATable: Actions = %s' % (solution['Actions'])
00017     query.finish()
00018 
00019     # read the list of actions for the plan SetATable
00020     query = prolog.query("plan_subevents('http://www.roboearth.org/kb/set_a_table.owl#SetATable', Actions)")
00021     for solution in query.solutions():
00022         print 'Found actions for plan SetATable: Actions = %s' % (solution['Actions'])
00023     query.finish()
00024 
00025 
00026                 # read the objectActedOn of all actions
00027     query = prolog.query("plan_subevents('http://www.roboearth.org/kb/set_a_table.owl#SetATable', Actions), member(Act, Actions), comp_ehow:action_objectActedOn(Act, Obj)")
00028     for solution in query.solutions():
00029         print 'Found objects: Act = %s, Obj = %s' % (solution['Act'], solution['Obj'])
00030     query.finish()
00031 
00032 
00033                 # read the toLocation of all actions
00034     query = prolog.query("plan_subevents('http://www.roboearth.org/kb/set_a_table.owl#SetATable', Actions), member(Act, Actions), comp_ehow:action_toLocation(Act, Loc)")
00035     for solution in query.solutions():
00036         print 'Found locations: Act = %s, Loc = %s' % (solution['Act'], solution['Loc'])
00037     query.finish()
00038 
00039 
00040 
00041 
00042 
00043 


re_ontology
Author(s): Moritz Tenorth
autogenerated on Sun Jan 5 2014 11:28:20