// Path: DBPediaAnalyzer/src/dbpediaanalyzer/comparison/ComparisonResult.java
// public class ComparisonResult {
//     private ComparisonResultType type;
//     private HierarchyElement bottom;
//     private HierarchyElement top;
//     private Map<String, Double> values;
// 
//     public ComparisonResult(ComparisonResultType type, HierarchyElement bottom, HierarchyElement top) {
//         this.type = type;
//         this.bottom = bottom;
//         this.top = top;
//         this.values = new HashMap<>();
//     }
// 
//     public ComparisonResultType getType() {
//         return this.type;
//     }
// 
//     public HierarchyElement getBottom() {
//         return this.bottom;
//     }
// 
//     public HierarchyElement getTop() {
//         return this.top;
//     }
// 
//     public void addValue(String strategy, double value) {
//         this.values.put(strategy, value);
//     }
// 
//     public Map<String, Double> getValues() {
//         return new HashMap<>(this.values);
//     }
// 
//     public boolean isInvalid() {
//         for(Map.Entry<String, Double> entry : this.values.entrySet()) {
//             if(entry.getValue() == EvaluationStrategy.INVALID_RESULT_VALUE) {
//                 return true;
//             }
//         }
// 
//         return false;
//     }
// }
// 
// Path: DBPediaAnalyzer/src/dbpediaanalyzer/comparison/ComparisonResultType.java
// public enum ComparisonResultType {
//     CONFIRMED_DIRECT,
//     PROPOSED_INFERRED_TO_DIRECT,
//     PROPOSED_NEW
// }
// 
// Path: DBPediaAnalyzer/src/dbpediaanalyzer/comparison/EvaluationStrategy.java
// public abstract class EvaluationStrategy {
//     public static final double INVALID_RESULT_VALUE = -1.0;
// 
//     public abstract String getName();
// 
//     public double evaluateSubsumption(DataBasedSubsumption subsumption) {
//         if(subsumption.getTop().hasAncestor(subsumption.getBottom())) {
//             return INVALID_RESULT_VALUE;
//         }
// 
//         return computeValue(subsumption);
//     }
// 
//     protected abstract double computeValue(DataBasedSubsumption subsumption);
// 
// }
// 
// Path: DBPediaAnalyzer/src/dbpediaanalyzer/databasedknowledge/DataBasedSubsumption.java
// public class DataBasedSubsumption {
//     private HierarchyElement bottom;
//     private HierarchyElement top;
//     private List<Double> extensionsRatios;
//     private List<Double> intensionsRatios;
// 
//     public DataBasedSubsumption(HierarchyElement bottom, HierarchyElement top, double extensionsRatio, double intensionsRatio) {
//         this.bottom = bottom;
//         this.top = top;
//         this.extensionsRatios = new ArrayList<>();
//         this.extensionsRatios.add(extensionsRatio);
//         this.intensionsRatios = new ArrayList<>();
//         this.intensionsRatios.add(intensionsRatio);
//     }
// 
//     public void newSubmission(double extensionsRatio, double intensionsRatio) {
//         this.extensionsRatios.add(extensionsRatio);
//         this.intensionsRatios.add(intensionsRatio);
//     }
// 
//     public HierarchyElement getBottom() {
//         return this.bottom;
//     }
// 
//     public HierarchyElement getTop() {
//         return this.top;
//     }
// 
//     public int getNumberOfSubmissions() {
//         return this.extensionsRatios.size();
//     }
// 
//     public List<Double> getExtensionsRatios() {
//         return new ArrayList<>(this.extensionsRatios);
//     }
// 
//     public List<Double> getIntensionsRatios() {
//         return new ArrayList<>(this.intensionsRatios);
//     }
// }


import dbpediaanalyzer.comparison.ComparisonResult;
import dbpediaanalyzer.comparison.ComparisonResultType;
import dbpediaanalyzer.comparison.EvaluationStrategy;
import dbpediaanalyzer.databasedknowledge.DataBasedSubsumption;
import java.util.ArrayList;
import java.util.List;
package dbpediaanalyzer.factory;



/**
 * Compares the axioms from the annotated lattice with the existing ontologies
 *
 * @author Pierre Monnin
 *
 */
public class KnowledgesComparisonResultFactory {

    public static List<ComparisonResult> createKnowledgesComparisonResults(List<DataBasedSubsumption> dataBasedKnowledge) {

        List<ComparisonResult> results = new ArrayList<>();

        while(!dataBasedKnowledge.isEmpty()) {
            DataBasedSubsumption dbs = dataBasedKnowledge.remove(0);

            // Is this an already existing direct relationship?
            if(dbs.getBottom().getParents().contains(dbs.getTop())) {
                results.add(createComparisonResult(ComparisonResultType.CONFIRMED_DIRECT, dbs));
            }

            // Is this an already existing inferred relationship?
            else if(dbs.getBottom().hasAncestor(dbs.getTop())) {
                results.add(createComparisonResult(ComparisonResultType.PROPOSED_INFERRED_TO_DIRECT, dbs));
            }

            // Is this a new relationship?
            else {
                results.add(createComparisonResult(ComparisonResultType.PROPOSED_NEW, dbs));
            }
        }

// Path: DBPediaAnalyzer/src/dbpediaanalyzer/comparison/ComparisonResult.java
// public class ComparisonResult {
//     private ComparisonResultType type;
//     private HierarchyElement bottom;
//     private HierarchyElement top;
//     private Map<String, Double> values;
// 
//     public ComparisonResult(ComparisonResultType type, HierarchyElement bottom, HierarchyElement top) {
//         this.type = type;
//         this.bottom = bottom;
//         this.top = top;
//         this.values = new HashMap<>();
//     }
// 
//     public ComparisonResultType getType() {
//         return this.type;
//     }
// 
//     public HierarchyElement getBottom() {
//         return this.bottom;
//     }
// 
//     public HierarchyElement getTop() {
//         return this.top;
//     }
// 
//     public void addValue(String strategy, double value) {
//         this.values.put(strategy, value);
//     }
// 
//     public Map<String, Double> getValues() {
//         return new HashMap<>(this.values);
//     }
// 
//     public boolean isInvalid() {
//         for(Map.Entry<String, Double> entry : this.values.entrySet()) {
//             if(entry.getValue() == EvaluationStrategy.INVALID_RESULT_VALUE) {
//                 return true;
//             }
//         }
// 
//         return false;
//     }
// }
// 
// Path: DBPediaAnalyzer/src/dbpediaanalyzer/comparison/ComparisonResultType.java
// public enum ComparisonResultType {
//     CONFIRMED_DIRECT,
//     PROPOSED_INFERRED_TO_DIRECT,
//     PROPOSED_NEW
// }
// 
// Path: DBPediaAnalyzer/src/dbpediaanalyzer/comparison/EvaluationStrategy.java
// public abstract class EvaluationStrategy {
//     public static final double INVALID_RESULT_VALUE = -1.0;
// 
//     public abstract String getName();
// 
//     public double evaluateSubsumption(DataBasedSubsumption subsumption) {
//         if(subsumption.getTop().hasAncestor(subsumption.getBottom())) {
//             return INVALID_RESULT_VALUE;
//         }
// 
//         return computeValue(subsumption);
//     }
// 
//     protected abstract double computeValue(DataBasedSubsumption subsumption);
// 
// }
// 
// Path: DBPediaAnalyzer/src/dbpediaanalyzer/databasedknowledge/DataBasedSubsumption.java
// public class DataBasedSubsumption {
//     private HierarchyElement bottom;
//     private HierarchyElement top;
//     private List<Double> extensionsRatios;
//     private List<Double> intensionsRatios;
// 
//     public DataBasedSubsumption(HierarchyElement bottom, HierarchyElement top, double extensionsRatio, double intensionsRatio) {
//         this.bottom = bottom;
//         this.top = top;
//         this.extensionsRatios = new ArrayList<>();
//         this.extensionsRatios.add(extensionsRatio);
//         this.intensionsRatios = new ArrayList<>();
//         this.intensionsRatios.add(intensionsRatio);
//     }
// 
//     public void newSubmission(double extensionsRatio, double intensionsRatio) {
//         this.extensionsRatios.add(extensionsRatio);
//         this.intensionsRatios.add(intensionsRatio);
//     }
// 
//     public HierarchyElement getBottom() {
//         return this.bottom;
//     }
// 
//     public HierarchyElement getTop() {
//         return this.top;
//     }
// 
//     public int getNumberOfSubmissions() {
//         return this.extensionsRatios.size();
//     }
// 
//     public List<Double> getExtensionsRatios() {
//         return new ArrayList<>(this.extensionsRatios);
//     }
// 
//     public List<Double> getIntensionsRatios() {
//         return new ArrayList<>(this.intensionsRatios);
//     }
// }


// Path: DBPediaAnalyzer/src/dbpediaanalyzer/factory/KnowledgesComparisonResultFactory.java
import dbpediaanalyzer.comparison.ComparisonResult;
import dbpediaanalyzer.comparison.ComparisonResultType;
import dbpediaanalyzer.comparison.EvaluationStrategy;
import dbpediaanalyzer.databasedknowledge.DataBasedSubsumption;
import java.util.ArrayList;
import java.util.List;

package dbpediaanalyzer.factory;



/**
 * Compares the axioms from the annotated lattice with the existing ontologies
 *
 * @author Pierre Monnin
 *
 */
public class KnowledgesComparisonResultFactory {

    public static List<ComparisonResult> createKnowledgesComparisonResults(List<DataBasedSubsumption> dataBasedKnowledge) {

        List<ComparisonResult> results = new ArrayList<>();

        while(!dataBasedKnowledge.isEmpty()) {
            DataBasedSubsumption dbs = dataBasedKnowledge.remove(0);

            // Is this an already existing direct relationship?
            if(dbs.getBottom().getParents().contains(dbs.getTop())) {
                results.add(createComparisonResult(ComparisonResultType.CONFIRMED_DIRECT, dbs));
            }

            // Is this an already existing inferred relationship?
            else if(dbs.getBottom().hasAncestor(dbs.getTop())) {
                results.add(createComparisonResult(ComparisonResultType.PROPOSED_INFERRED_TO_DIRECT, dbs));
            }

            // Is this a new relationship?
            else {
                results.add(createComparisonResult(ComparisonResultType.PROPOSED_NEW, dbs));
            }
        }

        return results;