// Path: src/main/java/org/edmcouncil/rdf_toolkit/comparator/ComparisonUtils.java
// public static boolean isCollection(ComparisonContext comparisonContext,
//                                    BNode bnode,
//                                    Class<Value> collectionClass) {
//   var unsortedTripleMap = comparisonContext.getUnsortedTripleMap();
//   var poMap = unsortedTripleMap.getSorted(bnode, collectionClass, comparisonContext);
//   if (poMap != null) {
//     Set<IRI> predicates = poMap.keySet();
//     int firstCount = predicates.contains(Constants.rdfFirst) ? 1 : 0;
//     int restCount = predicates.contains(Constants.rdfRest) ? 1 : 0;
//     int typeCount = predicates.contains(Constants.RDF_TYPE) ? 1 : 0;
//     if (predicates.size() == firstCount + restCount + typeCount) {
//       SortedTurtleObjectList firstValues = poMap.get(Constants.rdfFirst);
//       for (Value value : firstValues) {
//         // all collection members must match the collection class type
//         if (!collectionClass.isInstance(value)) { return false; }
//       }
//       if (restCount >= 1) {
//         SortedTurtleObjectList rest = poMap.get(Constants.rdfRest);
//         if (rest.size() == 1) {
//           for (Value value : rest) {
//             if (Constants.rdfNil.equals(value)) {
//               return true;
//             }
//             if (value instanceof BNode) {
//               return isCollection(comparisonContext, (BNode) value, collectionClass);
//             }
//           }
//         }
//       }
//     }
//   }
//   return false;
// }


import org.eclipse.rdf4j.model.Value;
import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.eclipse.rdf4j.model.util.ModelBuilder;
import org.eclipse.rdf4j.model.util.RDFCollections;
import org.eclipse.rdf4j.model.vocabulary.FOAF;
import org.eclipse.rdf4j.model.vocabulary.RDF;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.edmcouncil.rdf_toolkit.comparator.ComparisonUtils.isCollection;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.eclipse.rdf4j.model.BNode;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Model;
/*
 * 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;


class ComparisonUtilsTest extends AbstractComparatorTest {

  @Test
  void shouldReturnFalseWhenBlankNodeDoesNotRepresentCollection() {
    var valueFactory = SimpleValueFactory.getInstance();
    var model = prepareModel(valueFactory);

// Path: src/main/java/org/edmcouncil/rdf_toolkit/comparator/ComparisonUtils.java
// public static boolean isCollection(ComparisonContext comparisonContext,
//                                    BNode bnode,
//                                    Class<Value> collectionClass) {
//   var unsortedTripleMap = comparisonContext.getUnsortedTripleMap();
//   var poMap = unsortedTripleMap.getSorted(bnode, collectionClass, comparisonContext);
//   if (poMap != null) {
//     Set<IRI> predicates = poMap.keySet();
//     int firstCount = predicates.contains(Constants.rdfFirst) ? 1 : 0;
//     int restCount = predicates.contains(Constants.rdfRest) ? 1 : 0;
//     int typeCount = predicates.contains(Constants.RDF_TYPE) ? 1 : 0;
//     if (predicates.size() == firstCount + restCount + typeCount) {
//       SortedTurtleObjectList firstValues = poMap.get(Constants.rdfFirst);
//       for (Value value : firstValues) {
//         // all collection members must match the collection class type
//         if (!collectionClass.isInstance(value)) { return false; }
//       }
//       if (restCount >= 1) {
//         SortedTurtleObjectList rest = poMap.get(Constants.rdfRest);
//         if (rest.size() == 1) {
//           for (Value value : rest) {
//             if (Constants.rdfNil.equals(value)) {
//               return true;
//             }
//             if (value instanceof BNode) {
//               return isCollection(comparisonContext, (BNode) value, collectionClass);
//             }
//           }
//         }
//       }
//     }
//   }
//   return false;
// }


// Path: src/test/java/org/edmcouncil/rdf_toolkit/comparator/ComparisonUtilsTest.java
import org.eclipse.rdf4j.model.Value;
import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.eclipse.rdf4j.model.util.ModelBuilder;
import org.eclipse.rdf4j.model.util.RDFCollections;
import org.eclipse.rdf4j.model.vocabulary.FOAF;
import org.eclipse.rdf4j.model.vocabulary.RDF;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.edmcouncil.rdf_toolkit.comparator.ComparisonUtils.isCollection;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.eclipse.rdf4j.model.BNode;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Model;

/*
 * 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;


class ComparisonUtilsTest extends AbstractComparatorTest {

  @Test
  void shouldReturnFalseWhenBlankNodeDoesNotRepresentCollection() {
    var valueFactory = SimpleValueFactory.getInstance();
    var model = prepareModel(valueFactory);

    var actualResult = isCollection(