@Test void testHypercliqueOnHigherAryEdges() throws Exception { String relationName = "TEST"; List<String> columnNames = asList("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N"); List<ColumnIdentifier> ci = new ArrayList<>(); for (String c : columnNames) { ci.add(new ColumnIdentifier(relationName, c)); } List<ExIND> maximumINDs = new ArrayList<>(); maximumINDs.add( new ExIND( new ColumnPermutation(ci.get(0), ci.get(1), ci.get(3), ci.get(4)), new ColumnPermutation(ci.get(7), ci.get(8), ci.get(10), ci.get(11)))); maximumINDs.add( new ExIND( new ColumnPermutation(ci.get(0), ci.get(2), ci.get(3), ci.get(4)), new ColumnPermutation(ci.get(7), ci.get(9), ci.get(10), ci.get(11)))); maximumINDs.add( new ExIND( new ColumnPermutation(ci.get(1), ci.get(2), ci.get(3)), new ColumnPermutation(ci.get(8), ci.get(9), ci.get(10)))); maximumINDs.add( new ExIND( new ColumnPermutation(ci.get(1), ci.get(2), ci.get(4)), new ColumnPermutation(ci.get(8), ci.get(9), ci.get(11)))); maximumINDs.add( new ExIND( new ColumnPermutation(ci.get(3), ci.get(5), ci.get(6)), new ColumnPermutation(ci.get(10), ci.get(12), ci.get(13)))); maximumINDs.add( new ExIND( new ColumnPermutation(ci.get(4), ci.get(5)), new ColumnPermutation(ci.get(11), ci.get(12)))); maximumINDs.add( new ExIND( new ColumnPermutation(ci.get(4), ci.get(6)), new ColumnPermutation(ci.get(11), ci.get(13)))); testDatabase = TestDatabase.builder() .resourceClass(FIND2Test.class) .relationName(relationName) .columnNames(columnNames) .csvPath("testHypercliqueOnHigherAryEdges.csv") .build(); testDatabase.setUp(); InclusionDependencyResultReceiverStub resultReceiver = new InclusionDependencyResultReceiverStub(); ValidationParameters validationParameters = new ValidationParameters(); validationParameters.setQueryType(QueryType.NOT_IN); validationParameters.setConnectionGenerator(testDatabase.asConnectionGenerator()); InclusionDependencyParameters inclusionDependencyParameters = new InclusionDependencyParameters(); inclusionDependencyParameters.setAlgorithmType(AlgorithmType.FILE); inclusionDependencyParameters .setConfigurationString("inputPath=" + getClass().getResource("ind_input.json").getFile()); FIND2Configuration config = FIND2Configuration.builder() .resultReceiver(resultReceiver) .validationParameters(validationParameters) .inclusionDependencyParameters(inclusionDependencyParameters) .startK(2) .build(); FIND2 find2 = new FIND2(config); find2.execute(); assertTrue(resultReceiver.getReceivedResults().containsAll(maximumINDs)); assertTrue(maximumINDs.containsAll(resultReceiver.getReceivedResults())); }
void execute() throws AlgorithmExecutionException { log.fine("Start of algorithm FIND2."); List<InclusionDependency> inputInds = inclusionDependencyInput.execute(); Set<ExIND> unaries = getUnaryINDs(inputInds); Set<ExIND> karies = getKaryINDs(config.getStartK(), inputInds); Set<ExIND> karies1 = karies; Set<ExIND> validINDs = unaries .stream() .filter(unary -> karies1.stream().noneMatch(kary -> kary.contains(unary))) .collect(Collectors.toCollection(HashSet::new)); unaries.removeAll(validINDs); for (int k = config.getStartK(); k < unaries.size(); k++) { Hypergraph graph = new Hypergraph(k, unaries, karies); Set<ExIND> cliques = graph.getCliquesOfCurrentLevel(); validateINDs(cliques); Set<ExIND> validINDCandidates = new HashSet<>(); Set<ExIND> invalidINDCandidates = new HashSet<>(); cliques.forEach( clique -> (clique.isValid() ? validINDCandidates : invalidINDCandidates).add(clique)); validINDs.addAll(validINDCandidates); Set<ExIND> newKaries = getKaries(k + 1, invalidINDCandidates); validateINDs(newKaries); Set<ExIND> validNewKaries = newKaries.stream().filter(ExIND::isValid).collect(Collectors.toCollection(HashSet::new)); validINDs.addAll(genSubINDs(karies, validNewKaries, validINDs)); if (validNewKaries.size() < k + 1) { validINDs.addAll(validNewKaries); returnResults(validINDs); return; } karies = validNewKaries; } }
FIND2 { void execute() throws AlgorithmExecutionException { log.fine("Start of algorithm FIND2."); List<InclusionDependency> inputInds = inclusionDependencyInput.execute(); Set<ExIND> unaries = getUnaryINDs(inputInds); Set<ExIND> karies = getKaryINDs(config.getStartK(), inputInds); Set<ExIND> karies1 = karies; Set<ExIND> validINDs = unaries .stream() .filter(unary -> karies1.stream().noneMatch(kary -> kary.contains(unary))) .collect(Collectors.toCollection(HashSet::new)); unaries.removeAll(validINDs); for (int k = config.getStartK(); k < unaries.size(); k++) { Hypergraph graph = new Hypergraph(k, unaries, karies); Set<ExIND> cliques = graph.getCliquesOfCurrentLevel(); validateINDs(cliques); Set<ExIND> validINDCandidates = new HashSet<>(); Set<ExIND> invalidINDCandidates = new HashSet<>(); cliques.forEach( clique -> (clique.isValid() ? validINDCandidates : invalidINDCandidates).add(clique)); validINDs.addAll(validINDCandidates); Set<ExIND> newKaries = getKaries(k + 1, invalidINDCandidates); validateINDs(newKaries); Set<ExIND> validNewKaries = newKaries.stream().filter(ExIND::isValid).collect(Collectors.toCollection(HashSet::new)); validINDs.addAll(genSubINDs(karies, validNewKaries, validINDs)); if (validNewKaries.size() < k + 1) { validINDs.addAll(validNewKaries); returnResults(validINDs); return; } karies = validNewKaries; } } }
FIND2 { void execute() throws AlgorithmExecutionException { log.fine("Start of algorithm FIND2."); List<InclusionDependency> inputInds = inclusionDependencyInput.execute(); Set<ExIND> unaries = getUnaryINDs(inputInds); Set<ExIND> karies = getKaryINDs(config.getStartK(), inputInds); Set<ExIND> karies1 = karies; Set<ExIND> validINDs = unaries .stream() .filter(unary -> karies1.stream().noneMatch(kary -> kary.contains(unary))) .collect(Collectors.toCollection(HashSet::new)); unaries.removeAll(validINDs); for (int k = config.getStartK(); k < unaries.size(); k++) { Hypergraph graph = new Hypergraph(k, unaries, karies); Set<ExIND> cliques = graph.getCliquesOfCurrentLevel(); validateINDs(cliques); Set<ExIND> validINDCandidates = new HashSet<>(); Set<ExIND> invalidINDCandidates = new HashSet<>(); cliques.forEach( clique -> (clique.isValid() ? validINDCandidates : invalidINDCandidates).add(clique)); validINDs.addAll(validINDCandidates); Set<ExIND> newKaries = getKaries(k + 1, invalidINDCandidates); validateINDs(newKaries); Set<ExIND> validNewKaries = newKaries.stream().filter(ExIND::isValid).collect(Collectors.toCollection(HashSet::new)); validINDs.addAll(genSubINDs(karies, validNewKaries, validINDs)); if (validNewKaries.size() < k + 1) { validINDs.addAll(validNewKaries); returnResults(validINDs); return; } karies = validNewKaries; } } FIND2(FIND2Configuration config); }
FIND2 { void execute() throws AlgorithmExecutionException { log.fine("Start of algorithm FIND2."); List<InclusionDependency> inputInds = inclusionDependencyInput.execute(); Set<ExIND> unaries = getUnaryINDs(inputInds); Set<ExIND> karies = getKaryINDs(config.getStartK(), inputInds); Set<ExIND> karies1 = karies; Set<ExIND> validINDs = unaries .stream() .filter(unary -> karies1.stream().noneMatch(kary -> kary.contains(unary))) .collect(Collectors.toCollection(HashSet::new)); unaries.removeAll(validINDs); for (int k = config.getStartK(); k < unaries.size(); k++) { Hypergraph graph = new Hypergraph(k, unaries, karies); Set<ExIND> cliques = graph.getCliquesOfCurrentLevel(); validateINDs(cliques); Set<ExIND> validINDCandidates = new HashSet<>(); Set<ExIND> invalidINDCandidates = new HashSet<>(); cliques.forEach( clique -> (clique.isValid() ? validINDCandidates : invalidINDCandidates).add(clique)); validINDs.addAll(validINDCandidates); Set<ExIND> newKaries = getKaries(k + 1, invalidINDCandidates); validateINDs(newKaries); Set<ExIND> validNewKaries = newKaries.stream().filter(ExIND::isValid).collect(Collectors.toCollection(HashSet::new)); validINDs.addAll(genSubINDs(karies, validNewKaries, validINDs)); if (validNewKaries.size() < k + 1) { validINDs.addAll(validNewKaries); returnResults(validINDs); return; } karies = validNewKaries; } } FIND2(FIND2Configuration config);  }
FIND2 { void execute() throws AlgorithmExecutionException { log.fine("Start of algorithm FIND2."); List<InclusionDependency> inputInds = inclusionDependencyInput.execute(); Set<ExIND> unaries = getUnaryINDs(inputInds); Set<ExIND> karies = getKaryINDs(config.getStartK(), inputInds); Set<ExIND> karies1 = karies; Set<ExIND> validINDs = unaries .stream() .filter(unary -> karies1.stream().noneMatch(kary -> kary.contains(unary))) .collect(Collectors.toCollection(HashSet::new)); unaries.removeAll(validINDs); for (int k = config.getStartK(); k < unaries.size(); k++) { Hypergraph graph = new Hypergraph(k, unaries, karies); Set<ExIND> cliques = graph.getCliquesOfCurrentLevel(); validateINDs(cliques); Set<ExIND> validINDCandidates = new HashSet<>(); Set<ExIND> invalidINDCandidates = new HashSet<>(); cliques.forEach( clique -> (clique.isValid() ? validINDCandidates : invalidINDCandidates).add(clique)); validINDs.addAll(validINDCandidates); Set<ExIND> newKaries = getKaries(k + 1, invalidINDCandidates); validateINDs(newKaries); Set<ExIND> validNewKaries = newKaries.stream().filter(ExIND::isValid).collect(Collectors.toCollection(HashSet::new)); validINDs.addAll(genSubINDs(karies, validNewKaries, validINDs)); if (validNewKaries.size() < k + 1) { validINDs.addAll(validNewKaries); returnResults(validINDs); return; } karies = validNewKaries; } } FIND2(FIND2Configuration config);   }