[ 
https://issues.apache.org/jira/browse/TINKERPOP3-699?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

stephen mallette updated TINKERPOP3-699:
----------------------------------------
    Issue Type: Improvement  (was: Bug)

I guess the guiding principle for TP3 has been to provide solutions that will 
scale on multi-billion+ edge graphs.  We've tried to do that everywhere that it 
makes sense to do so.  The old GraphSON that produced "valid JSON" didn't work 
so well in that regard and we determined a need for a JSON based format that 
was better represented as an adjacency list like Gryo - thus GraphSON became 
consistent with Gryo and would work on any size graph.  I think the fact that 
the GraphSON is not utterly valid is a reasonable consequence for this change 
and not terribly harmful, unless you just have a very small graph you intend to 
ship around.

That said, for that use case it might be useful to get some valid JSON from 
{{writeGraph()}} so that its easily consumable by other libs  An option on the 
{{GraphSONWriterBuilder}} to {{wrapAdjacencyListInObject}} would probably be an 
acceptable addition.  That would basically take "what we have now" and do:

{code}
{ "graph": [
   ...what we have now...
]}
{code}

The default would be to remain unwrapped.  An option on the 
{{GraphSONReaderBuilder}} would need to be added to signal that the JSON was in 
this format but perhaps it- could just be detected??  

Anyway, if you'd like to submit a pull request around an idea like this, please 
feel free to do so.  Tests should be added to {{IoTest}} to validate the 
operations of this features.

> GraphSON writeGraph not producing valid json object
> ---------------------------------------------------
>
>                 Key: TINKERPOP3-699
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-699
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: documentation
>            Reporter: Jim Lloyd
>            Assignee: stephen mallette
>             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)

Reply via email to