コード例 #1
0
    def parse_abduction_contraction_results(
            self, task: Union[Task,
                              Benchmark]) -> 'AbductionContractionResults':
        """Parse the result of the abduction/contraction task by parsing stdout."""
        stdout = task.stdout
        exc.raise_if_falsy(stdout=stdout)

        res = re.search(r'Resource parsing: (.*) ms', stdout)
        exc.raise_if_falsy(res=res)
        res_parsing_ms = float(res.group(1))

        res = re.search(r'Request parsing: (.*) ms', stdout)
        exc.raise_if_falsy(res=res)
        req_parsing_ms = float(res.group(1))

        res = re.search(r'Reasoner initialization: (.*) ms', stdout)
        exc.raise_if_falsy(res=res)
        init_ms = float(res.group(1))

        res = re.search(r'Reasoning: (.*) ms', stdout)
        exc.raise_if_falsy(res=res)
        reasoning_ms = float(res.group(1))

        max_memory = self._parse_memory(task)

        return AbductionContractionResults(resource_parsing_ms=res_parsing_ms,
                                           request_parsing_ms=req_parsing_ms,
                                           init_ms=init_ms,
                                           reasoning_ms=reasoning_ms,
                                           max_memory=max_memory)
コード例 #2
0
    def parse_consistency_results(
            self, task: Union[Task, Benchmark]) -> ConsistencyResults:
        stats = self._parse_reasoning_stats(task)

        res = re.search(r'Ontology \'.*\' is (.*)\.', task.stdout)
        exc.raise_if_falsy(res=res)
        consistent = (res.group(1) == 'consistent')

        return ConsistencyResults(consistent, stats)
コード例 #3
0
    def parse_consistency_results(
            self, task: Union[Task, Benchmark]) -> 'ConsistencyResults':
        """Parse the results of the consistency task."""
        stats = self._parse_reasoning_stats(task)

        result = re.search(r'The ontology is (.*)\.', task.stdout)
        exc.raise_if_falsy(result=result)
        consistent = (result.group(1) == 'consistent')

        return ConsistencyResults(consistent, stats)
コード例 #4
0
 def __init__(self, name: str, path: str, owl_tool_path: Optional[str],
              vm_opts: List[str]):
     """
     :param name : Name of the reasoner.
     :param path : Path of the reasoner jar.
     :param owl_tool_path : Path of the owltool jar.
     :param vm_opts : Options for the Java VM.
     """
     exc.raise_if_falsy(name=name)
     super(JavaReasoner, self).__init__(path, owl_tool_path, vm_opts)
     self.__name = name
コード例 #5
0
    def __init__(self,
                 project: str,
                 scheme: str,
                 classification_test: str,
                 consistency_test: str,
                 abduction_contraction_test: str):
        """
        :param project : Test Xcode project.
        :param scheme : Xcode project scheme.
        :param classification_test : Name of the classification test.
        :param consistency_test : Name of the consistency test.
        :param abduction_contraction_test : Name of the abduction/contraction test.
        """
        exc.raise_if_not_found(project, file_type=exc.FileType.DIR)
        exc.raise_if_falsy(scheme=scheme, classification_test=classification_test, consistency_test=consistency_test)

        super(MiniMESwiftMobile, self).__init__(find_executable('xcodebuild'), None, None)
        self._project = project
        self._scheme = scheme
        self._classification_test = classification_test
        self._consistency_test = consistency_test
        self._abduction_contraction_test = abduction_contraction_test
コード例 #6
0
    def _parse_reasoning_stats(self, task: Union[Task,
                                                 Benchmark]) -> ReasoningStats:
        stdout = task.stdout
        exc.raise_if_falsy(stdout=stdout)

        res = re.search(r'>> Ontology parsed in (.*) ms\.', stdout)
        exc.raise_if_falsy(res=res)
        parsing_ms = float(res.group(1))

        res = re.search(r'Total processing time: (.*) ms\.', stdout)
        exc.raise_if_falsy(res=res)
        total_ms = float(res.group(1))

        max_memory = self._parse_memory(task)

        return ReasoningStats(parsing_ms=parsing_ms,
                              reasoning_ms=(total_ms - parsing_ms),
                              max_memory=max_memory)
コード例 #7
0
    def _parse_reasoning_stats(self, task: Union[Task,
                                                 Benchmark]) -> ReasoningStats:
        """Parse stats for a reasoning task."""
        stdout = task.stdout
        exc.raise_if_falsy(stdout=stdout)

        res = re.search(r'Parsing: (.*) ms', stdout)
        exc.raise_if_falsy(res=res)
        parsing_ms = float(res.group(1))

        res = re.search(r'Reasoning: (.*) ms', stdout)
        exc.raise_if_falsy(res=res)
        reasoning_ms = float(res.group(1))

        max_memory = self._parse_memory(task)

        return ReasoningStats(parsing_ms=parsing_ms,
                              reasoning_ms=reasoning_ms,
                              max_memory=max_memory)