예제 #1
0
    def get_body_parts_used(self):
        body_parts_used = self._get_property_(BODY_PARTS_USED)

        if body_parts_used:
            return get_suffix_of_uri(body_parts_used)
        elif self._equated_action:
            body_parts_used = self._equated_action.get_body_parts_used()

        return body_parts_used
예제 #2
0
    def _init_object_map(self):
        result = {}
        query = "ask(instance_of(R,'{}')).".format(
            get_dul_uri(DESIGNED_ARTIFACT))
        solutions = self._graph_.send_query(query)

        for solution in solutions:
            object_uri = solution.get('R')
            object_id = get_suffix_of_uri(object_uri)
            object_type = self._get_object_type(object_id)
            result[object_uri] = object_type

        return result
예제 #3
0
 def get_object_acted_on(self):
     query = "ask(triple(dul:'{}',dul:'hasParticipant',Object))".format(
         self.get_id())
     solution = self._graph_.send_query(query)
     object_acted_on = None
     if solution:
         object_acted_on = get_suffix_of_uri(solution.get('Object'))
     elif self.get_type() == 'Accessing' or self.get_type() == 'Sealing':
         results = self._graph_.send_query(
             "findall(O,ask(triple(dul:'{}',rdfs:'comment', O)),R).".format(
                 self.get_id()))
         for result in results.get('R'):
             comment = result
             search_result = re.search("\(URDF-NAME(.+)\)", comment)
             if search_result:
                 object_acted_on = search_result.groups()[0]
                 break
     return object_acted_on
예제 #4
0
    def get_grasp(self):
        if self.grasp_uri:
            #http://www.ease-crc.org/ont/EASE.owl#FrontGrasp_TUYVDNPS
            return get_suffix_of_uri(self.grasp_uri).split('Grasp_')[0]

        return ''
예제 #5
0
 def get_parent_action(self):
     if self.parent:
         return get_suffix_of_uri(self.parent.context.action_uri)
     return ''
예제 #6
0
 def get_type(self):
     # http://knowrob.org/kb/knowrob.owl#PuttingDownAnObject_HLOUBZDW
     return get_suffix_of_uri(self.context.type_uri).split('_')[0]
예제 #7
0
 def get_failure(self):
     return get_suffix_of_uri(self.failure)
예제 #8
0
 def get_id(self):
     return get_suffix_of_uri(self.context.action_uri)