我刚开始学习用C#客户端的Neo4j,而我无法理解清单性的判定的准确使用。
在该示例应用im使用(其运行于“Cineasts影演员”数据集上)有一个与以下属性的类演员:
public class Actor
{
public String id { get; set; }
public String name { get; set; }
public String birthplace { get; set; }
public String birthday { get; set; }
public String biography { get; set; }
public List<Movie> filmography { get; set; }
public Role playedIn(Movie movie, String role)
{
return null;
}
}
而类如电影
public class Movie
{
public String id { get; set; }
public String title { get; set; }
public int year { get; set; }
public List<Role> cast { get; set; }
}
现在,它获取与名称的演员== actorName
从数据库如图所示
string actorName = ".*" + actorName + ".*";
Dictionary<string, object> queryDict = new Dictionary<string, object>();
queryDict.Add("actorName", actorName);
var query = new Neo4jClient.Cypher.CypherQuery("start n=node(*) where has(n.__type__) and n.__type__ =~ \".*Person\" and has(n.name) and n.name =~ {actorName} return n",
queryDict, CypherResultMode.Set);
List<Actor> actors = ((IRawGraphClient)client).ExecuteGetCypherResults<Actor>(query).ToList();
foreach (Actor a in actors)
{
MessageBox.Show(a.name);
}
现在演员a
样品中上述确有其“基本”属性(姓名,生日,身份证,..)但名单filmography
为空,我无法做到以下几点
foreach (Actor a in actors)
{
foreach (Movie m in a.filmography)
{
MessageBox.Show(m.title);
}
}
为什么我把这个列表属性类的声明,如果它不取相关的这个名单Movie
,当我取演员自动节点,但我必须从一个单独的查询做呢?