// Path: src/main/java/org/edmcouncil/rdf_toolkit/model/UnsortedTurtleObjectList.java
// public class UnsortedTurtleObjectList extends HashSet<Value> {
// 
//   public SortedTurtleObjectList toSorted(Class<Value> collectionClass, ComparisonContext comparisonContext) {
//     var sortedObjectList = new SortedTurtleObjectList(collectionClass, comparisonContext);
//     sortedObjectList.addAll(this);
//     return sortedObjectList;
//   }
// }
// 
// Path: src/main/java/org/edmcouncil/rdf_toolkit/model/UnsortedTurtlePredicateObjectMap.java
// public class UnsortedTurtlePredicateObjectMap extends HashMap<IRI, UnsortedTurtleObjectList> {
// 
//   public SortedTurtleObjectList getSorted(IRI predicate,
//                                           Class<Value> collectionClass,
//                                           ComparisonContext comparisonContext) {
//     if (containsKey(predicate)) {
//       return get(predicate).toSorted(collectionClass, comparisonContext);
//     } else {
//       return null;
//     }
//   }
// 
//   public SortedTurtlePredicateObjectMap toSorted(Class<Value> collectionClass,
//                                                  ComparisonContext comparisonContext) {
//     SortedTurtlePredicateObjectMap sortedPOMap = new SortedTurtlePredicateObjectMap();
//     for (IRI predicate : keySet()) {
//       sortedPOMap.put(predicate, getSorted(predicate, collectionClass, comparisonContext));
//     }
//     return sortedPOMap;
//   }
// 
//   public int fullSize() {
//     int result = 0;
//     for (Resource pred : keySet()) {
//       result += get(pred).size();
//     }
//     return result;
//   }
// 
//   public boolean checkValid() {
//     for (IRI predicate : keySet()) {
//       if (get(predicate) == null) {
//         return false;
//       }
//     }
//     return true;
//   }
// }
// 
// Path: src/main/java/org/edmcouncil/rdf_toolkit/model/UnsortedTurtleSubjectPredicateObjectMap.java
// public class UnsortedTurtleSubjectPredicateObjectMap extends HashMap<Resource, UnsortedTurtlePredicateObjectMap> {
// 
//   public SortedTurtlePredicateObjectMap getSorted(Resource subject,
//                                                   Class<Value> collectionClass,
//                                                   ComparisonContext comparisonContext) {
//     if (containsKey(subject)) {
//       return get(subject).toSorted(collectionClass, comparisonContext);
//     } else {
//       return null;
//     }
//   }
// 
//   public SortedTurtleSubjectPredicateObjectMap toSorted(Class<Value> collectionClass,
//                                                         ComparisonContext comparisonContext) {
//     var sortedSPOMap = new SortedTurtleSubjectPredicateObjectMap(collectionClass, comparisonContext);
//     for (Resource subject : keySet()) {
//       sortedSPOMap.put(subject, getSorted(subject, collectionClass, comparisonContext));
//     }
//     return sortedSPOMap;
//   }
// 
//   public int fullSize() {
//     var result = 0;
//     for (UnsortedTurtlePredicateObjectMap value : values()) {
//       result += value.fullSize();
//     }
//     return result;
//   }
// 
//   public boolean checkValid() {
//     for (Resource subject : keySet()) {
//       if ((get(subject) == null) || !get(subject).checkValid()) {
//         return false;
//       }
//     }
//     return true;
//   }
// }


import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.model.Resource;
import org.eclipse.rdf4j.model.Statement;
import org.edmcouncil.rdf_toolkit.model.UnsortedTurtleObjectList;
import org.edmcouncil.rdf_toolkit.model.UnsortedTurtlePredicateObjectMap;
import org.edmcouncil.rdf_toolkit.model.UnsortedTurtleSubjectPredicateObjectMap;
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Enterprise Data Management Council
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package org.edmcouncil.rdf_toolkit.comparator;


abstract public class AbstractComparatorTest {

  public static final String IRI_PREFIX = "http://example.com/ont1/";

  protected ComparisonContext prepareComparisonContext(Model model, boolean shouldInlineBlankNodes) {
    var tripleMap = new UnsortedTurtleSubjectPredicateObjectMap();
    for (Statement statement : model) {
      Resource subject = statement.getSubject();
      if (!tripleMap.containsKey(subject)) {
        tripleMap.put(subject, new UnsortedTurtlePredicateObjectMap());
      }
      addStatement(tripleMap.get(subject), statement);
    }
    return new ComparisonContext(shouldInlineBlankNodes, tripleMap);
  }

  protected void addStatement(UnsortedTurtlePredicateObjectMap predicateObjectMap, Statement statement) {
    var predicate = statement.getPredicate();
    if (!predicateObjectMap.containsKey(predicate)) {
// Path: src/main/java/org/edmcouncil/rdf_toolkit/model/UnsortedTurtleObjectList.java
// public class UnsortedTurtleObjectList extends HashSet<Value> {
// 
//   public SortedTurtleObjectList toSorted(Class<Value> collectionClass, ComparisonContext comparisonContext) {
//     var sortedObjectList = new SortedTurtleObjectList(collectionClass, comparisonContext);
//     sortedObjectList.addAll(this);
//     return sortedObjectList;
//   }
// }
// 
// Path: src/main/java/org/edmcouncil/rdf_toolkit/model/UnsortedTurtlePredicateObjectMap.java
// public class UnsortedTurtlePredicateObjectMap extends HashMap<IRI, UnsortedTurtleObjectList> {
// 
//   public SortedTurtleObjectList getSorted(IRI predicate,
//                                           Class<Value> collectionClass,
//                                           ComparisonContext comparisonContext) {
//     if (containsKey(predicate)) {
//       return get(predicate).toSorted(collectionClass, comparisonContext);
//     } else {
//       return null;
//     }
//   }
// 
//   public SortedTurtlePredicateObjectMap toSorted(Class<Value> collectionClass,
//                                                  ComparisonContext comparisonContext) {
//     SortedTurtlePredicateObjectMap sortedPOMap = new SortedTurtlePredicateObjectMap();
//     for (IRI predicate : keySet()) {
//       sortedPOMap.put(predicate, getSorted(predicate, collectionClass, comparisonContext));
//     }
//     return sortedPOMap;
//   }
// 
//   public int fullSize() {
//     int result = 0;
//     for (Resource pred : keySet()) {
//       result += get(pred).size();
//     }
//     return result;
//   }
// 
//   public boolean checkValid() {
//     for (IRI predicate : keySet()) {
//       if (get(predicate) == null) {
//         return false;
//       }
//     }
//     return true;
//   }
// }
// 
// Path: src/main/java/org/edmcouncil/rdf_toolkit/model/UnsortedTurtleSubjectPredicateObjectMap.java
// public class UnsortedTurtleSubjectPredicateObjectMap extends HashMap<Resource, UnsortedTurtlePredicateObjectMap> {
// 
//   public SortedTurtlePredicateObjectMap getSorted(Resource subject,
//                                                   Class<Value> collectionClass,
//                                                   ComparisonContext comparisonContext) {
//     if (containsKey(subject)) {
//       return get(subject).toSorted(collectionClass, comparisonContext);
//     } else {
//       return null;
//     }
//   }
// 
//   public SortedTurtleSubjectPredicateObjectMap toSorted(Class<Value> collectionClass,
//                                                         ComparisonContext comparisonContext) {
//     var sortedSPOMap = new SortedTurtleSubjectPredicateObjectMap(collectionClass, comparisonContext);
//     for (Resource subject : keySet()) {
//       sortedSPOMap.put(subject, getSorted(subject, collectionClass, comparisonContext));
//     }
//     return sortedSPOMap;
//   }
// 
//   public int fullSize() {
//     var result = 0;
//     for (UnsortedTurtlePredicateObjectMap value : values()) {
//       result += value.fullSize();
//     }
//     return result;
//   }
// 
//   public boolean checkValid() {
//     for (Resource subject : keySet()) {
//       if ((get(subject) == null) || !get(subject).checkValid()) {
//         return false;
//       }
//     }
//     return true;
//   }
// }


// Path: src/test/java/org/edmcouncil/rdf_toolkit/comparator/AbstractComparatorTest.java
import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.model.Resource;
import org.eclipse.rdf4j.model.Statement;
import org.edmcouncil.rdf_toolkit.model.UnsortedTurtleObjectList;
import org.edmcouncil.rdf_toolkit.model.UnsortedTurtlePredicateObjectMap;
import org.edmcouncil.rdf_toolkit.model.UnsortedTurtleSubjectPredicateObjectMap;

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Enterprise Data Management Council
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package org.edmcouncil.rdf_toolkit.comparator;


abstract public class AbstractComparatorTest {

  public static final String IRI_PREFIX = "http://example.com/ont1/";

  protected ComparisonContext prepareComparisonContext(Model model, boolean shouldInlineBlankNodes) {
    var tripleMap = new UnsortedTurtleSubjectPredicateObjectMap();
    for (Statement statement : model) {
      Resource subject = statement.getSubject();
      if (!tripleMap.containsKey(subject)) {
        tripleMap.put(subject, new UnsortedTurtlePredicateObjectMap());
      }
      addStatement(tripleMap.get(subject), statement);
    }
    return new ComparisonContext(shouldInlineBlankNodes, tripleMap);
  }

  protected void addStatement(UnsortedTurtlePredicateObjectMap predicateObjectMap, Statement statement) {
    var predicate = statement.getPredicate();
    if (!predicateObjectMap.containsKey(predicate)) {
      predicateObjectMap.put(predicate, new UnsortedTurtleObjectList());