2014-03-14 49 views
0

我想構建一個Cypher查詢來測試是否存在特定的結構,因此我可以將日期與它關聯。Neo4j Cypher查詢失敗,並返回一個未知的錯誤

運行的Neo4j 2.1.0-M01在Linux服務器上,而是發生與Neo4j的2.0.1

我們開始用乾淨的數據庫,0節點的相同問題。

首先我運行這個MATCH查詢來證明它運行。 顯然這個查詢不會返回任何節點。但是在創建節點後,將會發生 失敗並顯示「未知錯誤」。 對我來說這看起來像一個bug,因爲具有較少節點的查詢將返回。有沒有人有建議如何現在重寫這個查詢?

對不起,這個帖子中有大量的代碼。

感謝,

-Edwin

的Cypher查詢:

MATCH (c:Cluster{cluster_name:'mycluster',cluster_uuid:'7bd4f66d-5faf-11db-8d0d-000e0cba569c'}) ,(sc1:Controller{serialnumber:'7000610071',system_id:'1873784171',hostname:'node01',node_uuid:'7cd70205-66ae-11e0-a4a9-0deba859517d'}) ,(sc1)-[:IS_PART_OF_CLUSTER]->(c) ,(sc2:Controller{serialnumber:'7000606111',system_id:'1873778118',hostname:'node02',node_uuid:'b954f0a1-6682-11e0-b8a0-517da924923d'}) ,(sc2)-[:IS_PART_OF_CLUSTER]->(c) ,(sc3:Controller{serialnumber:'7000561878',system_id:'1873772083',hostname:'node03',node_uuid:'ac293586-6690-11e0-b8a0-517da924923d'}) ,(sc3)-[:IS_PART_OF_CLUSTER]->(c) ,(sc4:Controller{serialnumber:'800000075807',system_id:'1873784143',hostname:'node04',node_uuid:'e8d6c7e5-663e-11e0-b8a0-517da924923d'}) ,(sc4)-[:IS_PART_OF_CLUSTER]->(c) ,(sc5:Controller{serialnumber:'7000477261',system_id:'1873745662',hostname:'node05',node_uuid:'1d1ecc64-728c-11e0-bf0e-3d25383f7ed3'}) ,(sc5)-[:IS_PART_OF_CLUSTER]->(c) ,(sc6:Controller{serialnumber:'7000477273',system_id:'1873745654',hostname:'node06',node_uuid:'140fb0f9-728c-11e0-afeb-49fcf0b6e6c3'}) ,(sc6)-[:IS_PART_OF_CLUSTER]->(c) ,(sc7:Controller{serialnumber:'7000474908',system_id:'1873745665',hostname:'node07',node_uuid:'edbf9c62-728b-11e0-bf0e-3d25383f7ed3'}) ,(sc7)-[:IS_PART_OF_CLUSTER]->(c) ,(sc8:Controller{serialnumber:'7000474910',system_id:'1873745695',hostname:'node08',node_uuid:'20dbfe67-7832-11e0-afeb-49fcf0b6e6c3'}) ,(sc8)-[:IS_PART_OF_CLUSTER]->(c) ,(sc9:Controller{serialnumber:'7000609864',system_id:'1873802756',hostname:'node09',node_uuid:'a8b75397-6690-11e0-b8a0-517da924923d'}) ,(sc9)-[:IS_PART_OF_CLUSTER]->(c) ,(sc10:Controller{serialnumber:'7000610021',system_id:'1873791030',hostname:'node10',node_uuid:'f6cf0705-6670-11e0-b8a0-517da924923d'}) ,(sc10)-[:IS_PART_OF_CLUSTER]->(c) ,(sc11:Controller{serialnumber:'7000610057',system_id:'1873784128',hostname:'node11',node_uuid:'551b1bf8-663d-11e0-b8a0-517da924923d'}) ,(sc11)-[:IS_PART_OF_CLUSTER]->(c) ,(sc12:Controller{serialnumber:'7000609981',system_id:'1873778164',hostname:'node12',node_uuid:'f6062d6c-663e-11e0-9b53-cd0ece6aa2ce'}) ,(sc12)-[:IS_PART_OF_CLUSTER]->(c) ,(sc13:Controller{serialnumber:'7000610033',system_id:'1873778186',hostname:'node13',node_uuid:'ed0e61c5-6670-11e0-b07f-933da0385fdc'}) ,(sc13)-[:IS_PART_OF_CLUSTER]->(c) ,(sc14:Controller{serialnumber:'7000610069',system_id:'1873784175',hostname:'node14',node_uuid:'8623ea28-66ae-11e0-ab9d-5fdc7f30dee7'}) ,(sc14)-[:IS_PART_OF_CLUSTER]->(c) ,(sc15:Controller{serialnumber:'7000606109',system_id:'1873778197',hostname:'node15',node_uuid:'b4349a83-6682-11e0-ab9d-5fdc7f30dee7'}) ,(sc15)-[:IS_PART_OF_CLUSTER]->(c) ,(sc16:Controller{serialnumber:'7000610045',system_id:'1873784157',hostname:'node16',node_uuid:'67d80db8-663d-11e0-9b53-cd0ece6aa2ce'}) ,(sc16)-[:IS_PART_OF_CLUSTER]->(c) ,(sc17:Controller{serialnumber:'7001246085',system_id:'2014175904',hostname:'node19',node_uuid:'1c792588-ff4e-11db-94fe-3b91dd7dd242'}) ,(sc17)-[:IS_PART_OF_CLUSTER]->(c) ,(sc18:Controller{serialnumber:'7001246097',system_id:'2014176797',hostname:'node20',node_uuid:'3ae9e7ae-ff44-11db-864d-af2af862bba3'}) ,(sc18)-[:IS_PART_OF_CLUSTER]->(c) RETURN c,sc1,sc2,sc3,sc4,sc5,sc6,sc7,sc8,sc9,sc10,sc11,sc12,sc13,sc14,sc15,sc16,sc17,sc18 行返回:0

的Cypher查詢用於創建節點:

CREATE (c:Cluster{cluster_name:'mycluster',cluster_uuid:'7bd4f66d-5faf-11db-8d0d-000e0cba569c'}) ,(sc1:Controller{serialnumber:'7000610071',system_id:'1873784171',hostname:'node01',node_uuid:'7cd70205-66ae-11e0-a4a9-0deba859517d'}) ,(sc1)-[:IS_PART_OF_CLUSTER]->(c) ,(sc2:Controller{serialnumber:'7000606111',system_id:'1873778118',hostname:'node02',node_uuid:'b954f0a1-6682-11e0-b8a0-517da924923d'}) ,(sc2)-[:IS_PART_OF_CLUSTER]->(c) ,(sc3:Controller{serialnumber:'7000561878',system_id:'1873772083',hostname:'node03',node_uuid:'ac293586-6690-11e0-b8a0-517da924923d'}) ,(sc3)-[:IS_PART_OF_CLUSTER]->(c) ,(sc4:Controller{serialnumber:'800000075807',system_id:'1873784143',hostname:'node04',node_uuid:'e8d6c7e5-663e-11e0-b8a0-517da924923d'}) ,(sc4)-[:IS_PART_OF_CLUSTER]->(c) ,(sc5:Controller{serialnumber:'7000477261',system_id:'1873745662',hostname:'node05',node_uuid:'1d1ecc64-728c-11e0-bf0e-3d25383f7ed3'}) ,(sc5)-[:IS_PART_OF_CLUSTER]->(c) ,(sc6:Controller{serialnumber:'7000477273',system_id:'1873745654',hostname:'node06',node_uuid:'140fb0f9-728c-11e0-afeb-49fcf0b6e6c3'}) ,(sc6)-[:IS_PART_OF_CLUSTER]->(c) ,(sc7:Controller{serialnumber:'7000474908',system_id:'1873745665',hostname:'node07',node_uuid:'edbf9c62-728b-11e0-bf0e-3d25383f7ed3'}) ,(sc7)-[:IS_PART_OF_CLUSTER]->(c) ,(sc8:Controller{serialnumber:'7000474910',system_id:'1873745695',hostname:'node08',node_uuid:'20dbfe67-7832-11e0-afeb-49fcf0b6e6c3'}) ,(sc8)-[:IS_PART_OF_CLUSTER]->(c) ,(sc9:Controller{serialnumber:'7000609864',system_id:'1873802756',hostname:'node09',node_uuid:'a8b75397-6690-11e0-b8a0-517da924923d'}) ,(sc9)-[:IS_PART_OF_CLUSTER]->(c) ,(sc10:Controller{serialnumber:'7000610021',system_id:'1873791030',hostname:'node10',node_uuid:'f6cf0705-6670-11e0-b8a0-517da924923d'}) ,(sc10)-[:IS_PART_OF_CLUSTER]->(c) ,(sc11:Controller{serialnumber:'7000610057',system_id:'1873784128',hostname:'node11',node_uuid:'551b1bf8-663d-11e0-b8a0-517da924923d'}) ,(sc11)-[:IS_PART_OF_CLUSTER]->(c) ,(sc12:Controller{serialnumber:'7000609981',system_id:'1873778164',hostname:'node12',node_uuid:'f6062d6c-663e-11e0-9b53-cd0ece6aa2ce'}) ,(sc12)-[:IS_PART_OF_CLUSTER]->(c) ,(sc13:Controller{serialnumber:'7000610033',system_id:'1873778186',hostname:'node13',node_uuid:'ed0e61c5-6670-11e0-b07f-933da0385fdc'}) ,(sc13)-[:IS_PART_OF_CLUSTER]->(c) ,(sc14:Controller{serialnumber:'7000610069',system_id:'1873784175',hostname:'node14',node_uuid:'8623ea28-66ae-11e0-ab9d-5fdc7f30dee7'}) ,(sc14)-[:IS_PART_OF_CLUSTER]->(c) ,(sc15:Controller{serialnumber:'7000606109',system_id:'1873778197',hostname:'node15',node_uuid:'b4349a83-6682-11e0-ab9d-5fdc7f30dee7'}) ,(sc15)-[:IS_PART_OF_CLUSTER]->(c) ,(sc16:Controller{serialnumber:'7000610045',system_id:'1873784157',hostname:'node16',node_uuid:'67d80db8-663d-11e0-9b53-cd0ece6aa2ce'}) ,(sc16)-[:IS_PART_OF_CLUSTER]->(c) ,(sc17:Controller{serialnumber:'7001246085',system_id:'2014175904',hostname:'node19',node_uuid:'1c792588-ff4e-11db-94fe-3b91dd7dd242'}) ,(sc17)-[:IS_PART_OF_CLUSTER]->(c) ,(sc18:Controller{serialnumber:'7001246097',system_id:'2014176797',hostname:'node20',node_uuid:'3ae9e7ae-ff44-11db-864d-af2af862bba3'}) ,(sc18)-[:IS_PART_OF_CLUSTER]->(c) RETURN c,sc1,sc2,sc3,sc4,sc5,sc6,sc7,sc8,sc9,sc10,sc11,sc12,sc13,sc14,sc15,sc16,sc17,sc18

創建了19個節點,18個關係。

現在,當我再次運行第一個查詢時,需要一分鐘時間,並最終返回'未知錯誤'。

的Cypher查詢:

MATCH (c:Cluster{cluster_name:'mycluster',cluster_uuid:'7bd4f66d-5faf-11db-8d0d-000e0cba569c'}) ,(sc1:Controller{serialnumber:'7000610071',system_id:'1873784171',hostname:'node01',node_uuid:'7cd70205-66ae-11e0-a4a9-0deba859517d'}) ,(sc1)-[:IS_PART_OF_CLUSTER]->(c) ,(sc2:Controller{serialnumber:'7000606111',system_id:'1873778118',hostname:'node02',node_uuid:'b954f0a1-6682-11e0-b8a0-517da924923d'}) ,(sc2)-[:IS_PART_OF_CLUSTER]->(c) ,(sc3:Controller{serialnumber:'7000561878',system_id:'1873772083',hostname:'node03',node_uuid:'ac293586-6690-11e0-b8a0-517da924923d'}) ,(sc3)-[:IS_PART_OF_CLUSTER]->(c) ,(sc4:Controller{serialnumber:'800000075807',system_id:'1873784143',hostname:'node04',node_uuid:'e8d6c7e5-663e-11e0-b8a0-517da924923d'}) ,(sc4)-[:IS_PART_OF_CLUSTER]->(c) ,(sc5:Controller{serialnumber:'7000477261',system_id:'1873745662',hostname:'node05',node_uuid:'1d1ecc64-728c-11e0-bf0e-3d25383f7ed3'}) ,(sc5)-[:IS_PART_OF_CLUSTER]->(c) ,(sc6:Controller{serialnumber:'7000477273',system_id:'1873745654',hostname:'node06',node_uuid:'140fb0f9-728c-11e0-afeb-49fcf0b6e6c3'}) ,(sc6)-[:IS_PART_OF_CLUSTER]->(c) ,(sc7:Controller{serialnumber:'7000474908',system_id:'1873745665',hostname:'node07',node_uuid:'edbf9c62-728b-11e0-bf0e-3d25383f7ed3'}) ,(sc7)-[:IS_PART_OF_CLUSTER]->(c) ,(sc8:Controller{serialnumber:'7000474910',system_id:'1873745695',hostname:'node08',node_uuid:'20dbfe67-7832-11e0-afeb-49fcf0b6e6c3'}) ,(sc8)-[:IS_PART_OF_CLUSTER]->(c) ,(sc9:Controller{serialnumber:'7000609864',system_id:'1873802756',hostname:'node09',node_uuid:'a8b75397-6690-11e0-b8a0-517da924923d'}) ,(sc9)-[:IS_PART_OF_CLUSTER]->(c) ,(sc10:Controller{serialnumber:'7000610021',system_id:'1873791030',hostname:'node10',node_uuid:'f6cf0705-6670-11e0-b8a0-517da924923d'}) ,(sc10)-[:IS_PART_OF_CLUSTER]->(c) ,(sc11:Controller{serialnumber:'7000610057',system_id:'1873784128',hostname:'node11',node_uuid:'551b1bf8-663d-11e0-b8a0-517da924923d'}) ,(sc11)-[:IS_PART_OF_CLUSTER]->(c) ,(sc12:Controller{serialnumber:'7000609981',system_id:'1873778164',hostname:'node12',node_uuid:'f6062d6c-663e-11e0-9b53-cd0ece6aa2ce'}) ,(sc12)-[:IS_PART_OF_CLUSTER]->(c) ,(sc13:Controller{serialnumber:'7000610033',system_id:'1873778186',hostname:'node13',node_uuid:'ed0e61c5-6670-11e0-b07f-933da0385fdc'}) ,(sc13)-[:IS_PART_OF_CLUSTER]->(c) ,(sc14:Controller{serialnumber:'7000610069',system_id:'1873784175',hostname:'node14',node_uuid:'8623ea28-66ae-11e0-ab9d-5fdc7f30dee7'}) ,(sc14)-[:IS_PART_OF_CLUSTER]->(c) ,(sc15:Controller{serialnumber:'7000606109',system_id:'1873778197',hostname:'node15',node_uuid:'b4349a83-6682-11e0-ab9d-5fdc7f30dee7'}) ,(sc15)-[:IS_PART_OF_CLUSTER]->(c) ,(sc16:Controller{serialnumber:'7000610045',system_id:'1873784157',hostname:'node16',node_uuid:'67d80db8-663d-11e0-9b53-cd0ece6aa2ce'}) ,(sc16)-[:IS_PART_OF_CLUSTER]->(c) ,(sc17:Controller{serialnumber:'7001246085',system_id:'2014175904',hostname:'node19',node_uuid:'1c792588-ff4e-11db-94fe-3b91dd7dd242'}) ,(sc17)-[:IS_PART_OF_CLUSTER]->(c) ,(sc18:Controller{serialnumber:'7001246097',system_id:'2014176797',hostname:'node20',node_uuid:'3ae9e7ae-ff44-11db-864d-af2af862bba3'}) ,(sc18)-[:IS_PART_OF_CLUSTER]->(c) RETURN c,sc1,sc2,sc3,sc4,sc5,sc6,sc7,sc8,sc9,sc10,sc11,sc12,sc13,sc14,sc15,sc16,sc17,sc18

返回Unknown Error

回答

1

你MATCH查詢方式複雜。沒有必要指定每個節點。以下查詢返回羣集及其相關控制器:

MATCH (c:Cluster{cluster_name:'mycluster',cluster_uuid:'7bd4f66d-5faf-11db-8d0d-000e0cba569c'})<-[:IS_PART_OF_CLUSTER]-(sc:Controller) 
WITH c, collect(sc) as controllers 
RETURN c as cluster, controllers 
+0

感謝您的回覆。這確實是一個複雜的查詢。但是這是必須的,因爲我們需要測試這個具有所有這些控制器的特定集羣是否已經存在。如果集羣已經存在,那麼我們將更新'最後'或'第一個'報告日期,如果需要,將pointint更新到集羣節點。如果此特定羣集配置尚不存在,那麼我們將使用開始日期和結束日期來創建它。 – user3323098