コード例 #1
0
ファイル: FrmMain.cs プロジェクト: jeffijoe/GraphControl-PoC
        /// <summary>
        ///     Initializes a new instance of the <see cref="FrmMain" /> class.
        /// </summary>
        public FrmMain()
        {
            this.InitializeComponent();

            this.server = new GraphServer();
            this.server.Start();
        }
コード例 #2
0
        public void AddPropertyGraphTest()
        {

            using (var GraphServer = new GraphServer(new PropertyGraph(123UL), new IPPort(8080)) {
                                         ServerName = "GraphServer v0.1"
                                     } as IGraphServer)
            {

                var graph = GraphServer.AddPropertyGraph(new PropertyGraph(256UL));
                Assert.IsNotNull(graph);
                Assert.IsNotNull(graph.IdKey);
                Assert.IsNotNull(graph.RevIdKey);
                Assert.AreEqual(256UL, graph.Id);

                var graphs = GraphServer.AllGraphs().ToList();
                Assert.IsNotNull(graphs);
                Assert.AreEqual(2, graphs.Count);

                var graphIds = (from _graph in graphs select _graph.Id).ToList();
                Assert.IsTrue(graphIds.Contains(123UL));
                Assert.IsTrue(graphIds.Contains(256UL));

            }

        }
コード例 #3
0
        public void GraphServerConstructorTest()
        {

            using (var GraphServer = new GraphServer(new PropertyGraph(123UL), new IPPort(8080)) {
                                         ServerName = "GraphServer v0.1"
                                     } as IGraphServer)
            {

                Assert.IsNotNull(GraphServer);
                Assert.IsNotNull(GraphServer.ServerName);
                Assert.AreEqual("GraphServer v0.1", GraphServer.ServerName);

                var graphs = GraphServer.AllGraphs().ToList();
                Assert.IsNotNull(graphs);
                Assert.AreEqual(1, graphs.Count);

                var graph1 = graphs[0];
                Assert.IsNotNull(graph1);
                Assert.IsNotNull(graph1.IdKey);
                Assert.IsNotNull(graph1.RevIdKey);
                Assert.AreEqual(123UL, graph1.Id);

            }

        }
コード例 #4
0
        public void NewPropertyGraphTest()
        {

            using (var GraphServer = new GraphServer(new PropertyGraph(123UL), new IPPort(8080)) {
                                         ServerName = "GraphServer v0.1"
                                     } as IGraphServer)
            {

                var graph = GraphServer.NewPropertyGraph(512UL, g => g.SetProperty("hello", "world!"));
                Assert.IsNotNull(graph);
                Assert.IsNotNull(graph.IdKey);
                Assert.IsNotNull(graph.RevIdKey);
                Assert.AreEqual(512UL, graph.Id);
                Assert.IsTrue(graph.ContainsKey("hello"));
                Assert.IsTrue(graph.ContainsValue("world!"));
                Assert.IsTrue(graph.Contains("hello", "world!"));

                var graphs = GraphServer.AllGraphs().ToList();
                Assert.IsNotNull(graphs);
                Assert.AreEqual(2, graphs.Count);

                var graphIds = (from _graph in graphs select _graph.Id).ToList();
                Assert.IsTrue(graphIds.Contains(123UL));
                Assert.IsTrue(graphIds.Contains(512UL));

            }

        }
コード例 #5
0
ファイル: Program.cs プロジェクト: codeinpeace/Blueprints.NET
        public static void Main(String[] args)
        {

            using (var GraphServer = new GraphServer(new PropertyGraph(123UL) { Description = "the first graph" }, new IPPort(8080)) {
                                         ServerName = "GraphServer v0.1"
                                     } as IGraphServer)
            {

                var graph = GraphServer.NewPropertyGraph(512UL, g => g.SetProperty(GraphDBOntology.Description().Suffix, "the second graph").SetProperty("hello", "world!"));
                var a1 = graph.ContainsKey("hello");
                var a2 = graph.ContainsKey("world!");
                var a3 = graph.ContainsKey("graphs");
                var a4 = graph.ContainsKey("are cool!");
                var a5 = graph.ContainsKey(GraphDBOntology.Description().Suffix);

                var c1 = graph.ContainsValue(123UL);

                var t = false;
                graph.UseProperty("Id", success => t = true);
                var ii = "i = " + t;

                var b1 = graph.Contains("Id", 123UL);
                var b2 = graph is IProperties<String, Object>;

                var aa = graph.GetProperties(null);

                var deleted3 = graph.Remove().ToList();
                var deleted1 = graph.Remove("hello");

                // ---------------------------------------------------------------

                var v1 = graph.AddVertex(v => v.SetProperty("Name", "Vertex1"));
                var v2 = graph.AddVertex(v => v.SetProperty("Name", "Vertex2"));
                var e1 = graph.AddEdge(v1, v2, "knows", e => e.SetProperty("Name", "Edge1"));

                var allV = graph.Vertices().ToList();
                var allE = graph.Edges().ToList();


                // ---------------------------------------------------------------


                //var HTTPClient1 = new HTTPClient(IPv4Address.Parse("127.0.0.1"), new IPPort(8080));
                //var _request1 = HTTPClient1.GET("/").//AccountId/RepositoryId/TransactionId/GraphId/VerticesById?Id=2&Id=3").
                //                              SetProtocolVersion(HTTPVersion.HTTP_1_1).
                //                              SetUserAgent("Hermod HTTP Client v0.1").
                //                              SetConnection("keep-alive").
                //                              AddAccept(HTTPContentType.JSON_UTF8, 1);

                //HTTPClient1.Execute(_request1, response => Console.WriteLine(response.Content.ToUTF8String()));

                //// ---------------------------------------------------------------

                //var HTTPClient2 = new HTTPClient(IPv4Address.Parse("127.0.0.1"), new IPPort(8080));
                //var _request2 = HTTPClient2.GET("/123/description").//AccountId/RepositoryId/TransactionId/GraphId/VerticesById?Id=2&Id=3").
                //                              SetProtocolVersion(HTTPVersion.HTTP_1_1).
                //                              SetUserAgent("Hermod HTTP Client v0.1").
                //                              SetConnection("keep-alive").
                //                              AddAccept(HTTPContentType.JSON_UTF8, 1);

                //HTTPClient2.Execute(_request2, response => Console.WriteLine(response.Content.ToUTF8String()));

                // ---------------------------------------------------------------

                var GraphClient = new RemotePropertyGraph(IPv4Address.Parse("127.0.0.1"), new IPPort(8080)) { Id = 512 };
                Console.WriteLine(GraphClient.Description);

                while (true)
                    Thread.Sleep(100);

            }

        }