I am writing a .NET airport application using neo4j for the first time. I have an API and can get my objects (Airports in this case) that are in the database. I can also create new Airports with
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();
}
That works fine. But I also want to make sure that the Airport does not already exist in the database. So I have tried to add in the code:
var existing = WebApiConfig.GraphClient.Cypher.Match("(a:Airport)")
.Where((Airport a) => a.Code.Equals(code.ToUpper()))
.Return(a => a.As<Airport>());
But when I run this code section it always throws a SyntaxException
. I think that it is in the construction of the where clause.
My Airport
class is
public class Airport
{
public string City { get; set; }
public string State { get; set; }
public string Code { get; set; }
}
The current resource I am using is https://github.com/Readify/Neo4jClient/wiki/cypher.
Two questions:
- What am I missing here?
- Are there other resources out there that would help me out?
Thank you