@Test public void test4() { Graph tc1 = new SimpleGraph(); tc1.add(new TripleImpl(u1, u1, new BlankNode())); Graph tc2 = new SimpleGraph(); tc2.add(new TripleImpl(u1, u1, new BlankNode())); final Map<BlankNode, BlankNode> mapping = GraphMatcher.getValidMapping(tc1, tc2); Assert.assertNotNull(mapping); Assert.assertEquals(1, mapping.size()); }
public static Map<BlankNode, BlankNode> getValidMapping(Graph og1, Graph og2) { Graph g1 = new SimpleGraph(og1); Graph g2 = new SimpleGraph(og2); if (!Utils.removeGrounded(g1, g2)) { return null; } final HashMatching hashMatching; try { hashMatching = new HashMatching(g1, g2); } catch (GraphNotIsomorphicException ex) { return null; } Map<BlankNode, BlankNode> matchings = hashMatching.getMatchings(); if (g1.size() > 0) { Map<BlankNode, BlankNode> remainingMappings = trialAndErrorMatching(g1, g2, hashMatching.getMatchingGroups()); if (remainingMappings == null) { return null; } else { matchings.putAll(remainingMappings); } } return matchings; }
GraphMatcher { public static Map<BlankNode, BlankNode> getValidMapping(Graph og1, Graph og2) { Graph g1 = new SimpleGraph(og1); Graph g2 = new SimpleGraph(og2); if (!Utils.removeGrounded(g1, g2)) { return null; } final HashMatching hashMatching; try { hashMatching = new HashMatching(g1, g2); } catch (GraphNotIsomorphicException ex) { return null; } Map<BlankNode, BlankNode> matchings = hashMatching.getMatchings(); if (g1.size() > 0) { Map<BlankNode, BlankNode> remainingMappings = trialAndErrorMatching(g1, g2, hashMatching.getMatchingGroups()); if (remainingMappings == null) { return null; } else { matchings.putAll(remainingMappings); } } return matchings; } }
GraphMatcher { public static Map<BlankNode, BlankNode> getValidMapping(Graph og1, Graph og2) { Graph g1 = new SimpleGraph(og1); Graph g2 = new SimpleGraph(og2); if (!Utils.removeGrounded(g1, g2)) { return null; } final HashMatching hashMatching; try { hashMatching = new HashMatching(g1, g2); } catch (GraphNotIsomorphicException ex) { return null; } Map<BlankNode, BlankNode> matchings = hashMatching.getMatchings(); if (g1.size() > 0) { Map<BlankNode, BlankNode> remainingMappings = trialAndErrorMatching(g1, g2, hashMatching.getMatchingGroups()); if (remainingMappings == null) { return null; } else { matchings.putAll(remainingMappings); } } return matchings; }  }
GraphMatcher { public static Map<BlankNode, BlankNode> getValidMapping(Graph og1, Graph og2) { Graph g1 = new SimpleGraph(og1); Graph g2 = new SimpleGraph(og2); if (!Utils.removeGrounded(g1, g2)) { return null; } final HashMatching hashMatching; try { hashMatching = new HashMatching(g1, g2); } catch (GraphNotIsomorphicException ex) { return null; } Map<BlankNode, BlankNode> matchings = hashMatching.getMatchings(); if (g1.size() > 0) { Map<BlankNode, BlankNode> remainingMappings = trialAndErrorMatching(g1, g2, hashMatching.getMatchingGroups()); if (remainingMappings == null) { return null; } else { matchings.putAll(remainingMappings); } } return matchings; }  static Map<BlankNode, BlankNode> getValidMapping(Graph og1, Graph og2); }
GraphMatcher { public static Map<BlankNode, BlankNode> getValidMapping(Graph og1, Graph og2) { Graph g1 = new SimpleGraph(og1); Graph g2 = new SimpleGraph(og2); if (!Utils.removeGrounded(g1, g2)) { return null; } final HashMatching hashMatching; try { hashMatching = new HashMatching(g1, g2); } catch (GraphNotIsomorphicException ex) { return null; } Map<BlankNode, BlankNode> matchings = hashMatching.getMatchings(); if (g1.size() > 0) { Map<BlankNode, BlankNode> remainingMappings = trialAndErrorMatching(g1, g2, hashMatching.getMatchingGroups()); if (remainingMappings == null) { return null; } else { matchings.putAll(remainingMappings); } } return matchings; }  static Map<BlankNode, BlankNode> getValidMapping(Graph og1, Graph og2);  }