/** * Returns a logical graph containing the complete vertex and edge space of * the database. * This is equivalent to {@link #getLogicalGraph(boolean) getLogicalGraph(true)}. * * @return logical graph of vertex and edge space */ public LogicalGraph getLogicalGraph() { return getLogicalGraph(true); }
/** * Returns a logical graph containing the complete vertex and edge space of * the database. * This is equivalent to {@link #getLogicalGraph(boolean) getLogicalGraph(true)}. * * @return logical graph of vertex and edge space */ public LogicalGraph getLogicalGraph() { return getLogicalGraph(true); }
/** * Tests whether edges are created properly according to Origin to New Vertex direction. * * @throws Exception If the data could not be loaded or collected properly. */ @Test public void edgeCreationOriginToNewTest() throws Exception { LogicalGraph social = getSocialNetworkLoader().getLogicalGraph(); testForEdgeDirection(social, EdgeDirection.ORIGIN_TO_NEWVERTEX); }
/** * Tests whether edges are created properly according to New Vertex to Origin direction. * * @throws Exception If the data could not be loaded or collected properly. */ @Test public void edgeCreationNewToOriginTest() throws Exception { LogicalGraph social = getSocialNetworkLoader().getLogicalGraph(); testForEdgeDirection(social, EdgeDirection.NEWVERTEX_TO_ORIGIN); }
/** * Tests whether edges are created properly according to bidrectional configuration. * * @throws Exception If the data could not be loaded or collected properly. */ @Test public void edgeCreationBidirectionalTest() throws Exception { LogicalGraph social = getSocialNetworkLoader().getLogicalGraph(); testForEdgeDirection(social, EdgeDirection.BIDIRECTIONAL); }
/** * Test writing a logical csv graph. * * @throws Exception if the execution or IO fails. */ @Test public void testWriteLogicalGraph() throws Exception { String tmpPath = temporaryFolder.getRoot().getPath(); LogicalGraph input = getSocialNetworkLoader().getLogicalGraph(true); checkIndexedCSVWrite(tmpPath, input); }
@Test public void testDistinctSourceIds() throws Exception { LogicalGraph db = getSocialNetworkLoader().getLogicalGraph(); Long result = new DistinctSourceIds() .execute(db) .collect() .get(0); assertThat(result, is(8L)); }
@Test public void testEdgeCount() throws Exception { LogicalGraph db = getSocialNetworkLoader().getLogicalGraph(); Long edgeCount = new EdgeCount() .execute(db) .collect() .get(0); assertThat(edgeCount, is(24L)); }
@Test public void testDistinctTargetIds() throws Exception { LogicalGraph db = getSocialNetworkLoader().getLogicalGraph(); Long result = new DistinctTargetIds() .execute(db) .collect() .get(0); assertThat(result, is(7L)); }
@Before public void setUp() throws Exception { socialNetwork = getSocialNetworkLoader().getLogicalGraph(); String path = getFilePath("/data/json/sna/statistics"); socialNetworkStatistics = GraphStatisticsLocalFSReader.read(path); }
@Test public void testWriteDistinctSourceVertexCount() throws Exception { String tmpPath = temporaryFolder.getRoot().getPath(); LogicalGraph input = getSocialNetworkLoader().getLogicalGraph(true); DataSink statisticDataSink = new GraphStatisticsDataSink(tmpPath); statisticDataSink.write(input, true); getExecutionEnvironment().execute(); GraphStatistics statistics = GraphStatisticsLocalFSReader.read(tmpPath); assertThat(statistics.getDistinctSourceVertexCount(), is(8L)); }
@Test public void testWriteDistinctTargetVertexCount() throws Exception { String tmpPath = temporaryFolder.getRoot().getPath(); LogicalGraph input = getSocialNetworkLoader().getLogicalGraph(true); DataSink statisticDataSink = new GraphStatisticsDataSink(tmpPath); statisticDataSink.write(input, true); getExecutionEnvironment().execute(); GraphStatistics statistics = GraphStatisticsLocalFSReader.read(tmpPath); assertThat(statistics.getDistinctTargetVertexCount(), is(7L)); }
@Test public void testWriteVertexCountByLabel() throws Exception { String tmpPath = temporaryFolder.getRoot().getPath(); LogicalGraph input = getSocialNetworkLoader().getLogicalGraph(true); DataSink statisticDataSink = new GraphStatisticsDataSink(tmpPath); statisticDataSink.write(input, true); getExecutionEnvironment().execute(); GraphStatistics statistics = GraphStatisticsLocalFSReader.read(tmpPath); assertThat(statistics.getVertexCount("Person"), is(6L)); assertThat(statistics.getVertexCount("Forum"), is(2L)); assertThat(statistics.getVertexCount("Tag"), is(3L)); }
@Test public void testWriteVertexCount() throws Exception { String tmpPath = temporaryFolder.getRoot().getPath(); LogicalGraph input = getSocialNetworkLoader().getLogicalGraph(true); DataSink statisticDataSink = new GraphStatisticsDataSink(tmpPath); statisticDataSink.write(input, true); getExecutionEnvironment().execute(); GraphStatistics statistics = GraphStatisticsLocalFSReader.read(tmpPath); assertThat(statistics.getVertexCount(), is(11L)); }
@Test public void testWriteDistinctPropertyValuesByEdgeLabelAndPropertyName() throws Exception { String tmpPath = temporaryFolder.getRoot().getPath(); LogicalGraph input = getSocialNetworkLoader().getLogicalGraph(true); DataSink statisticDataSink = new GraphStatisticsDataSink(tmpPath); statisticDataSink.write(input, true); getExecutionEnvironment().execute(); GraphStatistics statistics = GraphStatisticsLocalFSReader.read(tmpPath); assertThat(statistics.getDistinctEdgeProperties("knows", "since"), is(3L)); assertThat(statistics.getDistinctEdgeProperties("hasModerator", "since"), is(1L)); }
@Test public void testWriteDistinctEdgePropertyValuesByPropertyName() throws Exception { String tmpPath = temporaryFolder.getRoot().getPath(); LogicalGraph input = getSocialNetworkLoader().getLogicalGraph(true); DataSink statisticDataSink = new GraphStatisticsDataSink(tmpPath); statisticDataSink.write(input, true); getExecutionEnvironment().execute(); GraphStatistics statistics = GraphStatisticsLocalFSReader.read(tmpPath); assertThat(statistics.getDistinctEdgeProperties("since"), is(3L)); }
@Test public void testWriteEdgeCount() throws Exception { String tmpPath = temporaryFolder.getRoot().getPath(); LogicalGraph input = getSocialNetworkLoader().getLogicalGraph(true); DataSink statisticDataSink = new GraphStatisticsDataSink(tmpPath); statisticDataSink.write(input, true); getExecutionEnvironment().execute(); GraphStatistics statistics = GraphStatisticsLocalFSReader.read(tmpPath); assertThat(statistics.getEdgeCount(), is(24L)); }
/** * Common test-case. * * @throws Exception Exception thrown by graph loading */ @Test public void samplingTest() throws Exception { LogicalGraph dbGraph = getSocialNetworkLoader().getLogicalGraph(); LogicalGraph newGraph = getSamplingOperator().sample(dbGraph); validateGraph(dbGraph, newGraph); validateSpecific(dbGraph, newGraph); }
@Test public void testGetVertices() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); Collection<Vertex> inputVertices = loader.getVertices(); List<Vertex> outputVertices = loader.getLogicalGraph(false).getVertices().collect(); validateEPGMElementCollections(inputVertices, outputVertices); validateEPGMGraphElementCollections(inputVertices, outputVertices); }
@Test public void testGetEdges() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); Collection<Edge> inputEdges = loader.getEdges(); List<Edge> outputEdges = loader.getLogicalGraph(false).getEdges().collect(); validateEPGMElementCollections(inputEdges, outputEdges); validateEPGMGraphElementCollections(inputEdges, outputEdges); } }