public void testReadJson() throws Exception { Graph graph3 = this.getGraphFactory().openGraph(this.getClass().getName() + "-graph-3"); XDIReader reader = XDIReaderRegistry.forFormat("XDI/JSON", null); reader.read(graph3, AbstractGraphTest.class.getResourceAsStream("test.json")).close(); testGraph(graph3); graph3.getRootContextNode().clear(); assertTrue(graph3.isEmpty()); graph3.close(); }
if (refRepTargetContextNode != null && ! operationResultGraph.isEmpty()) {
public void testIdentity() throws Exception { Graph graph = MemoryGraphFactory.getInstance().openGraph(); ContextNode contextNode = graph.getRootContextNode().setContextNode(XDIArc.create("=markus")); ContextNode identityContextNode = graph.getRootContextNode().setDeepContextNode(XDIAddress.create("=pseudo")); // test $is Equivalence.setIdentityContextNode(contextNode, identityContextNode); assertEquals(Equivalence.getIdentityContextNodes(contextNode).next(), identityContextNode); assertEquals(Equivalence.getIncomingIdentityContextNodes(identityContextNode).next(), contextNode); assertEquals(Equivalence.getIdentityRelations(contextNode).next(), contextNode.getRelation(XDIDictionaryConstants.XDI_ADD_IS)); assertEquals(Equivalence.getIncomingIdentityRelations(identityContextNode).next(), contextNode.getRelation(XDIDictionaryConstants.XDI_ADD_IS)); Equivalence.getIdentityContextNodes(contextNode).next().delete(); // done assertTrue(contextNode.isEmpty()); assertTrue(identityContextNode.isEmpty()); contextNode.delete(); assertTrue(graph.isEmpty()); graph.close(); }
assertTrue(replacementContextNode.isEmpty()); contextNode.delete(); assertTrue(graph.isEmpty());
assertTrue(root.isRootContextNode()); assertTrue(graph13.isEmpty()); assertTrue(root.isEmpty()); assertFalse(root.containsContextNodes());
assertTrue(graph30.isEmpty());