neo4jclient

Neo4jClient How can I return all nodes, relationships and parameters for a dynamic graph

社会主义新天地 提交于 2020-01-03 02:53:23
问题 I am building an application where node labels, parameters and relationships are going to be set by my users, so nodes, rel, and prop after a certain layer will be completely dynamic and unpredictable. My question is how do I run the following query and map the results to some sort of list that can be used to rebuild the graph visually. Using neo4jClient. The query I use directly with the Neo4j Browser works great Match(a:User),(b:Work)-->(n) Where a.UserId = 'xxxx' AND b.Name = 'CompanyA'

ASP.NET and Neo4jClient - where to store the connection?

佐手、 提交于 2020-01-01 11:57:08
问题 The C# Neo4JClient has GraphClient where you have to call .Connect() var client = new GraphClient(new Uri("http://localhost:7474/db/data")); client.Connect(); In all of the examples that I've seen, it's in a Console app, so they declare GraphClient in Main() and re-use it. And the documentation mentions how its Thread Safe and to only have one instance per database and to not call .Connect() multiple times. But what about in ASP.NET applications? Should I be sticking it in some static class

Optimize Create

最后都变了- 提交于 2019-12-31 05:10:40
问题 I got 20 000 apples. How do I create them in a smarter way than this? foreach (var a in apples) { graphClient.Cypher .Create("(a:Apple {newApple})") .WithParam("newApple", a) .ExecuteWithoutResults(); } Looking for a generic way to be able to pass objects without specifying each property. class Fruit { [JsonProperty(PropertyName = "Color")] public bool Color { get; set; } } class Apple : Fruit { [JsonProperty(PropertyName = "Variety")] public String Variety { get; set; } } 回答1: I suppose

Constructing a method call

偶尔善良 提交于 2019-12-30 11:15:19
问题 in trying to follow this guide: https://github.com/Readify/Neo4jClient/wiki/cypher-examples#get-all-users-by-label I need to create a lambda expression in order to provide it to the Return method. In C# it looks like this: .Return(n => n.As<Project>()) and in Powershell I've gone about it this way (as per @PetSerAl's suggestion: Return overload fails): $exp = [System.Linq.Expressions.Expression] $param = $exp::Parameter([Neo4jClient.Cyper.ICypherResultItem], "n") $body = $exp::TypeAs($p, (new

Constructing a method call

吃可爱长大的小学妹 提交于 2019-12-30 11:14:47
问题 in trying to follow this guide: https://github.com/Readify/Neo4jClient/wiki/cypher-examples#get-all-users-by-label I need to create a lambda expression in order to provide it to the Return method. In C# it looks like this: .Return(n => n.As<Project>()) and in Powershell I've gone about it this way (as per @PetSerAl's suggestion: Return overload fails): $exp = [System.Linq.Expressions.Expression] $param = $exp::Parameter([Neo4jClient.Cyper.ICypherResultItem], "n") $body = $exp::TypeAs($p, (new

Neo4j/Cypher: Match on dynamic property

无人久伴 提交于 2019-12-25 08:38:17
问题 According to the developer manual section 3.2.4 on Parameters: Parameters cannot be used for the following constructs, as these form part of the >query structure that is compiled into a query plan: property keys; so, MATCH (n) WHERE n.$param = 'something' is invalid (source) Is there no way around this (c#, using the official driver)? I have a case where a node of a particular type can contain from a few up to hundreds of properties, and I want the users to be able to search for any of these

Get relationship nodes by Variable length relationships in Neo4j using Neo4jClient

北城余情 提交于 2019-12-25 06:55:13
问题 I use Neo4jClient and I want to get relation attribute by Variable length relationships (n:Users {id:1})-[r:FOLLOW*1..4]-(m:Users) RETURN r how I can get node with attribute relation , for example : Node[0]{id:1,name:"Oliver Stone"} Node[1]{id:2,name:"Charlie Sheen"} Node[2]{id:3,name:"Martin Sheen"} Node[3]{id:4,name:"TheAmericanPresident"} I should know , what is attribute relation between Node[0] and Node[2]? (attribute mean "FOLLOW" or "IGNORE") 回答1: First up, if you are using [r:FOLLOW*1

neo4jclient merge query cause unhandled exception

与世无争的帅哥 提交于 2019-12-24 13:57:13
问题 I want to use merge in my neo4jclient c# application, so I read this link and create a query like the below one : resultList.ForEach( tweets => client.Cypher .Merge("(tweet:Tweet {newtweet})") .OnCreate() .Set("tweet = {newtweet}") .WithParams(new Tweets(tweets)) .ExecuteWithoutResults()); But it crash and I don't know what I am missing. Which part of my code is wrong? 回答1: First define your tweet class: public class Tweet { public long StatusId { get; set; } public string Author { get; set;

neo4j - Issue converting gremlin query to cypher

一个人想着一个人 提交于 2019-12-24 13:26:39
问题 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>(

Neo4j REST Encoding

孤街醉人 提交于 2019-12-24 05:06:55
问题 I'm using neo4jclient. When I try to create/update an node, special chars like äöü are replaced with �. Do I have to set a specific http header like content-type, content-encoding? If yes, what kind of header and what is the value of this header? Thanks. EDIT: This is how the request looks like: POST http://...........:7474/db/data/batch HTTP/1.1 Accept: application/json;stream=true User-Agent: RestSharp 103.1.0.0 Content-Type: application/json Host: ............:7474 Content-Length: 267