Skip to content
Snippets Groups Projects
Select Git revision
  • dd1a2a95af623f5c12e5e6b6a11f0afa5a620e69
  • master default protected
  • multiprocessing
  • experiment/clara
  • experiment/spec2B-poc
  • experiment/qivalio-poc
  • experiment/ertms
  • MAY-2023
  • FEB-2023
  • EGC-2023
  • 0.2.1
  • v0.2.0
  • v0.1.2
13 results

action_net.py

Blame
  • action_net.py 2.17 KiB
    #!/usr/bin/python3.10
    # -*-coding:Utf-8 -*
    
    #==============================================================================
    # TENET: Class Net
    #------------------------------------------------------------------------------
    # Class to handle semantic nets 
    #==============================================================================
    
    from transduction.net import Net
    from transduction.rdfterm_computer import produce_uriref, produce_literal
    
    
    #==============================================================================
    # Net Class
    #==============================================================================
    
    class ActionNet(Net):
        """ Class to handle semantic net.
        """
        
        #--------------------------------------------------------------------------
        # Constructor(s)
        #--------------------------------------------------------------------------
               
        def __init__(self, support_graph, uri=None):
    
            # -- Parent init
            super().__init__(support_graph, uri)
            
            # -- Net Type
            self.type_name = 'action'
            self.type_id = 'Action_Net'
            self.type_uri = f'net:{self.type_id}'
            
            # -- Net Attributes
            self.attr_list += ['action_name', 'target_net']
            self._action_name = None
            self._target_net = None
      
            
        #--------------------------------------------------------------------------
        # Accessors for Net Attributes
        #--------------------------------------------------------------------------
            
        @property
        def action_name(self):
            if self._action_name is None: 
                self._action_name = self.get_value_list_from_graph('action_name')
            return self._action_name
        
        @action_name.setter
        def action_name(self, new_value):
            self._action_name = self.set_attribute_value_list(new_value, produce_literal)
            
            
        @property
        def target_net(self):
            if self._target_net is None: 
                self._target_net = self.get_value_list_from_graph('target_net')
            return self._target_net
        
        @target_net.setter
        def target_net(self, new_value):
            self._target_net = self.set_attribute_value_list(new_value, produce_uriref)