我正在第一次编写一个使用neo4j的.NET机场应用程序。我有一个API,可以获取数据库中的对象(本例中为机场)。我也可以创建新的机场neo4j query construction SyntaxException
public void Post([FromUri]string name, [FromUri]string code, [FromUri]string city, [FromUri]string state)
{
string query = "(:Airport{name:'" + name + "',code:'" + code.ToUpper() + "',city:'" + city + "',state:'" + state.ToUpper() + "'})";
var q = WebApiConfig.GraphClient.Cypher.Create(query);
q.ExecuteWithoutResults();
}
这工作正常。但我也想确保机场不存在于数据库中。所以,我试图在代码中添加:
var existing = WebApiConfig.GraphClient.Cypher.Match("(a:Airport)")
.Where((Airport a) => a.Code.Equals(code.ToUpper()))
.Return(a => a.As<Airport>());
但是当我运行该代码段总是抛出一个SyntaxException
。我认为这是在构建where子句。
我Airport
类是
public class Airport
{
public string City { get; set; }
public string State { get; set; }
public string Code { get; set; }
}
我使用目前的资源是https://github.com/Readify/Neo4jClient/wiki/cypher。
两个问题:
- 我缺少的是在这里吗?
- 有没有其他资源可以帮助我?
谢谢
喜迈克尔 - 什么是你得到的语法异常 –
啊,不,我想我知道它是什么? - 我我会在几分钟内回答 –