问题
I've been using NEO4j database for a recent project at work.
Recently, we noticed that Cypher queries run faster than Gremlin so we decided to convert our queries. We are running the queries using the .Net graph client.
There is one Gremlin query that I'm having trouble converting to Cypher.
----Gremlin(this works and produces a result of Node(CustomerNode)....should be brackets around CustomerNode but the editor won't take it)
var results2 = graphClient.RootNode
.Out<ApplicationNode>("HasApplications")
.OutE("HasCompanies")
.InV<CompanyNode>(p => p.Id == companyId, StringComparison.Ordinal)
.Out<ConfigurationRootNode>("HasConfigurationRoot")
.Out<CustomerNode>("HasCustomers")
.As<CustomerNode>("Customer")
.OutE("HasConfigurationStatuses")
.InV<ConfigurationStatusNode>(p => p.Status == configStatus, StringComparison.Ordinal)
.OutE("HasOpportunities")
.InV<OpportunityNode>(p => p.ConfigurationId == configurationId, StringComparison.Ordinal)
.BackV<CustomerNode>("Customer");
var testResults2 = results2.ToList();
--------Cypher(see below...this doesn't work)
var results = graphClient.Cypher.Start("root", "node(0)")
.Match("(root)-[ha:HasApplications]->(Application)-[hs:HasCompanies]->Company-[hcr:HasConfigurationRoot]->(ConfigurationRoot)-[hc:HasCustomers]->(Customer)<-[hcs:HasConfigurationStatuses]-(ConfigurationStatus)<-[ho:HasOpportunities]-(Opportunity)")
.Where<CompanyNode>(Company => Company.Id == companyId)
.And().Where<ConfigurationStatusNode>(ConfigurationStatus => ConfigurationStatus.Status == configStatus)
.And().Where<OpportunityNode>(Opportunity => Opportunity.ConfigurationId == configurationId);
var x = results.Return<Node<CustomerNode>>("Customer").Results;
It appears that my "Match" property might not be set up correctly? I can't get any results to come from the Cypher query at all. This one is different from my other queries.....this is the only one that does a BackV in Gremlin.
Any help would be appreciated!
Thanks! Patrick
来源:https://stackoverflow.com/questions/17332011/neo4j-issue-converting-gremlin-query-to-cypher