public void CredentialsPreservedAllTheWayThroughToHttpStack() { var httpClient = Substitute.For<IHttpClient>(); httpClient .SendAsync(Arg.Any<HttpRequestMessage>()) .Returns(callInfo => { throw new NotImplementedException(); }); var graphClient = new GraphClient(new Uri("http://*****:*****@foo/db/data"), httpClient); try { graphClient.Connect(); } // ReSharper disable EmptyGeneralCatchClause catch (NotImplementedException) { // This will fail because we're not giving it the right // HTTP response, but we only care about the request for now } // ReSharper restore EmptyGeneralCatchClause var httpCall = httpClient.ReceivedCalls().Last(); var httpRequest = (HttpRequestMessage) httpCall.GetArguments()[0]; StringAssert.AreEqualIgnoringCase("Basic", httpRequest.Headers.Authorization.Scheme); StringAssert.AreEqualIgnoringCase("dXNlcm5hbWU6cGFzc3dvcmQ=", httpRequest.Headers.Authorization.Parameter); }
public void PassesCorrectStreamHeader_WhenUseStreamIsFalse() { var httpClient = Substitute.For<IHttpClient>(); httpClient .SendAsync(Arg.Any<HttpRequestMessage>()) .Throws(new NotImplementedException()); var graphClient = new GraphClient(new Uri("http://*****:*****@foo/db/data"), httpClient); graphClient.ExecutionConfiguration.UseJsonStreaming = false; try { graphClient.Connect(); } // ReSharper disable EmptyGeneralCatchClause catch (NotImplementedException) { // This will fail because we're not giving it the right // HTTP response, but we only care about the request for now } // ReSharper restore EmptyGeneralCatchClause var httpCall = httpClient.ReceivedCalls().Last(); var httpRequest = (HttpRequestMessage)httpCall.GetArguments()[0]; Assert.IsFalse(httpRequest.Headers.Contains("X-Stream")); }
public string CreateFriendship(string username1, string username2) { GraphClient client = new GraphClient(new Uri("http://localhost:7474/db/data")); client.Connect(); var newFriend = client.Cypher .Match("(user1:User)", "(user2:User)") .Where((User user1) => user1.username == username1) .AndWhere((User user2) => user2.username == username2) .CreateUnique("user1-[:IS_FRIENDS_WITH]-user2") .Return(user2 => user2.As <User>()) .Results.First(); client.Cypher .Match("(user1:User)-[r:REQUEST_FRIEND]-(user2:User)") .Where((User user1) => user1.username == username1) .AndWhere((User user2) => user2.username == username2) .Delete("r") .ExecuteWithoutResults(); return(toJson(newFriend)); }
static void Initialize() { try { Logger.Log("Initializing graph database..."); ServicePointManager.Expect100Continue = false; ServicePointManager.DefaultConnectionLimit = 200; HttpClientWrapper clienthttp = new HttpClientWrapper(); //client = new GraphClient(new Uri("http://dev.wishlu.com:7474/db/data"), clienthttp); //client = new GraphClient(new Uri("http://54.86.249.215:7474/db/data"), clienthttp); client = new GraphClient(new Uri("http://10.0.0.30:7474/db/data"), clienthttp); client.Connect(); Logger.Log("Connected to graph database!"); } catch { client = null; } }
public string[] GetDeveloperGames(string name) { IList <string> games = new List <string>(); GraphClient client = new GraphClient(new Uri("http://localhost:7474/db/data")); client.Connect(); var gameNodes = client.Cypher .Match("(dev:Developer)-[r:DEVELOPS]->(game:Game)") .Where((Developer dev) => dev.name == name) .Return(game => game.As <Game>()) .Results; gameNodes = gameNodes.OrderBy(x => x.title); foreach (var game in gameNodes) { games.Add(toJson(game)); } return(games.ToArray()); }
private async Task <DialogTurnResult> WorkJobCheckAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { client = new GraphClient(new Uri(GRAPHDB_ENDPOINT), new HttpClientWrapper(GRAPHDB_USERNAME, GRAPHDB_PASSWORD, new HttpClient() { Timeout = GRAPHDB_HTTP_TIMEOUT })); client.Connect(); //그래프 데이터 클라이언트 연동 workDetails = (WorkDetails)stepContext.Options; //루이즈로 받아온 엔터티 저장 if (workDetails.work == null) { return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = MessageFactory.Text("알고싶은 직무를 입력해 주십시오") }, cancellationToken)); } else { return(await stepContext.NextAsync(cancellationToken)); } }
/// <summary> /// Connects to the Neo4j Client. /// </summary> /// <returns></returns> public GraphClient Connect() { GraphClient client = null; try { if (Uri != null && User != null && Pass != null && HttpClient != null) { client = new GraphClient(new Uri(Uri), new HttpClientWrapper(User, Pass, HttpClient)); client.Connect(); } } catch (HttpRequestException) { Dispose(); } catch (Exception e) { Dispose(); } return(client); }
public void ShouldFireOnCompletedEvenWhenException() { var httpClient = Substitute.For <IHttpClient>(); httpClient .SendAsync(Arg.Any <HttpRequestMessage>()) .Throws(new NotImplementedException()); var graphClient = new GraphClient(new Uri("http://foo/db/data"), httpClient); OperationCompletedEventArgs operationCompletedArgs = null; graphClient.OperationCompleted += (s, e) => { operationCompletedArgs = e; }; // act Assert.Throws <NotImplementedException>(() => graphClient.Connect()); Assert.NotNull(operationCompletedArgs); Assert.That(operationCompletedArgs.HasException); Assert.AreEqual(typeof(NotImplementedException), operationCompletedArgs.Exception.GetType()); }
public string[] GetGamesPagin(string filter, int page, int activeUser) { List <string> result = new List <string>(); GraphClient client = new GraphClient(new Uri("http://localhost:7474/db/data")); client.Connect(); var queryBuilder = client.Cypher .Match("(n:Game)") .Where("n.title =~ {filter}") .OrWhere("n.genre =~ {filter}") .OrWhere("n.mode =~ {filter}") .OrWhere("n.publisher =~ {filter}") .OrWhere("str(n.platforms) =~ {filter}") .WithParam("filter", ".*(?i)" + filter + ".*"); var gameNodes = queryBuilder .Return <Game>("n") .OrderBy("tolower(n.title)") .Skip((page - 1) * paginationAmount) .Limit(paginationAmount) .Results; foreach (var game in gameNodes) { result.Add(toJson(game)); } var gameCount = queryBuilder .Return(() => Return.As <int>("count(n)")) .Results.Single(); result.Add(gameCount.ToString()); return(result.ToArray()); }
public static void Register(HttpConfiguration config) { config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional } ); // Web API configuration and services // Web API routes config.MapHttpAttributeRoutes(); config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml"); config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType); //Use an IoC container and register as a Singleton var url = ConfigurationManager.AppSettings["GraphDBUrl"]; var user = ConfigurationManager.AppSettings["GraphDBUser"]; var password = ConfigurationManager.AppSettings["GraphDBPassword"]; var client = //new GraphClient(new Uri(url), user, password); new GraphClient(new Uri(string.Format(url, user, password)), new HttpClientWrapper( new HttpClient() { Timeout = TimeSpan.FromMinutes(20) }) ); client.Connect(); GraphClient = client; }
public void addMovie([FromBody] Movie m) { var client = new GraphClient(new Uri("http://localhost:7474/db/data"), "neo4j", "edukacija"); client.Connect(); Dictionary <string, object> queryDict = new Dictionary <string, object>(); queryDict.Add("title", m.title); queryDict.Add("released", m.released); queryDict.Add("genre", m.genre); queryDict.Add("tagline", m.tagline); queryDict.Add("picture", m.picture); queryDict.Add("trailer", m.trailer); var query = new Neo4jClient.Cypher.CypherQuery("MERGE (n:Movie {title:'" + m.title + "', released:" + m.released + ", genre:'" + m.genre + "', tagline:'" + m.tagline + "', picture:'" + m.picture + "', trailer:'" + m.trailer + "' , rate:" + m.rate + "}) return n", queryDict, CypherResultMode.Set); ((IRawGraphClient)client).ExecuteCypher(query); }
public string[] GetFriendRequests(string username) { IList <string> friendRequests = new List <string>(); GraphClient client = new GraphClient(new Uri("http://localhost:7474/db/data")); client.Connect(); var senders = client.Cypher .Match("(user:User)<-[r:REQUEST_FRIEND]-(friend:User)") .Where((User user) => user.username == username) .Return(friend => friend.As <User>()) .Results; if (senders.Count() > 0) { foreach (User user in senders) { friendRequests.Add(toJson(user)); } } return(friendRequests.ToArray()); }
private void btnConnect_Click(object sender, EventArgs e) { if (txtUsername.Text == "" || txtPass.Text == "") { MessageBox.Show("Credential Not Empty", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { try { GraphClient client = new GraphClient(new Uri("http://localhost:7474/db/data"), txtUsername.Text, txtPass.Text); client.Connect(); lblConnected.Text = "Database Connected"; lblConnected.ForeColor = Color.Green; } catch { lblConnected.Text = "Database Failed"; lblConnected.ForeColor = Color.Red; } } }
public static void Register(HttpConfiguration config) { // Web API configuration and services // Web API routes config.MapHttpAttributeRoutes(); config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml"); config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType); //Use an IoC container and register as a Singleton var url = ConfigurationManager.AppSettings["GraphDBUrl"]; var user = ConfigurationManager.AppSettings["GraphDBUser"]; var password = ConfigurationManager.AppSettings["GraphDBPassword"]; var client = new GraphClient(new Uri(url), user, password); client.Connect(); GraphClient = client; }
public string[] GetUsersPagin(string filter, int page, int activeUser) { List <string> result = new List <string>(); GraphClient client = new GraphClient(new Uri("http://localhost:7474/db/data")); client.Connect(); var queryBuilder = client.Cypher .Match("(n:User)") .Where("n.username =~ {filter}") .OrWhere("n.firstName =~ {filter}") .OrWhere("n.lastName =~ {filter}") .OrWhere("n.status =~ {filter}") .WithParam("filter", ".*(?i)" + filter + ".*"); var userNodes = queryBuilder .Return <User>("n") .OrderBy("tolower(n.username)") .Skip((page - 1) * paginationAmount) .Limit(paginationAmount) .Results; foreach (var user in userNodes) { result.Add(toJson(user)); } var userCount = queryBuilder .Return(() => Return.As <int>("count(n)")) .Results.Single(); result.Add(userCount.ToString()); return(result.ToArray()); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddSingleton <IGraphClient>(sp => { var graphClient = new GraphClient(new Uri("http://localhost:7474/db/data"), "neo4j", "pwauai2019"); graphClient.Connect(); return(graphClient); }); services.AddSingleton <AulaRepository>(); services.AddSingleton <CursadaRepository>(); services.AddSingleton <IAulaService, AulaService>(); services.AddSingleton <ICursadaService, CursadaService>(); }
public List <Actor> addActor([FromBody] Actor a) { var client = new GraphClient(new Uri("http://localhost:7474/db/data"), "neo4j", "edukacija"); client.Connect(); Dictionary <string, object> queryDict = new Dictionary <string, object>(); queryDict.Add("name", a.name); queryDict.Add("born", a.born); queryDict.Add("birthplace", a.birthplace); queryDict.Add("biography", a.biography); queryDict.Add("picture", a.picture); var query = new Neo4jClient.Cypher.CypherQuery("MERGE (n:Person {name:'" + a.name + "', born:" + a.born + ", birthplace:'" + a.birthplace + "', biography:'" + a.biography + "', picture:'" + a.picture + "'}) return n", queryDict, CypherResultMode.Set); List <Actor> actors = ((IRawGraphClient)client).ExecuteGetCypherResults <Actor>(query).ToList(); return(actors.ToList()); }
public IEnumerable <Comment> GetCommentsForSession(int id) { var client = new GraphClient(new Uri("http://localhost:7474/db/data")); client.Connect(); var result = client.Cypher.Start(new { s = string.Format("node({0})", id) }) .Match("(u:User)<-[mb:Created_By]-(c:Comment)-[o:On_Item]->(s:Session)") .OptionalMatch("(c)-[lb:Liked_By]->(lbu:User)") .Return((u, mb, c, s, o, lbu) => new { Comment = c.As <Comment>(), MadeByUser = u.Node <UserInfo>(), CommentNodeId = c.Id(), LikedByUsers = lbu.CollectAs <UserInfo>() }) .Results.Select(x => { x.Comment.MadeBy = x.MadeByUser.Data; x.Comment.MadeBy.NodeId = (int)x.MadeByUser.Reference.Id; x.Comment.MadeBy.ProviderUserKey = x.MadeByUser.Reference.Id; x.Comment.Id = (int)x.CommentNodeId; x.Comment.LikedBy = x.LikedByUsers.Select(ui => new UserInfo { Username = ui.Data.Username, ProviderUserKey = ui.Reference.Id, NodeId = (int)ui.Reference.Id }).ToList(); return(x.Comment); }); return(result.ToList()); }
public string AddNewUser(User newUser) { GraphClient client = new GraphClient(new Uri("http://localhost:7474/db/data")); client.Connect(); var results = client.Cypher .Match("(user:User)") .Where((User user) => user.username == newUser.username) .Return(user => user.As <User>()).Results; // There's already a user with that username if (results.Count() > 0) { return("failed"); } Random rnd = new Random(); int avatarId = rnd.Next(1, 10); newUser.avatarImage = "avatar" + avatarId + ".jpg"; newUser.status = "Member"; newUser.sessionId = CreateSHAHash(newUser.username + newUser.password + DateTime.Now.ToString("MM\\/dd\\/yyyy h\\:mm tt")); TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1); int secondsSinceEpoch = (int)t.TotalSeconds; newUser.memberSinceDate = secondsSinceEpoch.ToString(); client.Cypher .Create("(user:User {newUser})") .WithParam("newUser", newUser) .ExecuteWithoutResults(); return(toJson(newUser)); }
public UserLableDTO GetUser(int id) { using (var client = new GraphClient(new Uri(connectionString), login, pass)) { client.Connect(); var user = client.Cypher .Match("(u:User)") .Where((UserLableDTO u) => u.User_Id == id) .Return(u => u.As <UserLableDTO>()) .Results; UserLableDTO to_ret = new UserLableDTO() { User_Id = id }; foreach (var u in user) { to_ret.User_Id = u.User_Id; to_ret.User_Login = u.User_Login; to_ret.User_Name = u.User_Name; to_ret.User_Last_Name = u.User_Last_Name; } return(to_ret); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvcCore() .SetCompatibilityVersion(CompatibilityVersion.Version_2_2) .AddAuthorization() .AddFormatterMappings() .AddJsonFormatters() .AddApiExplorer() .AddCors(options => { options.AddPolicy("AllowAny", builder => { builder.AllowAnyOrigin(); builder.AllowAnyMethod(); builder.AllowAnyHeader(); }); }); // OpenID Connect authorization code exchanger services.AddGoogleOpenIdConnectProvider(this.configuration["Auth:Google:RequestUri"]); services.AddSingleton <ITokenService, TokenService>(); // Database services.AddSingleton <IDatabaseService, DatabaseService>(); services.AddSingleton <IGraphClient>(serviceProvider => { var logger = serviceProvider.GetRequiredService <ILogger <Startup> >(); var baseUri = new Uri(this.configuration["Database:Uri"]); var dbUri = new Uri(baseUri, "/db/data"); logger.LogDebug("Connecting to database"); var client = new GraphClient(dbUri, this.configuration["Database:Username"], this.configuration["Database:Password"]); client.Connect(); logger.LogDebug("Connected"); return(client); }); // Swagger docs (development only) services.AddSwaggerDocument(options => { options.Version = Program.Version; options.Title = "SmartAdvisor API"; }); // Authentication (using the Authorization header) services.AddAuthentication(options => { options.DefaultScheme = this.configuration["DefaultAuthScheme"]; }) .AddJwtBearer(JwtBearerDefaults.AuthenticationScheme, builder => { var configSection = this.configuration.GetSection("Auth:Tokens"); var localKey = configSection["EncryptionKey"]; builder.RequireHttpsMetadata = false; builder.SaveToken = true; builder.TokenValidationParameters = new TokenValidationParameters { IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(localKey)), ValidateAudience = false, ValidateLifetime = true, ValidIssuer = configSection["Issuer"], }; }); }
public NodeController() { _graphClient = new GraphClient(new Uri("http://localhost:7474/db/data")); _graphClient.Connect(); }
public void agregarUsuario(Usuario usuario) { //Agrega usuarios a la BD client.Connect(); var node = usuario; client.Cypher .Create("(u:Usuario {nuevoUsuario})") .WithParam("nuevoUsuario", node) .ExecuteWithoutResultsAsync() .Wait(); }
private static void Connect() { client = new GraphClient(new Uri("http://localhost.:7474/db/data")); client.Connect(); }
public void ExecuteMultipleStatementInOneRequestHttpRequest() { const string headerName = "MyTestHeader"; const string headerValue = "myTestHeaderValue"; var customHeaders = new NameValueCollection { {headerName, headerValue} }; var initTransactionRequest = MockRequest.PostJson("/transaction", @"{ 'statements': [{'statement': 'MATCH n\r\nRETURN count(n)', 'resultDataContents':[], 'parameters': {}}, {'statement': 'MATCH t\r\nRETURN count(t)', 'resultDataContents':[], 'parameters': {}}]}"); var commitRequest = MockRequest.PostJson("/transaction/1/commit", @"{'statements': []}"); using (var testHarness = new RestTestHarness { { initTransactionRequest, MockResponse.Json(201, TransactionRestResponseHelper.GenerateInitTransactionResponse(1), "http://foo/db/data/transaction/1") }, { commitRequest, MockResponse.Json(200, @"{'results':[], 'errors':[] }") } }) { var response = MockResponse.NeoRoot20(); testHarness.Add(MockRequest.Get(""), response); var httpClient = testHarness.GenerateHttpClient("http://foo/db/data"); testHarness.CreateAndConnectTransactionalGraphClient(); ITransactionalGraphClient client = new GraphClient(new Uri("http://foo/db/data"), httpClient); client.Connect(); using (var transaction = client.BeginTransaction()) { // dummy query to generate request var rawClient = client as IRawGraphClient; if (rawClient == null) { Assert.Fail("ITransactionalGraphClient is not IRawGraphClient"); } var queries = new List<CypherQuery>() { client.Cypher .Match("n") .Return(n => n.Count()) .Query, client.Cypher .Match("t") .Return(t => t.Count()) .Query }; httpClient.ClearReceivedCalls(); rawClient.ExecuteMultipleCypherQueriesInTransaction(queries, customHeaders); transaction.Commit(); var calls = httpClient.ReceivedCalls().ToList(); Assert.IsNotEmpty(calls); HttpRequestMessage requestMessage = null; foreach (var call in calls) { if (call.GetArguments().Single().GetType() == typeof (HttpRequestMessage)) { requestMessage = (HttpRequestMessage) call.GetArguments().Single(); } } Assert.IsNotNull(requestMessage); var customHeader = requestMessage.Headers.Single(h => h.Key == headerName); Assert.IsNotNull(customHeader); Assert.AreEqual(headerValue, customHeader.Value.Single()); } } }
protected void Page_Load(object sender, EventArgs e) { string CompanyName = Session["company"].ToString(); id_ShoutKeyword.InnerHtml += CompanyName; //------------------------------------------------------------------------------------------ CompanyName = CompanyName.ToLower(); CompanyName = CompanyName.Replace('ö', 'o'); CompanyName = CompanyName.Replace('ü', 'u'); CompanyName = CompanyName.Replace('ğ', 'g'); CompanyName = CompanyName.Replace('ş', 's'); CompanyName = CompanyName.Replace('ı', 'i'); //------------------------------------------------------------------------------------------ var GSearch = new GoogleSearch(CompanyName); string URL = null; //istenilen şirketin url'sini alma http://companyname.com foreach (var item in GSearch.GoogleSearch_().Items) { URL = Server.HtmlEncode(item.Link); break; } //Host www.companyname.com UriParser up = new UriParser(URL); up.UriParse(); string host = up.host.Remove(0, 4); //IP ------------------------------------------------------------------------------------------------ GetIPAddress ip = new GetIPAddress(host); IPAddress[] IP = ip.GetIP(); // Company Bileşenlerini setleme ------------------------------------------------------------------------------------ CreateGraph cg = new CreateGraph(); cg.CreateRootNode(); Company_Node comp = new Company_Node { name = CompanyName, comp_host = host, comp_ip = IP[0].ToString() }; cg.CreateRelationRoot_Company(comp); Shodan_Node sh = new Shodan_Node { name = "Shodan" + CompanyName.Replace(" ", "") }; cg.CreateRelationCompany_Shodan(sh, comp); //ShodanApi---------------------------------------------------------------------------------------------------------------------------- Dictionary <string, object> ShodanResults = new Dictionary <string, object>(); SeeResult Shodan = new SeeResult(IP[0]); ShodanResults = Shodan.SearchResult(); Shodan_Node.SmallNodes_Ports port = new Shodan_Node.SmallNodes_Ports(); foreach (KeyValuePair <string, object> item in ShodanResults) { if (item.Key == "ports") { var obj = ((IEnumerable)item.Value).Cast <object>().ToList(); foreach (var item2 in obj) { port.ports = item2.ToString(); cg.CreateRelationShodan_Ports(sh, port); } } } //string shodanResults = string.Join(Environment.NewLine, ShodanResults.Select(x => x.Key + " = " + x.Value).ToArray()); Shodan_Node.SmallNodes_ASN _asn = new Shodan_Node.SmallNodes_ASN(); Shodan_Node.SmallNodes_CountryName country = new Shodan_Node.SmallNodes_CountryName(); Shodan_Node.SmallNodes_IPsTR ipStr = new Shodan_Node.SmallNodes_IPsTR(); Shodan_Node.SmallNodes_Isp _isp = new Shodan_Node.SmallNodes_Isp(); Shodan_Node.SmallNodes_LastUp lastup = new Shodan_Node.SmallNodes_LastUp(); Shodan_Node.SmallNodes_Org org = new Shodan_Node.SmallNodes_Org(); foreach (KeyValuePair <string, object> item in ShodanResults) { if (item.Key == "org") { org.org = item.Value.ToString(); cg.CreateRelationShodan_org(sh, org); } else if (item.Key == "isp") { _isp.isp = item.Value.ToString(); cg.CreateRelationShodan_Isp(sh, _isp); } else if (item.Key == "last_update") { lastup.last_update = item.Value.ToString(); cg.CreateRelationShodan_LastUpdate(sh, lastup); } else if (item.Key == "country_name") { country.country_name = item.Value.ToString(); cg.CreateRelationShodan_CountryName(sh, country); } else if (item.Key == "ip_str") { ipStr.ip_str = item.Value.ToString(); cg.CreateRelationShodan_IPsTR(sh, ipStr); } else if (item.Key == "asn") { _asn.asn = item.Value.ToString(); cg.CreateRelationShodan_ASN(sh, _asn); } } //Whois ------------------------------------------------------------------------------------------------------------------------------------ var whois = new WhoisLookup().Lookup(host); Whois_Node who = new Whois_Node(); who.WhoisText = whois.Text.ToArray(typeof(string)) as string[]; cg.CreateRelationCompany_Whois(who, comp); //Geocoder------------------------------------------------------------------------------------------------------------------------------------ GeoCoderInformation.GeocoderInfo GeoInfo = new GeoCoderInformation.GeocoderInfo(CompanyName); Geocode_Node geoname = new Geocode_Node(); GeoLatitude _lat = new GeoLatitude(); GeoLongitude _lon = new GeoLongitude(); foreach (var item in GeoInfo.GetGeocodeResponse().results) { foreach (var item2 in item.address_components) { geoname.name = item2.long_name; _lat.Geo_lat = item.geometry.location.lat; _lon.Geo_lon = item.geometry.location.lng; } cg.CreateRelationCompany_Geocode(geoname, comp, _lon, _lat); } //WikiData--------------------------------------------------------------------------------------------------------------------- GetWikiData.WikiData wiki = new GetWikiData.WikiData(CompanyName); wiki.GetWikiData(); Wikipedia_Node wikinode = new Wikipedia_Node { name = wiki.Title.Replace("'", ""), description = wiki.Description.Replace("'", "") }; cg.CreateRelationCompany_Wikipedia(wikinode, comp); //Google Search -------------------------------------------------------------------------------------------------------------- GoogleSearchEngine.GoogleSearch Gsearch = new GoogleSearchEngine.GoogleSearch(CompanyName); Facebook_Node fb = new Facebook_Node(); foreach (var item in Gsearch.FacebookSearch().Items) { fb.name = item.Title.Replace("'", ""); fb.fb_url = item.Link; cg.CreateRelationCompany_Facebook(fb, comp); } GooglePlus_Node _gp = new GooglePlus_Node(); foreach (var item in Gsearch.GooglePlusSearch().Items) { _gp.name = item.Title.Replace("'", ""); _gp.gp_url = item.Link; cg.CreateRelationCompany_GooglePlus(_gp, comp); } Linkedin_Node ln = new Linkedin_Node(); foreach (var item in Gsearch.LinkedinSearch().Items) { ln.name = item.Title.Replace("'", ""); ln.lin_url = item.Link; cg.CreateRelationCompany_Linkedin(ln, comp); } GoogleNews_Node _gn = new GoogleNews_Node(); foreach (var item in Gsearch.NewsSearch().Items) { _gn.name = item.Title.Replace("'", ""); _gn.gn_url = item.Link; cg.CreateRelationCompany_GoogleNews(_gn, comp); } Reddit_Node red = new Reddit_Node(); foreach (var item in GSearch.RedditSearch().Items) { red.name = item.Title.Replace("'", ""); red.red_url = item.Link; cg.CreateRelationCompany_Reddit(red, comp); } Twitter_Node tw = new Twitter_Node(); foreach (var item in Gsearch.TwitterSearch().Items) { tw.name = item.Title.Replace("'", ""); tw.tw_url = item.Link; cg.CreateRelationCompany_Twitter(tw, comp); } //-------------------GET NEO4J COMPANY DATA----------------------------------- var graphClient = new GraphClient(new Uri(uri), Db_id, DB_pass); graphClient.Connect(); var FacebookQuery = graphClient.Cypher .Match("p=(c { name: '" + CompanyName + "' })-[:Facebook]->(f)") .Return(f => f.As <GetData._Facebook_Node>()) .Results; foreach (var item in FacebookQuery) { facebookContent.InnerHtml += "<a href='" + item.fb_url + "' target='_blank'>" + item.fb_url + "</a><br>"; } var TwitterQuery = graphClient.Cypher .Match("p=(c{name:'" + CompanyName + "'}) -[:Twitter]->(t)") .Return(t => t.As <GetData._Twitter_Node>()) .Results; foreach (var item in TwitterQuery) { twitterContent.InnerHtml += "<a href='" + item.tw_url + "' target='_blank'>" + item.tw_url + "</a><br>"; } var RedditQuery = graphClient.Cypher .Match("p=(c{name:'" + CompanyName + "'}) -[:Reddit]->(r)") .Return(r => r.As <GetData._Reddit_Node>()) .Results; foreach (var item in RedditQuery) { redditContent.InnerHtml += "<a href='" + item.red_url + "' target='_blank'>" + item.red_url + "</a><br>"; } var LinkedinQuery = graphClient.Cypher .Match("p=(c{name:'" + CompanyName + "'})-[:Linkedin]->(l)") .Return(l => l.As <GetData._Linkedin_Node>()) .Results; foreach (var item in LinkedinQuery) { linkedinContent.InnerHtml += "<a href='" + item.lin_url + "' target='_blank'>" + item.lin_url + "</a><br>"; } var GoogleNewsQuery = graphClient.Cypher .Match("p=(c{name:'" + CompanyName + "'})-[:GoogleNews]->(gn)") .Return(gn => gn.As <GetData._GoogleNews_Node>()) .Results; foreach (var item in GoogleNewsQuery) { googlenewsContent.InnerHtml += "<a href='" + item.gn_url + "' target='_blank'>" + item.gn_url + "</a><br>"; } var GooglePlusQuery = graphClient.Cypher .Match("p=(c{name:'" + CompanyName + "'})-[:GooglePlus]->(gp)") .Return(gp => gp.As <GetData._GooglePlus_Node>()) .Results; foreach (var item in GooglePlusQuery) { googleplusContent.InnerHtml += "<a href='" + item.gp_url + "' target='_blank'>" + item.gp_url + "</a><br>"; } var WhoisQuery = graphClient.Cypher .Match("p=(c{name:'" + CompanyName + "'})-[:Whois]->(wh)") .Return(wh => wh.As <GetData._Whois_Node>()) .Results; foreach (var item in WhoisQuery) { for (int i = 0; i < item.WhoisText.Length; i++) { whoisContent.InnerHtml += item.WhoisText[i] + "<br>"; } } var WikipediaQuery = graphClient.Cypher .Match("p=(c{name:'" + CompanyName + "'})-[:Wikipedia]->(w)") .Return(w => w.As <GetData._Wikipedia_Node>()) .Results; foreach (var item in WikipediaQuery) { if (item.description == "" || item.description == null) { wikipediaContent.InnerHtml += "No Records Found"; } else { wikipediaContent.InnerHtml += item.description; } } var ShodanORGQuery = graphClient.Cypher .Match("p=(sh {name:'Shodan" + CompanyName + "'})-[:ORG]->(Org)") .Return(Org => Org.As <GetData._Shodan_Node._SmallNodes_Org>()) .Results; foreach (var item in ShodanORGQuery) { if (ShodanORGQuery.Count() == 0) { orgContent.InnerHtml += "No Record Found!"; } else { orgContent.InnerHtml += item.org + "<br>"; } } var ShodanISPQuery = graphClient.Cypher .Match("p=(sh {name:'Shodan" + CompanyName + "'})-[:ISP]->(isp)") .Return(isp => isp.As <GetData._Shodan_Node._SmallNodes_Isp>()) .Results; foreach (var item in ShodanISPQuery) { if (ShodanISPQuery.Count() == 0) { ispContent.InnerHtml += "No Record Found!"; } else { ispContent.InnerHtml += item.isp + "<br>"; } } var ShodanLASTUPQuery = graphClient.Cypher .Match("p=(sh {name:'Shodan" + CompanyName + "'})-[:LastUpdate]->(LastUp)") .Return(LastUp => LastUp.As <GetData._Shodan_Node._SmallNodes_LastUp>()) .Results; foreach (var item in ShodanLASTUPQuery) { if (ShodanLASTUPQuery.Count() == 0) { lastupContent.InnerHtml += "No Record Found!"; } else { lastupContent.InnerHtml += item.last_update + "<br>"; } } var ShodanCOUNTRYQuery = graphClient.Cypher .Match("p=(sh {name:'Shodan" + CompanyName + "'})-[:COUNTRY]->(CountryName)") .Return(CountryName => CountryName.As <GetData._Shodan_Node._SmallNodes_CountryName>()) .Results; foreach (var item in ShodanCOUNTRYQuery) { if (ShodanCOUNTRYQuery.Count() == 0) { countryContent.InnerHtml += "No Record Found!"; } else { countryContent.InnerHtml += item.country_name + "<br>"; } } var ShodanIPSTRQuery = graphClient.Cypher .Match("p=(sh {name:'Shodan" + CompanyName + "'})-[:IPSTR]->(ip_str)") .Return(ip_str => ip_str.As <GetData._Shodan_Node._SmallNodes_IPsTR>()) .Results; foreach (var item in ShodanIPSTRQuery) { if (ShodanIPSTRQuery.Count() == 0) { ipstrContent.InnerHtml += "No Record Found!"; } else { ipstrContent.InnerHtml += item.ip_str + "<br>"; } } var ShodanASNQuery = graphClient.Cypher .Match("p=(sh {name:'Shodan" + CompanyName + "'})-[:ASN]->(asn)") .Return(asn => asn.As <GetData._Shodan_Node._SmallNodes_ASN>()) .Results; foreach (var item in ShodanASNQuery) { if (ShodanASNQuery.Count() == 0) { asnContent.InnerHtml += "No Record Found!"; } else { asnContent.InnerHtml += item.asn + "<br>"; } } var ShodanPORTQuery = graphClient.Cypher .Match("p=(sh {name:'Shodan" + CompanyName + "'})-[:OPEN_PORT]->(ports)") .Return(ports => ports.As <GetData._Shodan_Node._SmallNodes_Ports>()) .Results; foreach (var item in ShodanPORTQuery) { if (ShodanPORTQuery.Count() == 0) { portContent.InnerHtml += "No Record Found!"; } else { portContent.InnerHtml += item.ports + "<br>"; } } var GeocodeQuery = graphClient.Cypher .Match("p=(c{name:'" + CompanyName + "'})-[:Geocode]->(geo)") .Return(geo => geo.As <GetData._Geocode_Node>()).Results; foreach (var item in GeocodeQuery) { GeocodeContent.InnerHtml += "<h3>" + item.name + "</h3><br>"; var GeoLonQuery = graphClient.Cypher.Match("(geo{name:'" + item.name + "'})-[:longitude]->(lon)").Return(lon => lon.As <GetData._GeoLongitude>()).Results; foreach (var itemLon in GeoLonQuery) { GeocodeContent.InnerHtml += "<b>Longitude</b>" + itemLon.Geo_lon + "    "; } var GeoLatQuery = graphClient.Cypher.Match("(geo{name:'" + item.name + "'})-[:latitude]->(lat)").Return(lat => lat.As <GetData._GeoLatitude>()).Results; foreach (var itemLat in GeoLatQuery) { GeocodeContent.InnerHtml += "<b>Latitude</b>" + itemLat.Geo_lat; } } }
public void DoesntSetHeaders_WhenNotSet() { const string queryText = "MATCH n SET n.Value = 'value'"; var cypherQuery = new CypherQuery(queryText, new Dictionary<string, object>(), CypherResultMode.Set); var cypherApiQuery = new CypherApiQuery(cypherQuery); using (var testHarness = new RestTestHarness { { MockRequest.Get(""), MockResponse.NeoRoot() }, { MockRequest.PostObjectAsJson("/cypher", cypherApiQuery), MockResponse.Http((int) HttpStatusCode.OK) } }) { var httpClient = testHarness.GenerateHttpClient(testHarness.BaseUri); var graphClient = new GraphClient(new Uri(testHarness.BaseUri), httpClient); graphClient.Connect(); httpClient.ClearReceivedCalls(); ((IRawGraphClient)graphClient).ExecuteCypher(cypherQuery); var call = httpClient.ReceivedCalls().Single(); var requestMessage = (HttpRequestMessage)call.GetArguments()[0]; Assert.IsFalse(requestMessage.Headers.Any(h => h.Key == "max-execution-time")); } }
public void ShouldParseRootApiResponseFromAuthenticatedConnection() { using (var testHarness = new RestTestHarness() { { MockRequest.Get(""), MockResponse.NeoRoot() } }) { var httpClient = testHarness.GenerateHttpClient("http://foo/db/data"); var graphClient = new GraphClient(new Uri("http://*****:*****@foo/db/data"), httpClient); graphClient.Connect(); Assert.AreEqual("/node", graphClient.RootApiResponse.Node); } }
public Skills_service() { graphClient = new GraphClient(new Uri("http://localhost:7474/db/data"), "neo4j", "skills"); graphClient.Connect(); }
public Neo4jRepository() { client = new GraphClient(new Uri("http://localhost:7474/db/data")); client.Connect(); }
public void SendsCommandWithCorrectTimeout() { const int expectedMaxExecutionTime = 100; const string queryText = @"START d=node({p0}), e=node({p1}) MATCH p = allShortestPaths( d-[*..15]-e ) RETURN p"; var parameters = new Dictionary<string, object> { {"p0", 215}, {"p1", 219} }; var cypherQuery = new CypherQuery(queryText, parameters, CypherResultMode.Set,CypherResultFormat.Transactional ,maxExecutionTime: expectedMaxExecutionTime); var cypherApiQuery = new CypherApiQuery(cypherQuery); using (var testHarness = new RestTestHarness { { MockRequest.Get(""), MockResponse.NeoRoot() }, { MockRequest.PostObjectAsJson("/cypher", cypherApiQuery), MockResponse.Json(HttpStatusCode.OK, @"{ 'data' : [ [ { 'start' : 'http://foo/db/data/node/215', 'nodes' : [ 'http://foo/db/data/node/215', 'http://foo/db/data/node/0', 'http://foo/db/data/node/219' ], 'length' : 2, 'relationships' : [ 'http://foo/db/data/relationship/247', 'http://foo/db/data/relationship/257' ], 'end' : 'http://foo/db/data/node/219' } ], [ { 'start' : 'http://foo/db/data/node/215', 'nodes' : [ 'http://foo/db/data/node/215', 'http://foo/db/data/node/1', 'http://foo/db/data/node/219' ], 'length' : 2, 'relationships' : [ 'http://foo/db/data/relationship/248', 'http://foo/db/data/relationship/258' ], 'end' : 'http://foo/db/data/node/219' } ] ], 'columns' : [ 'p' ] }") } }) { var httpClient = testHarness.GenerateHttpClient(testHarness.BaseUri); var graphClient = new GraphClient(new Uri(testHarness.BaseUri), httpClient); graphClient.Connect(); httpClient.ClearReceivedCalls(); ((IRawGraphClient)graphClient).ExecuteGetCypherResults<object>(cypherQuery); var call = httpClient.ReceivedCalls().Single(); var requestMessage = (HttpRequestMessage)call.GetArguments()[0]; var maxExecutionTimeHeader = requestMessage.Headers.Single(h => h.Key == "max-execution-time"); Assert.AreEqual(expectedMaxExecutionTime.ToString(CultureInfo.InvariantCulture), maxExecutionTimeHeader.Value.Single()); } }
public void DoesntSendMaxExecutionTime_WhenNotAddedToQuery() { const string queryText = @"START d=node({p0}), e=node({p1}) MATCH p = allShortestPaths( d-[*..15]-e ) RETURN p"; var parameters = new Dictionary<string, object> { {"p0", 215}, {"p1", 219} }; var cypherQuery = new CypherQuery(queryText, parameters, CypherResultMode.Set); var cypherApiQuery = new CypherApiQuery(cypherQuery); using (var testHarness = new RestTestHarness { { MockRequest.Get(""), MockResponse.NeoRoot() }, { MockRequest.PostObjectAsJson("/cypher", cypherApiQuery), MockResponse.Json(HttpStatusCode.OK, @"{ 'data' : [ [ { 'start' : 'http://foo/db/data/node/215', 'nodes' : [ 'http://foo/db/data/node/215', 'http://foo/db/data/node/0', 'http://foo/db/data/node/219' ], 'length' : 2, 'relationships' : [ 'http://foo/db/data/relationship/247', 'http://foo/db/data/relationship/257' ], 'end' : 'http://foo/db/data/node/219' } ], [ { 'start' : 'http://foo/db/data/node/215', 'nodes' : [ 'http://foo/db/data/node/215', 'http://foo/db/data/node/1', 'http://foo/db/data/node/219' ], 'length' : 2, 'relationships' : [ 'http://foo/db/data/relationship/248', 'http://foo/db/data/relationship/258' ], 'end' : 'http://foo/db/data/node/219' } ] ], 'columns' : [ 'p' ] }") } }) { var httpClient = testHarness.GenerateHttpClient(testHarness.BaseUri); var graphClient = new GraphClient(new Uri(testHarness.BaseUri), httpClient); graphClient.Connect(); httpClient.ClearReceivedCalls(); ((IRawGraphClient)graphClient).ExecuteGetCypherResults<object>(cypherQuery); var call = httpClient.ReceivedCalls().Single(); var requestMessage = (HttpRequestMessage)call.GetArguments()[0]; Assert.IsFalse(requestMessage.Headers.Any(h => h.Key == "max-execution-time")); } }
public void ShouldSendCustomUserAgent() { // Arrange var httpClient = Substitute.For<IHttpClient>(); var graphClient = new GraphClient(new Uri("http://localhost"), httpClient); var expectedUserAgent = graphClient.ExecutionConfiguration.UserAgent; httpClient .SendAsync(Arg.Do<HttpRequestMessage>(message => { // Assert Assert.IsTrue(message.Headers.Contains("User-Agent"), "Contains User-Agent header"); var userAgent = message.Headers.GetValues("User-Agent").Single(); Assert.AreEqual(expectedUserAgent, userAgent, "User-Agent header value is correct"); })) .Returns(ci => { var response = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(@"{ 'cypher' : 'http://foo/db/data/cypher', 'batch' : 'http://foo/db/data/batch', 'node' : 'http://foo/db/data/node', 'node_index' : 'http://foo/db/data/index/node', 'relationship_index' : 'http://foo/db/data/index/relationship', 'reference_node' : 'http://foo/db/data/node/123', 'neo4j_version' : '1.5.M02', 'extensions_info' : 'http://foo/db/data/ext', 'extensions' : { 'GremlinPlugin' : { 'execute_script' : 'http://foo/db/data/ext/GremlinPlugin/graphdb/execute_script' } } }") }; var task = new Task<HttpResponseMessage>(() => response); task.Start(); return task; }); // Act graphClient.Connect(); }
/// <summary> /// Class constructor /// </summary> /// <param name="config"></param> public ReportService(IConfiguration config) { _client = new GraphClient(new Uri(config.GetConnectionString("NEO4J"))); _client.Connect(); }
public void ShouldFireOnCompletedEvenWhenException() { var httpClient = Substitute.For<IHttpClient>(); httpClient .SendAsync(Arg.Any<HttpRequestMessage>()) .Returns(callInfo => { throw new NotImplementedException(); }); var graphClient = new GraphClient(new Uri("http://foo/db/data"), httpClient); OperationCompletedEventArgs operationCompletedArgs = null; graphClient.OperationCompleted+= (s, e) => { operationCompletedArgs = e; }; // act Assert.Throws<NotImplementedException>(() => graphClient.Connect()); Assert.NotNull(operationCompletedArgs); Assert.That(operationCompletedArgs.HasException); Assert.AreEqual(typeof(NotImplementedException), operationCompletedArgs.Exception.GetType()); }
public void SendsCommandWithCustomHeaders() { const string queryText = "MATCH n SET n.Value = 'value'"; const int expectedMaxExecutionTime = 100; const string headerName = "MyTestHeader"; const string headerValue = "myTestHeaderValue"; var customHeaders = new NameValueCollection(); customHeaders.Add(headerName, headerValue); var cypherQuery = new CypherQuery(queryText, new Dictionary<string, object>(), CypherResultMode.Set, CypherResultFormat.DependsOnEnvironment, maxExecutionTime: expectedMaxExecutionTime, customHeaders: customHeaders); var cypherApiQuery = new CypherApiQuery(cypherQuery); using (var testHarness = new RestTestHarness { { MockRequest.Get(""), MockResponse.NeoRoot() }, { MockRequest.PostObjectAsJson("/cypher", cypherApiQuery), MockResponse.Http((int) HttpStatusCode.OK) } }) { var httpClient = testHarness.GenerateHttpClient(testHarness.BaseUri); var graphClient = new GraphClient(new Uri(testHarness.BaseUri), httpClient); graphClient.Connect(); httpClient.ClearReceivedCalls(); ((IRawGraphClient)graphClient).ExecuteCypher(cypherQuery); var call = httpClient.ReceivedCalls().Single(); var requestMessage = (HttpRequestMessage)call.GetArguments()[0]; var maxExecutionTimeHeader = requestMessage.Headers.Single(h => h.Key == "max-execution-time"); Assert.AreEqual(expectedMaxExecutionTime.ToString(CultureInfo.InvariantCulture), maxExecutionTimeHeader.Value.Single()); var customHeader = requestMessage.Headers.Single(h => h.Key == headerName); Assert.IsNotNull(customHeader); Assert.AreEqual(headerValue, customHeader.Value.Single()); } }
public void CreateANewClient() { graphClient = new GraphClient(new Uri("http://localhost:7474/db/data")); graphClient.Connect(); }
public Task <bool> Start(IEnumerable <dynamic> path, dynamic details) { return(Task.Run <bool>(() => { try { var bus = ServiceLocator.Current.GetInstance <Bus>(); inProccess = true; tubeId = path.FirstOrDefault(); if (path.Count() > 3) { logger.Debug("путь длиньше обычного, вероятно используется свитч?"); } //1 get driver var url = ConfigurationManager.AppSettings["neo4j-url"]; var client = new GraphClient(new Uri(url)); client.Connect(); var d = client.Cypher.Match("(t:Tube {id:{tubeId}})-->(d:Device)<--(dr:Driver)"). WithParams(new { tubeId = tubeId }). Return((t, dr) => new { dr = dr.Node <string>(), t = t.Node <string>() }).Results.FirstOrDefault(); if (d == null) { logger.Debug("драйвер не привязан"); return false; } var buff = Convert.FromBase64String(d.dr.ToDynamic().driver); var ass = Assembly.Load(buff); var catalog = new AssemblyCatalog(ass); driver = new DriverGhost(catalog); var tube = d.t.ToDynamic(); driver.Log = (msg) => { logger.Debug("драйвер говорит: {0}", msg); dynamic log = new ExpandoObject(); log.id = Guid.NewGuid(); log.message = msg; log.date = DateTime.Now; log.type = "LogMessage"; log.objectId = tubeId; bus.SendRecords(new dynamic[] { log }); }; driver.Response = () => { var bytes = buffer.ToArray(); buffer.Clear(); return bytes; }; driver.Request = (bytes) => { Session.SendFrame(0, bytes); logger.Debug("от драйвера {0}", string.Join(",", bytes.Select(b => b.ToString("X2")))); }; driver.Cancel = () => { return false; }; driver.Records = (records) => { bus.SendRecords(records); }; driver.Doing("all", tube); } catch (Exception ex) { } finally { inProccess = false; } return true; })); }
private void Connect() { //Make connection client = new GraphClient(new Uri("http://localhost:7474/db/data"), "Sivet", "glashoffhoff456"); client.Connect(); }
static void Main(string[] args) { // TODO: Validate inputs var basePath = args[0]; var neo4jUri = args[1]; var neo4jUsername = args[2]; var neo4jPassword = args[3]; using (var graphClient = new GraphClient(new Uri(neo4jUri), neo4jUsername, neo4jPassword)) { graphClient.JsonContractResolver = new CamelCasePropertyNamesContractResolver(); graphClient.Connect(); ConfigureAsync(graphClient).Wait(); foreach (var filePath in Directory.GetFiles(basePath, "packages.config", SearchOption.AllDirectories)) { var projectName = Path.GetFileName(Path.GetDirectoryName(filePath)); var repositoryName = GetRepositoryName(Path.GetDirectoryName(filePath)); WriteSeperator(); System.Console.WriteLine($"{projectName} ({repositoryName})"); WriteSeperator(); var projectGraphItem = new ProjectGraphItem { Name = projectName, RepositoryName = repositoryName }; AddToNeo4j(graphClient, projectGraphItem); var packagesFile = new PackageReferenceFile(filePath); foreach (var reference in packagesFile.GetPackageReferences()) { AddToNeo4j(graphClient, reference); if (reference.TargetFramework != null) { System.Console.WriteLine($"{reference.Id}: {reference.Version.ToFullString()} ({reference.TargetFramework.Identifier} [{reference.TargetFramework.FullName}])"); } else { System.Console.WriteLine($"{reference.Id}: {reference.Version.ToFullString()}"); } graphClient.Cypher .Match($"(package:{Labels.Package}),(project:{Labels.Project})") .Where((ProjectGraphItem project) => project.Id == projectGraphItem.Id) .AndWhere((PackageGraphItem package) => package.Id == reference.Id) .Merge($"(project)-[:{Relationships.DependsOn}{{ version: {{ version }}, targetFramework: {{ targetFramework }} }}]->(package)") .WithParams(new { Version = reference.Version.ToFullString(), TargetFramework = reference.TargetFramework?.Identifier ?? "" }) .ExecuteWithoutResults(); } System.Console.WriteLine(Environment.NewLine); } } }