var pubs = client.Cypher
.Match("(s)")
.Where("s:APublisher OR s:BPublisher OR s:CPublisher OR s:DPublisher ")
.Return(s => s.As<Publisher>())
.Results.ToList<Publisher>();
通过上述查询,返回节点的所有属性,并为每个节点创建“Publisher”对象。
如何获取节点标签,并将其设置为新创建的“Publisher”对象的“标签”属性?
谢谢..
答案 0 :(得分:1)
您需要使用适当的函数提取标签,并将它们分配给对象Labels属性。尝试像
这样的东西var pubs = client.Cypher
.Match("(s)")
.Where("s:APublisher OR s:BPublisher OR s:CPublisher OR s:DPublisher ")
.Return(s => new {
Pub = s.As<Publisher>()
PubLabels = s.Labels() })
.Results
.ToList();
var pubsList = new List<Publisher>(pubs.Count);
for each (var pub in pubs)
{
var publisher = pub.Pub;
publisher.Labels = pub.PubLabels;
pubsList.Add(publisher);
}