Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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 ''
Esempio n. 5
0
 def get_parent_action(self):
     if self.parent:
         return get_suffix_of_uri(self.parent.context.action_uri)
     return ''
Esempio n. 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]
Esempio n. 7
0
 def get_failure(self):
     return get_suffix_of_uri(self.failure)
Esempio n. 8
0
 def get_id(self):
     return get_suffix_of_uri(self.context.action_uri)