Examples of writeGraph()


Examples of com.tinkerpop.gremlin.structure.io.GraphWriter.writeGraph()

        final GraphWriter writer = GraphSONWriter.build()
                .embedTypes(true)
                .customModule(module).create();

        try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
            writer.writeGraph(baos, g);

            final JsonNode jsonGraph = new ObjectMapper().readTree(baos.toByteArray());
            final JsonNode onlyVertex = jsonGraph.findValues(GraphSONTokens.VERTICES).get(0).get(0);
            final JsonNode idValue = onlyVertex.get(GraphSONTokens.ID);
            assertTrue(idValue.has("cluster"));
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.io.GraphWriter.writeGraph()

        @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
        @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
        public void writeGraphML() throws Exception {
            final GraphWriter writer = GraphMLWriter.build().create();
            final OutputStream os = new ByteArrayOutputStream();
            writer.writeGraph(os, g);
        }

        @Test
        @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
        @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.io.GraphWriter.writeGraph()

        @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
        @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
        public void writeGraphSON() throws Exception {
            final GraphWriter writer = GraphSONWriter.build().create();
            final OutputStream os = new ByteArrayOutputStream();
            writer.writeGraph(os, g);
        }
    }

    private static void tryBatchCommit(final Graph g, int ix) {
        if (g.features().graph().supportsTransactions() && ix % 1000 == 0)
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.io.GraphWriter.writeGraph()

        @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
        @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
        public void writeKryo() throws Exception {
            final GraphWriter writer = KryoWriter.build().create();
            final OutputStream os = new ByteArrayOutputStream();
            writer.writeGraph(os, g);
        }

        @Test
        @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
        @BenchmarkOptions(benchmarkRounds = 10, warmupRounds = 0, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter.writeGraph()

    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
    @LoadGraphWith(LoadGraphWith.GraphData.CLASSIC)
    public void shouldWriteNormalizedGraphML() throws Exception {
        try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
            final GraphMLWriter w = GraphMLWriter.build().normalize(true).create();
            w.writeGraph(bos, g);

            final String expected = streamToString(IoTest.class.getResourceAsStream(GRAPHML_RESOURCE_PATH_PREFIX + "tinkerpop-classic-normalized.xml"));
            assertEquals(expected.replace("\n", "").replace("\r", ""), bos.toString().replace("\n", "").replace("\r", ""));
        }
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter.writeGraph()

        final GraphMLWriter w = GraphMLWriter.build().create();

        final File f = File.createTempFile("test", "txt");
        try (final OutputStream out = new FileOutputStream(f)) {
            w.writeGraph(out, g);
        }

        validateXmlAgainstGraphMLXsd(f);

        // reusing the same config used for creation of "g".
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter.writeGraph()

    public void shouldWriteNormalizedGraphSON() throws Exception {
        try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
            final GraphSONWriter w = GraphSONWriter.build()
                    .customModule(graphProvider.createConfiguredGraphSONModule())
                    .normalize(true).create();
            w.writeGraph(bos, g);

            final String expected = streamToString(IoTest.class.getResourceAsStream(GRAPHSON_RESOURCE_PATH_PREFIX + "tinkerpop-classic-normalized.json"));
            assertEquals(expected.replace("\n", "").replace("\r", ""), bos.toString().replace("\n", "").replace("\r", ""));
        }
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter.writeGraph()

    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
    public void shouldReadWriteClassicToGraphSON() throws Exception {
        try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
            final GraphSONWriter writer = GraphSONWriter.build().customModule(graphProvider.createConfiguredGraphSONModule()).create();
            writer.writeGraph(os, g);

            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
            graphProvider.clear(configuration);
            final Graph g1 = graphProvider.openTestGraph(configuration);
            final GraphSONReader reader = GraphSONReader.build().customModule(graphProvider.createConfiguredGraphSONModule()).create();
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter.writeGraph()

    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
    public void shouldReadWriteModernToGraphSON() throws Exception {
        try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
            final GraphSONWriter writer = GraphSONWriter.build().customModule(graphProvider.createConfiguredGraphSONModule()).create();
            writer.writeGraph(os, g);

            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
            graphProvider.clear(configuration);
            final Graph g1 = graphProvider.openTestGraph(configuration);
            final GraphSONReader reader = GraphSONReader.build().customModule(graphProvider.createConfiguredGraphSONModule()).create();
View Full Code Here

Examples of com.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter.writeGraph()

    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
    public void shouldReadWriteCrewToGraphSON() throws Exception {
        try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
            final GraphSONWriter writer = GraphSONWriter.build().customModule(graphProvider.createConfiguredGraphSONModule()).create();
            writer.writeGraph(os, g);

            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
            graphProvider.clear(configuration);
            final Graph g1 = graphProvider.openTestGraph(configuration);
            final GraphSONReader reader = GraphSONReader.build().customModule(graphProvider.createConfiguredGraphSONModule()).create();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.