(a)
class Service ( Component ) : def __init__( self, _service ) : self._service = _service Component.__init__( self, _service ) def getInterfaces( self ) : return getCollection( self._service, "Interfaces_of_Service", "Interface" ) def setInterfaces( self, interfaces ) : setCollection( self._service, interfaces, "Interfaces_of_Service", "_interface" )(b)
def createService( name ) : _service = kb.createInstance( "Service_" + name, kb.getCls( "Service" ) ) service = Service( _service ) service.setName( name ) return service
Example 1: (a) Python script for importing, exporting, and knowledge mining; (b) factory script function.