public void TestSetUp() { GraphClient = new GraphClient(new Uri("http://localhost:7474/db/data"), "neo4j", "dkschlos"); GraphClient.Connect(); ResetDb(); }
private static Node<PO.Worker> AddWorker(string name, GraphClient Client, Node<PO.Workers>WorkersRootNode) { var workerNodeRef = Client.Create( PO.Worker.Create(name), null, new[] { new IndexEntry { Name = "my_index", KeyValues = new[] { /* new KeyValuePair<string, object>("key", "value"), new KeyValuePair<string, object>("key2", ""), */ new KeyValuePair<string, object>("key3", "value3") } } } ); Client.Update<PO.Worker>(workerNodeRef, node => { node.SetID(workerNodeRef.Id); }); var workersRootNode = WorkersRootNode; var rel = Client.CreateRelationship<PO.Workers, Relationships.HasItemRelationship>( workersRootNode.Reference, new Relationships.HasItemRelationship(workerNodeRef) ); var workerNode = Get(workerNodeRef.Id, Client); return workerNode; }
private static Node<PO.Workers> AddWorkersRootNode(GraphClient client, Node<PO.Root> rootNode) { var nodeRef = client.Create(PO.Workers.Create("Workers"), null, new[]{ new IndexEntry{ Name=NameIndexName, KeyValues=new[]{ new KeyValuePair<string,object>("Name", "Workers") } } }); client.CreateRelationship<PO.Root, Relationships.RelatedToRelationship>(rootNode.Reference, new Relationships.RelatedToRelationship(nodeRef)); var ret = client.Get<PO.Workers>(nodeRef.Id); client.Update<PO.Workers>(ret.Reference, node => { node.SetID(ret.Reference.Id); }); ret = client.Get<PO.Workers>(nodeRef.Id); Debug.Assert(ret.Reference.Id == ret.Data.ID); Debug.Assert(ret.Reference.Id == nodeRef.Id); Debug.Assert(ret.Reference.Id == GetWorkersRootNode(client, rootNode).Reference.Id); return ret; }
// --- konstruktor koji radi sa tajmerom --- public Proveri_aktivne_projekte(int sati, GraphClient gc) { client = gc; setTimer(sati); newThread = new Thread(new ThreadStart(proveriProjekte)); newThread.Start(); }
public GraphRepository(IConfiguration configuration) { var client = new GraphClient(new Uri(configuration.GetGraphDbUrl())); client.Connect(); Client = client; }
public void Init() { _graphClient = new GraphClient(new Uri("http://localhost:7475/db/data"), "neo4j", "extra"); _graphClient.Connect(); _graphClient.BeginTransaction(); _dataGenerator = new DbTestDataGenerator(_graphClient); }
public static void VerifyGraph(GraphClient graph) { GraphRawData[] graphData = GetFraphData(graph); NormalizeGraphData(graphData); string serlizedString = JsonConvert.SerializeObject(graphData, Formatting.Indented, new JsonConverter[] { new StringEnumConverter() }); Approvals.Verify(serlizedString); }
public void Init() { try { _graphClient = new GraphClient(new Uri("http://localhost:7474/db/data")); _graphClient.Connect(); } catch (Exception) { throw new Exception("Not Connected To Neo4j Server"); } _relationshipManager = new Neo4jRelationshipManager(); //Chicken and Egg... INodeRepoCreator repoCreator = new NodeRepoCreator(_graphClient,_relationshipManager); var idGenerator = new IdGenerator(repoCreator); idGenerator.LoadGenerator(50); _ownedByService = repoCreator.CreateNode<OwnedBy, StorageLocation>("Name"); _initialAddRef = _ownedByService.UpdateOrInsert(new StorageLocation { Id = 1, Name = "Main WH" }, _graphClient.RootNode); }
static void Main(string[] args) { var graphClient = new GraphClient(new Uri("http://localhost:7474/db/data")); graphClient.Connect(); Fill(graphClient); }
public void Start() { _graphClient = CreateGraphClient(); _indexer = CreateIndexer(); _eventHandlerMapping = CreateEventHandlerMapping(); ConnectToEventstore(); }
static void Main(string[] args) { neo4j = new GraphClient(new Uri("http://localhost:7474/db/data")); neo4j.Connect(); DoBlock("0000000000000000b6359c198b89747d41ebd833fc118e0d920a44ad63af0578"); }
private GraphClient CreateGraphClient() { var graphClient = new GraphClient(new Uri("http://localhost:7474/db/data")); graphClient.Connect(); DeleteAll(graphClient); return graphClient; }
public DBconennector() { client = new GraphClient(new Uri("http://*****:*****@localhost:7474/db/data")); client.Connect(); cities = new List<string>(); }
private void DeleteAll(GraphClient graphClient) { graphClient.Cypher.Match("(n)") .OptionalMatch("(n)-[r]-()") .Delete("n,r") .ExecuteWithoutResults(); }
private static IGraphClient InitNeo4jClient(IContext context) { var neo4jUri = new Uri(ConfigurationManager.ConnectionStrings["assets"].ConnectionString); var graphClient = new GraphClient(neo4jUri); graphClient.Connect(); return graphClient; }
// This is my reworked version of Readify Api Usage Ideas using the Repository Library // For the original visit - http://hg.readify.net/neo4jclient/src private void Foo() { IGraphClient graph = new GraphClient(new Uri("")); INeo4jRelationshipManager relationshipManager = new Neo4jRelationshipManager(); INodeRepoCreator repoCreator = new NodeRepoCreator(graph, relationshipManager); var idGenerator = new IdGenerator(repoCreator); idGenerator.LoadGenerator(5); var storageLocationService = repoCreator.CreateNode<OwnedBy, StorageLocation>("Name"); var partsService = repoCreator.CreateNode<StoredIn, Part>("Name"); var productService = repoCreator.CreateNode<StoredIn, Product>("Name"); var frameStore = storageLocationService.UpdateOrInsert(new StorageLocation {Name = "Frame Store"}); var mainStore = storageLocationService.UpdateOrInsert(new StorageLocation { Name = "Main Store" }); storageLocationService.UpdateOrInsert(new StorageLocation { Name = "Main Store" }); partsService.UpdateOrInsert(new Part { Name = "Frame" }, frameStore.Reference); productService.UpdateOrInsert(new Product { Name = "Trike", Weight = 2 }, mainStore.Reference); var customerNode = repoCreator.CreateNode<IsCustomerRelationship, Customer>("Name"); customerNode.UpdateOrInsert(new Customer {Name = "Fred", DOB = new DateTime (1, 1, 1970)}); var customerPurchaseService = repoCreator.CreateRelated<Customer, Product, CustomerPurchaseProduct>(customerNode, productService); customerPurchaseService.AddRelatedRelationship("Fred", "Trike", new CustomerPurchaseProduct.PayLoad { Purchased = DateTime.UtcNow}); }
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 == Neo4jSettings.METADATA_TYPE); config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType); //Use an IoC container and register as a Singleton string url = Properties.Settings.Default.GraphDBUrl; string user = Properties.Settings.Default.GraphDBUser; string password = Properties.Settings.Default.GraphDBPassword; IGraphClient client = new GraphClient(new Uri(url), user, password); client.Connect(); GraphClient = client; DataService = new Neo4jDataService(GraphClient); Cache = new Neo4jCacheQuery(); Helper = new Neo4jHelper(DataService, Cache); }
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 client = new GraphClient(new Uri(url),"neo4j","123456"); client.Connect(); GraphClient = client; config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }
private void EnsureGraphClientConstructed() { if (_graphClient != null) { return; } Guard.Null(ConnectionConfig); Guard.NullOrEmpty(ConnectionConfig.GraphUri, "Connection string cannot be null or empty"); var graphUri = new Uri(ConnectionConfig.GraphUri); var httpClientHandler = new HttpClientHandler(); // We want the staging config for proxyUri to be overridden when running in TeamCity // Or you can do something like this C:\>set Data:Neo4j:ProxyUri=http://teamcity.internal.dev:3128 var disableProxyHint = "\"<"; if (ConnectionConfig.HasProxyUri() && !ConnectionConfig.ProxyUri.StartsWith(disableProxyHint)) { httpClientHandler.Proxy = new WebProxy(ConnectionConfig.ProxyUri, true); httpClientHandler.UseProxy = true; }; var httpClient = new HttpClient(httpClientHandler); var httpClientWrapper = new HttpClientWrapper(ConnectionConfig.Username, ConnectionConfig.Password, httpClient); _graphClient = new GraphClient(graphUri, httpClientWrapper); _graphClient.JsonContractResolver = new CamelCasePropertyNamesContractResolver(); }
public IGraphClient Create(IHttpClient httpClient) { var client = new GraphClient(_configuration.RootUri, httpClient); client.Connect(_configuration); return client; }
public Scaffolding() { _client = new GraphClient(new Uri("http://10.0.9.50:7474/db/data")); _client.Connect(); CreateNodesRelationshipsIndexes(); }
protected static Node<PO.Root> GetRootNode(GraphClient client) { var node = client.ExecuteGetCypherResults<Node<PO.Root>>( new CypherQuery(RootNodeQuery , null, CypherResultMode.Set)) .SingleOrDefault(); return node; }
public static GraphClient ConnectToStagedDatabase() { var graphClient = new GraphClient(new Uri(ConfigurationManager.AppSettings["neo4j_database_url"])); graphClient.Connect(); return graphClient; }
protected void Connect() { if (null == _client) { //var client = new GraphClient(new Uri("http://nidhugg.mydomain.local:7474/db/data")); _client = new GraphClient(new Uri("http://nidhugg:7474/db/data")); _client.Connect(); } }
protected async void setHW_Click(object sender, EventArgs e) { Institute i = JsonConvert.DeserializeObject<Institute>(Session["u"].ToString()); GraphClient g = new GraphClient(new Uri("http://neo4jvm1.cloudapp.net:7474/db/data")); g.Connect(); string cc = class_.InnerText; string c= (g.Cypher.Match("(i:`institute`)--(n:`class` {school:\""+i.self+"\",standard:\""+cc[0]+"\",section:\""+cc[4]+"\"})").Where("id(i)="+i.self).Return<string>("id(n)").Results.ToList())[0]; Homework hw = new Homework { detail = detail.InnerText, class_ = c, on = DateTime.Today.ToString("dd-MMM-yy"), subject = "" }; await h.PostAsync(url+"hw/",new StringContent(JsonConvert.SerializeObject(hw),System.Text.Encoding.UTF8,"application/json")); }
private static void Fill(GraphClient graphClient) { using (var context = new AdventureWorks2012Context()) { foreach (var product in context.Products) { graphClient.Create(new Product {ProductId = product.ProductID}); } } }
public IGraphClient Create() { var client = new GraphClient( _configuration.RootUri, _configuration.Username, _configuration.Password); client.Connect(_configuration); return client; }
public SitecoreGraphTest() { //Use an IoC container and register as a Singleton var url = "http://192.168.99.100:32769/db/data"; var user = "******"; var password = "******"; var client = new GraphClient(new Uri(url), user, password); _graph = new SitecoreGraph(); }
public IGraphClient GetClient(Uri rootUri) { return _clients.GetOrAdd( rootUri.ToString(), (key) => { var client = new GraphClient(rootUri); client.Connect(); return client; }); }
public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register( Component.For<IGraphClient>() .UsingFactoryMethod(() => { var client = new GraphClient(new Uri("http://localhost:7474/db/data")); client.Connect(); return client; })); }
/// <summary> /// Retrieve the GraphClient object for the Neo4j graph database configured in application settings. /// </summary> /// <returns>Returns Neo4jClient .NET wrapper for data store management of a graph database instance managed over HTTP.</returns> public static GraphClient GetNeo4jGraphClient() { Neo4jClient.HttpClientWrapper clientWrapper = Processor.GetNeo4jAuthenticatedClient(); Neo4jClient.GraphClient graphClient = new Neo4jClient.GraphClient(new Uri(Configuration.GetDatabaseUri()), clientWrapper); return(graphClient); }