当我尝试从 Neo4JClient 中的 cyper 查询中获取结果时,出现以下错误。
错误:
Neo4jClient encountered an exception while deserializing the response from the server. This is likely a bug in Neo4jClient.
Please open an issue at https://bitbucket.org/Readify/neo4jclient/issues/new
To get a reply, and track your issue, ensure you are logged in on BitBucket before submitting.
Include the full text of this exception, including this message, the stack trace, and all of the inner exception details.
Include the full type definition of <>f__AnonymousType3`2[[Neo4jClient.Node`1[[IQS_ACL.Nodes.User, IQS ACL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Neo4jClient, Version=1.0.0.594, Culture=neutral, PublicKeyToken=null],[Neo4jClient.Node`1[[IQS_ACL.Nodes.SecurityRelationshipObject, IQS ACL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Neo4jClient, Version=1.0.0.594, Culture=neutral, PublicKeyToken=null]].
Include this raw JSON, with any sensitive values replaced with non-sensitive equivalents:
{
"columns" : [ "Node", "Rels" ],
"data" : [ [ {
"paged_traverse" : "http://localhost:7474/db/data/node/7690/paged/traverse/{returnType}{?pageSize,leaseTime}",
"outgoing_relationships" : "http://localhost:7474/db/data/node/7690/relationships/out",
"data" : {
"Name" : "root"
},
"traverse" : "http://localhost:7474/db/data/node/7690/traverse/{returnType}",
"all_typed_relationships" : "http://localhost:7474/db/data/node/7690/relationships/all/{-list|&|types}",
"all_relationships" : "http://localhost:7474/db/data/node/7690/relationships/all",
"property" : "http://localhost:7474/db/data/node/7690/properties/{key}",
"self" : "http://localhost:7474/db/data/node/7690",
"properties" : "http://localhost:7474/db/data/node/7690/properties",
"outgoing_typed_relationships" : "http://localhost:7474/db/data/node/7690/relationships/out/{-list|&|types}",
"incoming_relationships" : "http://localhost:7474/db/data/node/7690/relationships/in",
"incoming_typed_relationships" : "http://localhost:7474/db/data/node/7690/relationships/in/{-list|&|types}",
"extensions" : {
},
"create_relationship" : "http://localhost:7474/db/data/node/7690/relationships"
}, {
"start" : "http://localhost:7474/db/data/node/7690",
"data" : {
"W" : 3,
"R" : 3,
"ReadablePermissions" : "+R+W",
"X" : 1
},
"property" : "http://localhost:7474/db/data/relationship/9351/properties/{key}",
"self" : "http://localhost:7474/db/data/relationship/9351",
"properties" : "http://localhost:7474/db/data/relationship/9351/properties",
"type" : "SECURITY",
"extensions" : {
},
"end" : "http://localhost:7474/db/data/node/7696"
} ], [ {
"paged_traverse" : "http://localhost:7474/db/data/node/7690/paged/traverse/{returnType}{?pageSize,leaseTime}",
"outgoing_relationships" : "http://localhost:7474/db/data/node/7690/relationships/out",
"data" : {
"Name" : "root"
},
"traverse" : "http://localhost:7474/db/data/node/7690/traverse/{returnType}",
"all_typed_relationships" : "http://localhost:7474/db/data/node/7690/relationships/all/{-list|&|types}",
"all_relationships" : "http://localhost:7474/db/data/node/7690/relationships/all",
"property" : "http://localhost:7474/db/data/node/7690/properties/{key}",
"self" : "http://localhost:7474/db/data/node/7690",
"properties" : "http://localhost:7474/db/data/node/7690/properties",
"outgoing_typed_relationships" : "http://localhost:7474/db/data/node/7690/relationships/out/{-list|&|types}",
"incoming_relationships" : "http://localhost:7474/db/data/node/7690/relationships/in",
"incoming_typed_relationships" : "http://localhost:7474/db/data/node/7690/relationships/in/{-list|&|types}",
"extensions" : {
},
"create_relationship" : "http://localhost:7474/db/data/node/7690/relationships"
}, {
"start" : "http://localhost:7474/db/data/node/7690",
"data" : {
"W" : 3,
"R" : 3,
"ReadablePermissions" : "+R+W",
"X" : 1
},
"property" : "http://localhost:7474/db/data/relationship/9351/properties/{key}",
"self" : "http://localhost:7474/db/data/relationship/9351",
"properties" : "http://localhost:7474/db/data/relationship/9351/properties",
"type" : "SECURITY",
"extensions" : {
},
"end" : "http://localhost:7474/db/data/node/7696"
} ] ]}
代码:
var groups = clientConnection.Cypher
.Start(new { n = "node(" + folderID + ")" })
.Match("n<-[r:SECURITY]-x, x<-[v:IS_MEMBER_OF_GROUP*]-b where b.Name = '"+userName+"'")
.ReturnDistinct((x, r) => new
{
Node = x.As<Node<User>>(),
Rels = r.As<Node<SecurityRelationshipObject>>()
});
var results = groups.Results;
It throws on the .Results();
如果我运行查询:
START n=node(7706) MATCH n<-[r:SECURITY]-x, x<-[v:IS_MEMBER_OF_GROUP*]-b where b.Name = 'user1' RETURN distinct x AS Node, r AS Rels;
在控制台中它返回:
Node[7700]{Name:"root"} | :SECURITY[9369] {ReadablePermissions:"+R+W",R:3,W:3,X:1} |
Bitbucket 票证:https ://bitbucket.org/Readify/neo4jclient/issue/153/cypher-query-returns-create-bug-exception
类定义:
public class User
{
//CMIS Object Properties
public string ObjectId { get; set; }
public string BaseTypeId { get; set; }
public string ObjectTypeId { get; set; }
public IList<string> SecondaryObjectTypeIds { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string CreatedBy { get; set; }
public string CreationDate { get; set; }
public string LastModifiedBy { get; set; }
public string LastModificationDate { get; set; }
public string ChangeToken { get; set; }
}
public class UserGroup
{
//CMIS Object Properties
public string ObjectId { get; set; }
public string BaseTypeId { get; set; }
public string ObjectTypeId { get; set; }
public IList<string> SecondaryObjectTypeIds { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string CreatedBy { get; set; }
public string CreationDate { get; set; }
public string LastModifiedBy { get; set; }
public string LastModificationDate { get; set; }
public string ChangeToken { get; set; }
}
public class RelationshipObject
{
//CMIS Object Properties
public string ObjectId { get; set; }
public string BaseTypeId { get; set; }
public string ObjectTypeId { get; set; }
public Array SecondaryObjectTypeIds { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string CreatedBy { get; set; }
public string CreationDate { get; set; }
public string LastModifiedBy { get; set; }
public string LastModificationDate { get; set; }
public string ChangeToken { get; set; }
//RelationshipObject Properties
public string sourceId { get; set; }
public string targetId { get; set; }
}
public class SecurityRelationshipObject : RelationshipObject
{
//CMIS Object Properties
public IList<string> SecondaryObjectTypeIds { get; set; }
public string ReadablePermissions { get; set; }
public int R { get; set; }
public int W { get; set; }
public int X { get; set; }
}
关系定义:
public class RelationshipUserGroupToFolder: Relationship<SecurityRelationshipObject>, IRelationshipAllowingSourceNode<UserGroup>, IRelationshipAllowingTargetNode<FolderObject>
{
string RelationshipName;
public RelationshipUserGroupToFolder(string RelationshipName, NodeReference targetNode, SecurityRelationshipObject relationshipTypeObject)
: base(targetNode, relationshipTypeObject)
{
this.RelationshipName = RelationshipName;
}
public override string RelationshipTypeKey
{
get { return RelationshipName; }
}
}
public class RelationshipUserGroupToUserGroup : Relationship<RelationshipObject>, IRelationshipAllowingSourceNode<UserGroup>, IRelationshipAllowingTargetNode<UserGroup>
{
string RelationshipName;
public RelationshipUserGroupToUserGroup(string RelationshipName, NodeReference targetNode, RelationshipObject relationshipTypeObject)
: base(targetNode, relationshipTypeObject)
{
this.RelationshipName = RelationshipName;
}
public override string RelationshipTypeKey
{
get { return RelationshipName; }
}
}
有一些不同的类型,例如RelationshipUserToFolder(security) 或RelationshipUserToUseGroup(IS_MEMBER_OF_GROUP)