neo4j cypher基于属性字符串值

时间:2018-05-28 11:47:26

标签: neo4j cypher neo4j-apoc

我有一个带标签实验的节点,其中有一个名为ExperimentName的属性。

此ExperimentName基于3个不同变量的串联

“条件(ExperimentProfile1)剂量”

示例:

Control diet (MOA77) LD
Control gavage(MOA66) HD

我有另一个名为ExperimentMapper的节点 它有3个属性: - 条件 - ExperimentProfile - 剂量

当experimentName是3个属性的结果时,我想在Node Experiment 和Node ExperimentMapper 之间创建一个关系。

我曾尝试使用Regex,但查询速度非常慢并且需要永远...

任何帮助?

这是我的密码,但尽管我创建了索引

,但它仍在继续
MATCH (mxpExperiment:MxpExperiment) OPTIONAL MATCH (otuExperimentMapper:OtuExperimentMapper) 
WHERE  mxpExperiment.name CONTAINS otuExperimentMapper.Condition 
AND mxpExperiment.name CONTAINS otuExperimentMapper.Experiment
AND mxpExperiment.name CONTAINS otuExperimentMapper.dose

CREATE (mxpExperiment)-[:OTU_EXPERIMENT_MAPPER]->(otuExperimentMapper)
RETURN mxpExperiment, otuExperimentMapper

1 个答案:

答案 0 :(得分:1)

我认为您需要从Experiment Mapper

的一侧开始

首先,您需要创建一个索引:

CREATE INDEX ON :MxpExperiment(name)

然后查询可以如下:

MATCH (otuExperimentMapper:OtuExperimentMapper) 
WITH otuExperimentMapper,
     otuExperimentMapper.Condition  + ' (' +
     otuExperimentMapper.Experiment + ') ' +
     otuExperimentMapper.dose AS name
MATCH (mxpExperiment:MxpExperiment) WHERE mxpExperiment.name = name
MERGE (mxpExperiment)-[:OTU_EXPERIMENT_MAPPER]->(otuExperimentMapper)
RETURN mxpExperiment, otuExperimentMapper