/** * Answer true if the given enhanced graph contains the same nodes and * edges as this graph. The default implementation delegates this to the * underlying graph objects. * * @param eg A graph to test * @return True if eg is a graph with the same structure as this. */ final public boolean isIsomorphicWith(EnhGraph eg) { return graph.isIsomorphicWith(eg.graph); }
@Override public boolean isIsomorphicWith(Graph g) { return graph.isIsomorphicWith(g) ; }
/** * Answer true if the given enhanced graph contains the same nodes and * edges as this graph. The default implementation delegates this to the * underlying graph objects. * * @param eg A graph to test * @return True if eg is a graph with the same structure as this. */ final public boolean isIsomorphicWith(EnhGraph eg) { return graph.isIsomorphicWith(eg.graph); }
@Override public boolean isIsomorphicWith( Graph g ) { return base.isIsomorphicWith( g ); }
@Override public boolean isIsomorphicWith(Graph arg0) { return graph.isIsomorphicWith(arg0); }
@Override public boolean isIsomorphicWith(Graph arg0) { return g.isIsomorphicWith(arg0); }
@Override public boolean isIsomorphicWith(Graph arg0) { try { regenerateIfClosed(); return g.isIsomorphicWith(arg0); } catch (Exception e) { regenerate(); return g.isIsomorphicWith(arg0); } }
/** Answer whether or not these two graphs are isomorphic. */ @Override public boolean isIsomorphicWith( Model m ) { Graph L = this.getGraph(); Graph R = m.getGraph(); return L.isIsomorphicWith( R ); }
/** Answer whether or not these two graphs are isomorphic. */ @Override public boolean isIsomorphicWith( Model m ) { Graph L = this.getGraph(); Graph R = m.getGraph(); return L.isIsomorphicWith( R ); }
@Test public void post_01() { DatasetGraphAccessor updater = getDatasetUpdater() ; updater.httpPost(graph1) ; updater.httpPost(graph2) ; Graph graph = updater.httpGet() ; Graph graph3 = GraphFactory.createDefaultGraph() ; GraphUtil.addInto(graph3, graph1) ; GraphUtil.addInto(graph3, graph2) ; assertTrue(graph.isIsomorphicWith(graph3)) ; assertFalse(graph.isIsomorphicWith(graph1)) ; assertFalse(graph.isIsomorphicWith(graph2)) ; }
/** * Assert that the supplied graph <code>got</code> is isomorphic with the * the desired graph <code>expected</code>; if not, display a readable * description of both graphs. */ public static void assertIsomorphic(String title, Graph expected, Graph got) { if (!expected.isIsomorphicWith(got)) { Map<Node, Object> map = CollectionFactory.createHashedMap(); fail(title + ": wanted " + nice(expected, map) + "\nbut got " + nice(got, map)); } }
/** Assert that the supplied graph <code>got</code> is isomorphic with the the desired graph <code>expected</code>; if not, display a readable description of both graphs. */ public static void assertIsomorphic( String title, Graph expected, Graph got ) { if (!expected.isIsomorphicWith( got )) { Map<Node, Object> map = CollectionFactory.createHashedMap(); fail( title + ": wanted " + nice( expected, map ) + "\nbut got " + nice( got, map ) ); } }
/** * Assert that the supplied graph <code>got</code> is isomorphic with the * the desired graph <code>expected</code>; if not, display a readable * description of both graphs. */ public static void assertIsomorphic(String title, Graph expected, Graph got) { if (!expected.isIsomorphicWith(got)) { Map<Node, Object> map = CollectionFactory.createHashedMap(); fail(title + ": wanted " + nice(expected, map) + "\nbut got " + nice(got, map)); } }
private void test (Graph g) { ByteArrayOutputStream bout = serializeAsJSON(g) ; parseAsJSON(bout) ; // make sure valid JSON Graph g2 = parseAsRDFJSON(bout) ; assertTrue(g.isIsomorphicWith(g2)) ; }
/** Assert that the supplied graph <code>got</code> is isomorphic with the the desired graph <code>expected</code>; if not, display a readable description of both graphs. */ public static void assertIsomorphic( String title, Graph expected, Graph got ) { if (!expected.isIsomorphicWith( got )) { Map<Node, Object> map = CollectionFactory.createHashedMap(); fail( title + ": wanted " + nice( expected, map ) + "\nbut got " + nice( got, map ) ); } }
@Test public void put_01() { DatasetGraphAccessor updater = getDatasetUpdater() ; updater.httpPut(graph1) ; Graph graph = updater.httpGet() ; assertNotNull("Graph is null", graph) ; assertTrue(graph.isIsomorphicWith(graph1)) ; }
@Test public void put_02() { DatasetGraphAccessor updater = getDatasetUpdater() ; updater.httpPut(n1, graph1) ; Graph graph = updater.httpGet() ; assertNullOrEmpty(graph) ; graph = updater.httpGet(n1) ; assertNotNull("Graph is null", graph) ; assertTrue(graph.isIsomorphicWith(graph1)) ; }
@Test public void nt_model_1() { Model m1 = parseToModel("<x> <p> \"abc-\\u00E9\". "); assertEquals(1, m1.size()); Model m2 = parseToModel("<x> <p> \"abc-\\u00E9\". "); assertTrue(m1.isIsomorphicWith(m2)); Graph g1 = SSE.parseGraph("(graph (triple <x> <p> \"abc-é\"))"); assertTrue(g1.isIsomorphicWith(m1.getGraph())); }
@Test public void testUpdateScript5() { DatasetGraph gStore = getEmptyDatasetGraph() ; script(gStore, "data-2.ru") ; Graph g = GraphFactory.createPlainGraph() ; Node b = org.apache.jena.graph.NodeFactory.createBlankNode() ; g.add(new Triple(s, p, b)) ; g.add(new Triple(b, q, v)) ; assertTrue(g.isIsomorphicWith(gStore.getDefaultGraph())) ; }
@Test public void testDifference() { final Graph g1 = parseGraph("(graph (triple <s1> <p1> <o1> ))"); final DatasetGraph dsg1 = DatasetGraphFactory.create(g1); final Node graphName1 = NodeFactory.createBlankNode(); dsg1.addGraph(graphName1, g1); final Graph g2 = parseGraph("(graph (triple <s2> <p2> <o2> ))"); final DatasetGraph dsg2 = DatasetGraphFactory.create(g2); final Node graphName2 = NodeFactory.createBlankNode(); dsg2.addGraph(graphName2, g2); DatasetGraph dsg = testInstance(dsg1, dsg2, Context.emptyContext); assertEquals(1, dsg.size()); assertTrue(g1.isIsomorphicWith(dsg.getGraph(graphName1))); assertTrue(g1.isIsomorphicWith(dsg.getDefaultGraph())); assertTrue(dsg.getGraph(graphName2).isEmpty()); }