pyrdfrules.rdfrules.rdfrules

 1from typing import Any
 2
 3from pyrdfrules.api.workspace.workspace_api import WorkspaceApi
 4from pyrdfrules.common.file.workspace import Workspace
 5from pyrdfrules.common.task.task_runner import TaskRunner
 6from pyrdfrules.config import Config
 7from pyrdfrules.engine.engine import Engine
 8
 9class RDFRules():
10    """Represents the RDFRules engine.
11    """
12    
13    engine: Engine
14    """RDFRules engine.
15    """
16    
17    workspace: Workspace
18    """Workspace classes.
19    """
20    
21    task: TaskRunner
22    """Task runner.
23    """
24    
25    config: Config
26    """Configuration.
27    """
28    
29    def __init__(self, engine: Engine, config: Config) -> None:
30        self.engine = engine
31        self.config = config
32        self.engine.config = config
33        pass
34    
35    def __getattr__(self, name: str) -> Any:
36        if name == 'workspace':
37            # should not be cached, because it can change
38            return Workspace(self.engine.api.workspace)
39        
40        if name == 'task':
41            # todo this can be cached
42            return TaskRunner(self.engine.api.task, self.config)
43        
44        pass
45    
46    def start(self) -> None:
47        """
48        Starts the engine.
49        """
50        
51        self.engine.start()
52        
53        pass
class RDFRules:
10class RDFRules():
11    """Represents the RDFRules engine.
12    """
13    
14    engine: Engine
15    """RDFRules engine.
16    """
17    
18    workspace: Workspace
19    """Workspace classes.
20    """
21    
22    task: TaskRunner
23    """Task runner.
24    """
25    
26    config: Config
27    """Configuration.
28    """
29    
30    def __init__(self, engine: Engine, config: Config) -> None:
31        self.engine = engine
32        self.config = config
33        self.engine.config = config
34        pass
35    
36    def __getattr__(self, name: str) -> Any:
37        if name == 'workspace':
38            # should not be cached, because it can change
39            return Workspace(self.engine.api.workspace)
40        
41        if name == 'task':
42            # todo this can be cached
43            return TaskRunner(self.engine.api.task, self.config)
44        
45        pass
46    
47    def start(self) -> None:
48        """
49        Starts the engine.
50        """
51        
52        self.engine.start()
53        
54        pass

Represents the RDFRules engine.

RDFRules( engine: pyrdfrules.engine.engine.Engine, config: pyrdfrules.config.Config)
30    def __init__(self, engine: Engine, config: Config) -> None:
31        self.engine = engine
32        self.config = config
33        self.engine.config = config
34        pass

RDFRules engine.

Workspace classes.

Configuration.

def start(self) -> None:
47    def start(self) -> None:
48        """
49        Starts the engine.
50        """
51        
52        self.engine.start()
53        
54        pass

Starts the engine.