2013-02-06 75 views
1
請求超過 Neo4j數據,如,說的時候

如何減少neo4j查詢中的數據量?

curl -i -XPOST -d'{ "query" : "start n=node(*) return n" }' 
    -H "accept:application/json;stream=true" 
    -H content-type:application/json 
    http://localhost:7474/db/data/cypher 

我得到的,如記錄,這樣的迴應:

{ 
    "columns" : [ "n" ], 
    "data" : [ [ { 
    "outgoing_relationships" : "http://localhost:7474/db/data/node/0/relationships/out", 
    "data" : { 
    }, 
    "traverse" : "http://localhost:7474/db/data/node/0/traverse/{returnType}", 
    "all_typed_relationships" : "http://localhost:7474/db/data/node/0/relationships/all/{-list|&|types}", 
    "property" : "http://localhost:7474/db/data/node/0/properties/{key}", 
    "self" : "http://localhost:7474/db/data/node/0", 
    "properties" : "http://localhost:7474/db/data/node/0/properties", 
    "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/0/relationships/out/{-list|&|types}", 
    "incoming_relationships" : "http://localhost:7474/db/data/node/0/relationships/in", 
    "extensions" : { 
    }, 
    "create_relationship" : "http://localhost:7474/db/data/node/0/relationships", 
    "paged_traverse" : "http://localhost:7474/db/data/node/0/paged/traverse/{returnType}{?pageSize,leaseTime}", 
    "all_relationships" : "http://localhost:7474/db/data/node/0/relationships/all", 
    "incoming_typed_relationships" : "http://localhost:7474/db/data/node/0/relationships/in/{-list|&|types}" 
    } ], [ { 
    "outgoing_relationships" : "http://localhost:7474/db/data/node/1/relationships/out", 
    "data" : { 
     "glyph" : "一", 
     "~isa" : "glyph" 
    }, 
    "traverse" : "http://localhost:7474/db/data/node/1/traverse/{returnType}", 
    "all_typed_relationships" : "http://localhost:7474/db/data/node/1/relationships/all/{-list|&|types}", 
    "property" : "http://localhost:7474/db/data/node/1/properties/{key}", 
    "self" : "http://localhost:7474/db/data/node/1", 
    "properties" : "http://localhost:7474/db/data/node/1/properties", 
    "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/1/relationships/out/{-list|&|types}", 
    "incoming_relationships" : "http://localhost:7474/db/data/node/1/relationships/in", 
    "extensions" : { 
    }, 
    "create_relationship" : "http://localhost:7474/db/data/node/1/relationships", 
    "paged_traverse" : "http://localhost:7474/db/data/node/1/paged/traverse/{returnType}{?pageSize,leaseTime}", 
    "all_relationships" : "http://localhost:7474/db/data/node/1/relationships/all", 
    "incoming_typed_relationships" : "http://localhost:7474/db/data/node/1/relationships/in/{-list|&|types}" 
    } ], [ { 
    "outgoing_relationships" : "http://localhost:7474/db/data/node/2/relationships/out", 
    "data" : { 
     "~isa" : "LPG", 
     "LPG" : "1" 
    }, 
    "traverse" : "http://localhost:7474/db/data/node/2/traverse/{returnType}", 
    "all_typed_relationships" : "http://localhost:7474/db/data/node/2/relationships/all/{-list|&|types}", 
    "property" : "http://localhost:7474/db/data/node/2/properties/{key}", 
    "self" : "http://localhost:7474/db/data/node/2", 
    "properties" : "http://localhost:7474/db/data/node/2/properties", 
    "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/2/relationships/out/{-list|&|types}", 
    "incoming_relationships" : "http://localhost:7474/db/data/node/2/relationships/in", 
    "extensions" : { 
    }, 
    "create_relationship" : "http://localhost:7474/db/data/node/2/relationships", 
    "paged_traverse" : "http://localhost:7474/db/data/node/2/paged/traverse/{returnType}{?pageSize,leaseTime}", 
    "all_relationships" : "http://localhost:7474/db/data/node/2/relationships/all", 
    "incoming_typed_relationships" : "http://localhost:7474/db/data/node/2/relationships/in/{-list|&|types}" 
    } ], [ { 

等而上。隨每個節點交付的URL肯定是好的,但它們也佔據了傳輸數據的主要部分。他們也是高度多餘的,而不是我的,在我的查詢之後。有沒有什麼辦法來拋棄所有traverse的, all_typed_relationshipspropertyselfpropertiesoutgoing_typed_relationshipsincoming_relationshipsextensionscreate_relationshippaged_traverseall_relationshipsincoming_typed_relationships 爵士樂嗎?

回答

2

唯一的方法是指定return語句中返回的屬性。如:

return id(n), n.glyph; 
+0

我會等一天左右讓別人在接受您的貢獻之前告訴我們即將進行的API更新,但從我的最佳知識來看,這是正確的答案。 – flow

+0

實際上在github上有關於從最近就改進這個問題的討論。 https://github.com/neo4j/neo4j/issues/414 –