You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "stephen mallette (JIRA)" <ji...@apache.org> on 2015/05/23 01:10:17 UTC

[jira] [Commented] (TINKERPOP3-699) GraphSON writeGraph not producing valid json object

    [ https://issues.apache.org/jira/browse/TINKERPOP3-699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14556973#comment-14556973 ] 

stephen mallette commented on TINKERPOP3-699:
---------------------------------------------

When you serialize out an entire graph, the output is meant to be a stream - an adjacency list - that can be split easily for parallel consumption.  As such, it is not valid JSON as a whole - only as its independent parts.  

I will fix the IoCore/CoreIo issue - good find.  

> GraphSON writeGraph not producing valid json object
> ---------------------------------------------------
>
>                 Key: TINKERPOP3-699
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-699
>             Project: TinkerPop 3
>          Issue Type: Bug
>          Components: documentation
>            Reporter: Jim Lloyd
>             Fix For: 3.0.0.GA
>
>
> The following code in the M9-rc3 console produces an incorrect t.json file:
> gremlin> graph = TinkerFactory.createModern()
> ==>tinkergraph[vertices:6 edges:6]
> gremlin> g = graph.traversal()
> ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
> gremlin> f = new FileOutputStream("t.json")
> ==>java.io.FileOutputStream@7927bd9f
> gremlin> mapper = graph.io(IoCore.graphson()).mapper().embedTypes(true).create()
> ==>org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper@63f34b70
> gremlin> graph.io(IoCore.graphson()).writer().mapper(mapper).create().writeGraph(f, graph)
> ==>null
> gremlin> f.close()
> ==>null
> The file is a stream of independent vertices rather than a single json object following the GraphSON schema. I.e. the output looks like the this:
> {"id":1,"label":"person", ... }
> {"id":2,"label":"person", ... }
> {"id":3,"label":"software", ... }
> Where ... represents omitted fields.
> A separate issue but related issue is that the documentation examples use "CoreIo" but the actual name of that class is "IoCore", as shown in the console session above.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)