Datamodel是:
> (A:word {word:'word'})-[:NEXT sentence:<s-order> word:<w-order>]->(B:word)
> (S:Sentence)-[:START]->(A:word)
有一个索引:Word(word)
我使用CREATE查询添加了一堆单词。所以我知道我在一个句子中使用的所有单词都作为图表中的单词节点存在。 在尝试运行Cypher查询以在Neo4j控制台中创建句子时,Neo4j会返回错误:
找不到尺寸为7的块的解决方案, Stream()是表IDPPlanTable中选择的候选者(numberOfPlans = 95,largestSolved = 6)
编辑我已经对查询进行了一些调整,以使其更易于理解(感谢提示!)。其中一些仍然无法正常工作:
MATCH (word8:word {word:'de'}),(word24:word {word:'platen'}),
(word25:word {word:'halen'}),(word26:word {word:'alles'}),
(word27:word {word:'wel'}),(word28:word {word:'weer'}),
(word29:word {word:'voor'}),(word18:word {word:'je'}),
(word30:word {word:'naar'}),(word31:word {word:'boven'}),
(word32:word {word:'als'}),(word33:word {word:'ze'}),
(word3353:word {word:'afspeelt'})
WITH (word8),(word24),(word25),(word26),(word27),(word28),
(word29),(word18),(word30),(word31),(word32),(word33),(word3353)
MERGE (ThisSentence:Sentence {order:3})-[:START]->
(word8)-[nw26:NEXT {sentence:3, word:0}]->
(word24)-[nw27:NEXT {sentence:3, word:1}]->
(word25)-[nw28:NEXT {sentence:3, word:2}]->
(word26)-[nw29:NEXT {sentence:3, word:3}]->
(word27)-[nw30:NEXT {sentence:3, word:4}]->
(word28)-[nw31:NEXT {sentence:3, word:5}]->
(word29)-[nw32:NEXT {sentence:3, word:6}]->
(word18)-[nw33:NEXT {sentence:3, word:7}]->
(word30)-[nw34:NEXT {sentence:3, word:8}]->
(word31)-[nw35:NEXT {sentence:3, word:9}]->
(word32)-[nw36:NEXT {sentence:3, word:10}]->
(word18)-[nw37:NEXT {sentence:3, word:11}]->
(word33)-[nw38:NEXT {sentence:3, word:12}]->(word3353)
WITH ThisSentence MATCH (PrevSentence) WHERE PrevSentence.order=2
MERGE (PrevSentence)-[:NEXT]->(ThisSentence) WITH ThisSentence RETURN ThisSentence
问题:为什么此查询失败?
我想到的可能答案:
它可能与围绕word18的循环创建关系有关。正如您所看到的,它在查询中使用了两次,创建了两个传入和两个传出,所有这些都是彼此不同的:
我该如何防止这种情况?
Neo4j版本是3.0.6 CE。
答案 0 :(得分:1)
是的!找到答案...数据集减少到40个节点。哪个仍然让查询中断。 (数据集中有31个节点关系,9个节点没有关系)
经过一些路径查询后,找到了以下工作查询:
MATCH (word8:word {word:'de'}),
(word24:word {word:'platen'}),
(word25:word {word:'halen'}),
(word26:word {word:'alles'}),
(word27:word {word:'wel'}),
(word28:word {word:'weer'}),
(word29:word {word:'voor'}),
(word18:word {word:'je'}),
(word30:word {word:'naar'}),
(word31:word {word:'boven'}),
(word32:word {word:'als'}),
(word33:word {word:'ze'}),
(word3353:word {word:'afspeelt'}),
(PrevSentence:Sentence {order:2})
MERGE (PrevSentence)-[:NEXT]->
(ThisSentence:Sentence {order:3})-[:START]->(word8)
MERGE (word8)-[nw26:NEXT {sentence:3, word:0}]->(word24)
MERGE (word24)-[nw27:NEXT {sentence:3, word:1}]->(word25)
MERGE (word25)-[nw28:NEXT {sentence:3, word:2}]->(word26)
MERGE (word26)-[nw29:NEXT {sentence:3, word:3}]->(word27)
MERGE (word27)-[nw30:NEXT {sentence:3, word:4}]->(word28)
MERGE (word28)-[nw31:NEXT {sentence:3, word:5}]->(word29)
MERGE (word29)-[nw32:NEXT {sentence:3, word:6}]->(word18)
MERGE (word18)-[nw33:NEXT {sentence:3, word:7}]->(word30)
MERGE (word30)-[nw34:NEXT {sentence:3, word:8}]->(word31)
MERGE (word31)-[nw35:NEXT {sentence:3, word:9}]->(word32)
MERGE (word32)-[nw36:NEXT {sentence:3, word:10}]->(word18)
MERGE (word18)-[nw37:NEXT {sentence:3, word:11}]->(word33)
MERGE (word33)-[nw38:NEXT {sentence:3, word:12}]->(word3353)
正如您所看到的,它涉及将整个关系链打破到原子级别。在这种情况下,Neo4j无论如何处理零件都没有问题。
虽然找到了答案,但我仍然很好奇为什么Neo4j无法处理查询。一串节点太长了?太多&#39;抵押品&#39;查询处理中的数据?