All Downloads are FREE. Search and download functionalities are using the official Maven repository.

owl_api.binding.DefaultOWLAPIBinding Maven / Gradle / Ivy

The newest version!
package owl_api.binding;

import java.io.FileNotFoundException;
import java.io.Serializable;

import api.definition.ITask;
import api.running.IService;
import api.running.IToolBinding;
import menu.OWLAPIKeywords;
import owl_api.services.concrete.ExplanationOWLAPI;
import tools.utils.InputInterpreter;

/**
 * A binding for the OWL API.
 */
public class DefaultOWLAPIBinding implements IToolBinding, Serializable {

	private static final long serialVersionUID = -4633010468343572147L;

	@Override
	public IService createServiceFrom(ITask task) throws FileNotFoundException {

		OWLAPIInputInterpreter.checkServiceKeyAndValue(task);

		var scenario = OWLAPIInputInterpreter.translateInputDataScenarioFor(task);

		var algoParams = OWLAPIInputInterpreter.translateAlgorithmParametersFor(task);

		var halt = OWLAPIInputInterpreter.getExperimentTimeoutConditionsFor(task);

		var serviceType = InputInterpreter.getServiceTypeFor(task, OWLAPIKeywords.Service.class);

		return switch (serviceType) {

		case EXPLANATION -> new ExplanationOWLAPI(scenario, algoParams);

		default -> throw new IllegalArgumentException("Unexpected value: " + serviceType);

		};

	}

	public static void main(String[] args) {

		var x = new DefaultOWLAPIBinding();
		System.out.println(x.getClass());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy