首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >向GraphML数据库导入Neo4j

向GraphML数据库导入Neo4j
EN

Stack Overflow用户
提问于 2017-05-10 16:26:45
回答 1查看 344关注 0票数 0

我正在尝试使用Neo4j shell和新4j-外壳工具使用图my填充我的Neo4j数据库。

现在,我只是尝试导入以下示例图:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
        http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
    <key id="d0" for="node" attr.name="color" attr.type="string">
        <default>yellow</default>
    </key>
    <key id="d1" for="edge" attr.name="weight" attr.type="double"/>
    <graph id="G" edgedefault="undirected">
        <node id="n0">
            <data key="d0">green</data>
        </node>
        <node id="n1"/>
        <edge id="e0" source="n0" target="n1">
            <data key="d1">1.0</data>
        </edge>
    </graph>
</graphml>

该文件似乎导入得很好,导入后我会收到以下消息:

代码语言:javascript
复制
neo4j-sh (?)$ import-graphml -i "C:\Users\CZ82FF\Documents\graph_data\in.xml" -t -c
GraphML-Import file C:\Users\CZ82FF\Documents\graph_data\in.xml rel-type RELATED_TO batch-size 40000 use disk-cache true
finish after 3 row(s)  0. 99%: node
GraphML import created 3 entities.

但是,当我运行以下密码查询以返回neo4j中的所有节点时,不会返回任何内容:

代码语言:javascript
复制
MATCH (n) RETURN n
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-05-10 16:51:14

我发现我提供给新4j-shell的本地路径是不正确的,所以数据库文件是在错误的目录中创建的。

我最初的路径是到neo4j目录:

代码语言:javascript
复制
PS C:\Users\CZ82FF\Documents\neo4j> .\bin\neo4j-shell -path C:\Users\CZ82FF\Documents\neo4j\

相反,我需要提供到graph.db目录的路径:

代码语言:javascript
复制
PS C:\Users\CZ82FF\Documents\neo4j> .\bin\neo4j-shell -path C:\Users\CZ82FF\Documents\neo4j\data\databases\graph.db

我还必须停止neo4j服务,删除graph.db中的所有现有文件,并在重新启动neo4j服务之前运行shell命令。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43898070

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档