from abc import ABC
from os import path
from typing import List

from evowluator.evaluation.mode import EvaluationMode
from evowluator.reasoner.java import JavaReasoner
from evowluator.reasoner.base import (
    MetaArgs,
    ReasoningTask
)


class OWLAPIReasoner(JavaReasoner, ABC):
    """Reasoner implementation for OWLAPI reasoners."""

    @classmethod
    def is_template(cls) -> bool:
        return cls == OWLAPIReasoner

    @property
    def vm_opts(self):
        return ['-Xmx16g', '-DentityExpansionLimit=1000000000']

    def args(self, task: ReasoningTask, mode: EvaluationMode) -> List[str]:
        if task == ReasoningTask.CLASSIFICATION:
            args = ['classification']
            if mode == EvaluationMode.CORRECTNESS:
                args.extend(['-o', MetaArgs.OUTPUT])
            args.append(MetaArgs.INPUT)
        elif task == ReasoningTask.CONSISTENCY:
            args = ['consistency', MetaArgs.INPUT]
        else:
            args = []

        return args
