public static void GetNodeByAutoIndex(String ki)
{
// String txUri=SERVER_ROOT_URI+"index/node/node_auto_index/name/"+ki;
String txUri=SERVER_ROOT_URI+"index/auto/node/ki/"+ki;
WebResource resource = Client.create().resource(txUri);
ClientResponse response = resource.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
System.out.println(response.getStatus());
System.out.println(response.getEntity(String.class));
response.close();
}
public static void GetRelationshipByAutoIndex(String ki)
{
// String txUri=SERVER_ROOT_URI+"index/node/node_auto_index/name/"+ki;
String txUri=SERVER_ROOT_URI+"index/auto/relationship/ki/"+ki;
WebResource resource = Client.create().resource(txUri);
ClientResponse response = resource.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
System.out.println(response.getStatus());
System.out.println(response.getEntity(String.class));
response.close();
}
关系的输出结果为:
[ {
"extensions" : { },
"metadata" : {
"id" : 337,
"type" : "家人"
},
"data" : {
"name" : "无",
"ki" : "1234567890"
},
"property" : "http://192.168.209.128:7474/db/data/relationship/337/properties/{key}",
"start" : "http://192.168.209.128:7474/db/data/node/171391",
"self" : "http://192.168.209.128:7474/db/data/relationship/337",
"end" : "http://192.168.209.128:7474/db/data/node/171392",
"type" : "家人",
"properties" : "http://192.168.209.128:7474/db/data/relationship/337/properties"
} ]
这里说明一下,传值为中文的时候,查询不出来,可能需要编码,因为工作暂时没有用到,就没有再研究了
Neo4j生成测试数据
Neo4J图数据库实践系列
图数据库实践系列 (三)--Neo4j Spatial的REST集成