问题标签 [graphson]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
330 浏览

gremlin - 如何使用远程遍历生成用于导出的 GraphSON 数据?

示例代码(JAVA):

我正在尝试使用远程服务器将 Graph 导出为 GraphSON。但 IO 步骤不提供远程导出功能。使用 GraphSonWriter,它不会正确写入内容。如何使用远程服务器环境以 GraphSON 格式导出图形?

谢谢你。

0 投票
0 回答
56 浏览

java - 使用 g:Set 时的 GraphSON 反序列化错误

我有以下名为 GraphSON 的文件input.json

在 Java 中,我尝试org.apache.tinkerpop.tinkergraph-gremlin:3.4.10使用以下代码将上述 GraphSON 文件加载到内存图 ( ) 中:

但是,运行时遇到以下反序列化错误:

如果我在 GraphSON 文件中更改{"@type":"g:Set","@value":[]}[],我不再收到错误,但现在图中的值是 aList而不是 a Set

这是我能找到的关于该主题的唯一文档,但它并没有帮助我找到解决方案: http: //tinkerpop.apache.org/docs/3.4.1/dev/io/#_set

我试图g:Set通过以编程方式创建图形然后将其写入文件来让序列化程序为我创建一个有效属性,但生成的文件不包含g:Set,而是List

我错过了什么?

0 投票
1 回答
74 浏览

gremlin - JanusGraph 3.x graphson 导入在美化 json 上失败

将美化的 json/graphson 导入 JanusGraph 是否有其他人有此问题?

完全相同但未美化的文件(无回车、制表符、空格)将完美导入,但如果美化它会失败并出现以下错误:

graph.io(graphson()).readGraph("data/tgraph2.json")

Could not deserialize the JSON value as required. Nested exception: java.lang.InstantiationException: Cannot deserialize the value with the detected type contained in the JSON ('tinker:graph') to the type specified in parameter to the object mapper (class java.util.LinkedHashMap). Those types are incompatible. at [Source: (ByteArrayInputStream); line: 1, column: 3]

请注意,编辑文件以手动删除第一个换行符并将错误消息更改为... at [Source: (ByteArrayInputStream); line: 1, column: 12]etc - 所以这绝对是文件中的空格问题。

版本 3.x

当然,这不是理想的行为。无论是用空格美化还是缩小,json 都应该同样有效。