Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
*
*/
package nl.uu.cs.ape.sat;
import guru.nidi.graphviz.attribute.Rank.RankDir;
import nl.uu.cs.ape.sat.configuration.tags.validation.ValidationResult;
import nl.uu.cs.ape.sat.configuration.tags.validation.ValidationResults;
import nl.uu.cs.ape.sat.constraints.ConstraintTemplate;
import nl.uu.cs.ape.sat.core.implSAT.SAT_SynthesisEngine;
import nl.uu.cs.ape.sat.core.implSAT.SATsolutionsList;
import nl.uu.cs.ape.sat.core.solutionStructure.SolutionWorkflow;
import nl.uu.cs.ape.sat.models.logic.constructs.TaxonomyPredicate;
import nl.uu.cs.ape.sat.configuration.APEConfigException;
import nl.uu.cs.ape.sat.configuration.APECoreConfig;
import nl.uu.cs.ape.sat.utils.APEDimensionsException;
import nl.uu.cs.ape.sat.utils.APEDomainSetup;
import nl.uu.cs.ape.sat.configuration.APERunConfig;
import nl.uu.cs.ape.sat.utils.APEUtils;
import nl.uu.cs.ape.sat.utils.OWLReader;
import org.json.JSONException;
import org.json.JSONObject;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.*;
import javax.imageio.ImageIO;
/**
* The {@code APE} class is the main class of the library and is supposed
* to be the main interface for working with the library.
*
* @author Vedran Kasalica
*/
public class APE {
/** Core configuration object defined from the configuration file. */
private final APECoreConfig config;
/** Object containing general APE encoding. */
private APEDomainSetup apeDomainSetup;
/**
* Create instance of the APE solver.
*
* @param configPath Path to the APE JSON configuration file. If the string is null the default './ape.config' value is assumed.
* @throws IOException Exception reading the configuration file.
* @throws OWLOntologyCreationException Exception reading the OWL file.
*/
public APE(String configPath) throws IOException, OWLOntologyCreationException {
config = new APECoreConfig(configPath);
if (config == null) {
throw new APEConfigException("Configuration failed. Error in configuration file.");
}
if (!setupDomain()) {
throw new APEConfigException("Error setting up the domain.");
}
}
/**
* Create instance of the APE solver.
*
* @param configObject The APE configuration {@link JSONObject}.
* @throws IOException Exception while reading the configuration file or the tool annotations file.
* @throws OWLOntologyCreationException Error in reading the OWL file.
*/
public APE(JSONObject configObject) throws IOException, OWLOntologyCreationException {
config = new APECoreConfig(configObject);
if (!setupDomain()) {
throw new APEConfigException("Error in setting up the domain.");
}
}
/**
* Create instance of the APE solver.
*
* @param config The APE configuration {@link APECoreConfig}.
* @throws IOException Exception while reading the configuration file or the tool annotations file.
* @throws OWLOntologyCreationException Error in reading the OWL file.
*/
public APE(APECoreConfig config) throws IOException, OWLOntologyCreationException {
this.config = config;
if (!setupDomain()) {
throw new APEConfigException("Error in setting up the domain.");
}
}
/**
* Method used to setup the domain using the configuration file and the
* corresponding annotation and constraints files.
*
* @return true if the setup was successfully performed, false otherwise.
* @throws AtomMappingsException Exception while reading the provided ontology.
* @throws IOException Error in handling a JSON file containing tool annotations.
* @throws OWLOntologyCreationException Error in reading the OWL file.
*/
private boolean setupDomain() throws APEDimensionsException, IOException, OWLOntologyCreationException {
// Variable that describes a successful execution of the method.
boolean succRun = true;
/*
* Encode the taxonomies as objects - generate the list of all types / modules
* occurring in the taxonomies defining their submodules/subtypes
*/
apeDomainSetup = new APEDomainSetup(config);
OWLReader owlReader = new OWLReader(apeDomainSetup, config.getOntologyFile());
boolean ontologyRead = owlReader.readOntology();
if (!ontologyRead) {
System.out.println("Error occurred while reading the provided ontology.");
return false;
}
// Update allModules and allTypes sets based on the module.json file
succRun &= APEUtils.readModuleJson(config.getToolAnnotationsFile(), apeDomainSetup);
succRun &= apeDomainSetup.trimTaxonomy();
// Define set of all constraint formats
apeDomainSetup.initializeConstraints();
return succRun;
}
/**
* Method that return all the supported constraint templates.
*
* @return List of {@link ConstraintTemplate} objects.
*/
public Collection getConstraintTemplates() {
return apeDomainSetup.getConstraintFactory().getConstraintTemplates();
}
/**
* The method returns the configuration file of the APE instance.
*
* @return Field {@link #config}.
*/
public APECoreConfig getConfig() {
return config;
}
/**
* Gets domain setup.
*
* @return The object that contains all crucial information about the domain (e.g. list of tools, data types, constraint factory, etc.)
*/
public APEDomainSetup getDomainSetup() {
return apeDomainSetup;
}
/**
* Function used to return all the elements of one data type dimension (e.g. all
* data types or all data formats).
*
* @param dimensionRootID ID of the data taxonomy subtree that corresponds to the list of elements that should be returned.
* @return List where each element correspond to a map that can be transformed into JSON objects.
* @throws NullPointerException the null pointer exception
*/
public List