def handle_get_rooms(req): print '%s' % req.map res = exec_query( """ PREFIX srs: <http://www.srs-project.eu/ontologies/srs.owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ipa-kitchen: <http://www.srs-project.eu/ontologies/ipa-kitchen.owl#> SELECT ?objs WHERE { ?objs rdf:type srs:RoomInAConstruction . OPTIONAL { ?objs srs:xCoord ?x . ?objs srs:yCoord ?y . ?objs srs:zCoord ?z . ?objs srs:qx ?qx . ?objs srs:qy ?qy . ?objs srs:qz ?qz . ?objs srs:qu ?qw . ?objs srs:widthOfObject ?w . ?objs srs:heightOfObject ?h . ?objs srs:lengthOfObject ?l . } } """); print res result = GetRoomsOnMapResponse() res_json_parser = JSONResultParser(res) result.rooms = res_json_parser.get_result_by_varname('objs') spainfo = res_json_parser.get_spaital_info() result.roomsInfo = spainfo return result
def get_world_states(): print 'Run get_world_states' sparql_query = """ PREFIX srs: <http://www.srs-project.eu/ontologies/srs.owl#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ipa-kitchen: <http://www.srs-project.eu/ontologies/ipa-kitchen.owl#> SELECT ?t WHERE { ?t a srs:SpatialThing . } """ res = exec_query(sparql_query) print res json_res_parser = JSONResultParser(res) states = json_res_parser.parse_into_world_states() print states
def handle_get_workspace(req): print '%s' % req.map res = exec_query( """ PREFIX srs: <http://www.srs-project.eu/ontologies/srs.owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ipa-kitchen: <http://www.srs-project.eu/ontologies/ipa-kitchen.owl#> SELECT DISTINCT ?objs ?hhid ?x ?y ?z ?qx ?qy ?qz ?qw ?w ?h ?l WHERE { ?objs a srs:FurniturePiece . ?objs srs:houseHoldObjectID ?hhid . OPTIONAL { ?objs srs:xCoord ?x . ?objs srs:yCoord ?y . ?objs srs:zCoord ?z . ?objs srs:qx ?qx . ?objs srs:qy ?qy . ?objs srs:qz ?qz . ?objs srs:qu ?qw . ?objs srs:widthOfObject ?w . ?objs srs:heightOfObject ?h . ?objs srs:lengthOfObject ?l . } } """) print res result = GetWorkspaceOnMapResponse() res_json_parser = JSONResultParser(res) result.objects = res_json_parser.get_result_by_varname('objs') hhids_int = res_json_parser.get_result_by_varname('hhid') result.houseHoldId = list() for hhid_int in hhids_int: result.houseHoldId.append(str(hhid_int)) spainfo = res_json_parser.get_spaital_info() result.objectsInfo = spainfo return result
def handle_get_objects_new(): #print '%s' % req.map res = exec_query( """ PREFIX srs: <http://www.srs-project.eu/ontologies/srs.owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ipa-kitchen: <http://www.srs-project.eu/ontologies/ipa-kitchen.owl#> SELECT ?objs ?x ?y ?z ?w ?h ?l ?qx ?qy ?qz ?qw ?hhid WHERE { ?objs rdf:type srs:FoodVessel . ?objs srs:srsX ?x . ?objs srs:srsY ?y . ?objs srs:srsZ ?z . ?objs srs:qx ?qx . ?objs srs:qy ?qy . ?objs srs:qz ?qz . ?objs srs:qu ?qw . ?objs srs:widthOfObject ?w . ?objs srs:heightOfObject ?h . ?objs srs:lengthOfObject ?l . ?objs srs:houseHoldObjectID ?hhid .} """) result = GetWorkspaceOnMapResponse() res_json_parser = JSONResultParser(res) result.objects = res_json_parser.get_result_by_varname('objs') spainfoList = res_json_parser.get_spaital_info() result.objectsInfo = spainfoList hhids_int = res_json_parser.get_result_by_varname('hhid') result.houseHoldId = list() for hhid_int in hhids_int: result.houseHoldId.append(str(hhid_int)) return result
def handle_get_predefined_poses(req): print 'get_predefined_poses -- %s' % req.map res = exec_query( """ PREFIX srs: <http://www.srs-project.eu/ontologies/srs.owl#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX map-name: <http://www.srs-project.eu/ontologies/ipa-kitchen.owl#> SELECT ?poses ?x ?y ?theta WHERE { ?poses rdf:type srs:Point2D . ?poses srs:xCoordinate ?x . ?poses srs:yCoordinate ?y . ?poses srs:orientationTheta ?theta . } """); print res result = GetPredefinedPosesResponse() res_json_parser = JSONResultParser(res) result = res_json_parser.get_predefined_poses() return result