对于模糊的措辞感到抱歉,这就是问题所在。由于我昨天得到了一些帮助,我得到了一个快速运行的查询(4秒):
// polypeptide domain, protein HMM match and polypeptide (fast)
MATCH (pd:PolypeptideDomain) WITH pd LIMIT 5
MATCH (phm:ProteinHmmMatch)
WHERE (phm)-[:PART_OF]->(pd)
MATCH (p:Polypeptide)
WHERE (phm)-[:PART_OF]->(p)
RETURN phm,pd,p
这种方法运行速度很快,因为我选择了5个多肽结构域,之后,相关蛋白HMM匹配和多肽很快被发现。
所以,我只是想添加与多肽相关的mRNA - 它是一对一的关系,每个mRNA都链接一个且只有一个多肽,所以我认为额外的匹配会快点这是我写的:
// polypeptide domain, protein hmm match, polypeptide and mRNA (blows up)
MATCH (pd:PolypeptideDomain) WITH pd LIMIT 5
MATCH (phm:ProteinHmmMatch)
WHERE (phm)-[:PART_OF]->(pd)
MATCH (p:Polypeptide)
WHERE (phm)-[:PART_OF]->(p)
MATCH (m:mRNA)
WHERE (p)-[:TRANSLATION_OF]->(m)
RETURN phm,pd,p,m
此查询永远不会返回。我再次完全神秘化了。我不能为我的生活找出如何简单地添加查询工作。
答案 0 :(得分:0)
我认为它越来越失控,因为对于每个MATCH
结果,它都试图找到每个其他MATCH
结果的每个组合。
此外,除非您遇到更复杂的逻辑(如WHERE
),否则不应在NOT(<match syntax)
子句中使用模式匹配。怎么样?
MATCH (pd:PolypeptideDomain) WITH pd LIMIT 5
MATCH (phm:ProteinHmmMatch)-[:PART_OF]->(pd)
WITH pd, phm
MATCH (phm)-[:PART_OF]->(p:Polypeptide)
WITH pd, phm, p
MATCH (p)-[:TRANSLATION_OF]->(m:mRNA)
RETURN phm,pd,p,m
如果其中任何一个涉及多个关系,您可以在collect
WITH
中WITH pd, collect(phm)
进行MATCH (pd:PolypeptideDomain) WITH pd LIMIT 5
MATCH (pd)<-[:PART_OF]-(phm:ProteinHmmMatch)-[:PART_OF]->(p:Polypeptide)-[:TRANSLATION_OF]->(m:mRNA)
RETURN phm,pd,p,m
。
看看你的比赛,看起来你似乎可以逃脱这个:
#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>
byte mac[] = { 0xAA, 0xAA, 0xAA, 0xAA, 0xAB, 0xAD };
IPAddress ip(10, 20, 7, 75);
EthernetServer server(80);
boolean LED_status = 0;
File webFile;
String HTTP_req;
int first = 0;
void setup() {
Ethernet.begin(mac, ip);
server.begin();
Serial.begin(9600);
Serial.println("Initializing SD card...");
if(!SD.begin(4)) {
Serial.println("ERROR - SD card initialization failed!");
return;
}
Serial.println("SUCCESS - SD card initialized.");
if(!SD.exists("index.htm")) {
Serial.println("ERROR - Can't find index.htm file!");
return;
}
Serial.println("SUCCESS - Found index.htm file.");
}
void loop () {
EthernetClient client = server.available();
if(client) {
Serial.println("Connected to client");
boolean currentLineIsBlank = true;
while (client.connected()) {
if(client.available()) {
char c = client.read();
Serial.print(c);
delay(1);
HTTP_req = HTTP_req + c;
delay(5);
if(c == '\n' && currentLineIsBlank) {
Serial.println("HTTP_req inside if");
Serial.println(HTTP_req);
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
if(first == 0) {
webFile = SD.open("index.htm");
Serial.println("First if block: Attempted to open index.htm");
Serial.print("webFile: ");
Serial.println(webFile);
if(webFile) {
Serial.println("First if block: Successfully opened index.htm");
while(webFile.available()) {
client.write(webFile.read());
}
webFile.close();
}
first++;
}
else {
if (HTTP_req.indexOf("LED2=2") > -1) {
Serial.println("LED2=2 found");
if (LED_status) {
LED_status = 0;
digitalWrite(2, LOW);
webFile = SD.open("index.htm");
Serial.println("Block to turn off led: index.htm attempted");
if(webFile) {
Serial.println("index sudo unchecked HTML opened");
while (webFile.available()) {
client.write(webFile.read());
}
webFile.close();
}
}
else {
LED_status = 1;
digitalWrite(2, HIGH);
webFile = SD.open("checked.htm");
Serial.println("Block to turn on led: checked.htm attempted");
if(webFile) {
Serial.println("Checked HTML opened");
while (webFile.available()) {
client.write(webFile.read());
}
webFile.close();
}
}
}
else {
Serial.println("Not Clicked?");
}
}
Serial.println("This is HTTP_req:");
Serial.println(HTTP_req);
HTTP_req = "";
break;
}
if (c == '\n') {
currentLineIsBlank = true;
}
else if (c != '\r') {
currentLineIsBlank = false;
}
}
}
delay(1);
client.stop();
}
}
同样,如果两者之间存在许多关系,那么您的数据将会被解除标准化。