有没有办法在Neo4j Shell中列出* only * Node属性?

时间:2016-10-18 09:54:46

标签: neo4j neo4j-shell

例如,如果我有一个具有2个属性但超过100个关系的节点:

neo4j-sh (andrew,45982528)$ ls
*last_updated_millis =[1476768446691]
*name                =[andrew]
(me)<-[:REL]-(632456453)
(me)<-[:REL]-(478046914)
(me)<-[:REL]-(100979884)
(me)<-[:REL]-(629523704)
// ..... *snip* .....
(me)<-[:REL]-(320864107)
(me)<-[:REL]-(398667824)
(me)<-[:REL]-(611628243)
neo4j-sh (andrew,45982528)$

我是否可以向ls申请仅列出属性的命令或选项?

1 个答案:

答案 0 :(得分:1)

在neo4j-shell中有一个内联帮助:

neo4j-sh (?)$ help ls

Lists the contents of the current node or relationship. Optionally supply
node id for listing a certain node using "ls <node-id>".

  -a     Allows for cd:ing to a node not connected to the current node (e.g. 'absolute').
  -b     Brief summary instead of full content.
  -f     Filters property keys/values and relationship types. Supplied either as a single
     value or as a JSON string where both keys and values can contain regex.
     Starting/ending {} brackets are optional. Examples:
       "username"
        property/relationship 'username' gets listed
       ".*name:ma.*, age:''"
        properties with keys matching '.*name' and values matching 'ma.*' gets listed,
        as well as the 'age' property. Also relationships matching '.*name' or 'age'
        gets listed
       "KNOWS:out,LOVES:in"
        outgoing KNOWS and incoming LOVES relationships gets listed.
  -i     Filters are case-insensitive (case-sensitive by default).
  -l     Filters matches more loosely, i.e. it's considered a match if just a part of a
     value matches the pattern, not necessarily the whole value.
  -m     Display a maximum of M relationships per type (default 10 if no value given).
  -p     Lists properties.
  -q     Quiet mode.
  -r     Lists relationships.
  -s     Sorts relationships by type.
  -v     Verbose mode.

您可以使用ls -p

或者,您可以从Cypher查询返回节点:

MATCH (n) WHERE id(n) = 45982528 RETURN n;

将显示id和属性,可能是这样的:

+-------------------------------------------------------------------+
| n                                                                 |
+-------------------------------------------------------------------+
| Node[45982528]{name:"andrew", last_updated_millis: 1476768446691} |
+-------------------------------------------------------------------+
1 row
8 ms