示例#1
0
        public WorkPackage(UInt64       Id,
                           String       Name,
                           ActivityType ActivityType,
                           UInt32       StartMonth,
                           UInt32       EndMonth,
                           Double       Force,
                           IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                                 UInt64, Int64, String, String, Object,
                                                 UInt64, Int64, String, String, Object,
                                                 UInt64, Int64, String, String, Object> Graph)
        {
            this.Id         = Id;
            this.Name       = Name;
            this.StartMonth = StartMonth;
            this.Graph      = Graph;

            this.Vertex     = Graph.AddVertex(v => v.SetProperty("Id_",          Id).
                                                     SetProperty("Name",         Name).
                                                     SetProperty("Type",         "WorkPackage").
                                                     SetProperty("ActivityType", ActivityType).
                                                     SetProperty("StartMonth",   StartMonth).
                                                     SetProperty("EndMonth",     EndMonth).
                                                     SetProperty("Force",        Force).
                                                     SetProperty("class",        this));
        }
示例#2
0
        private void ImportEdges(IGenericPropertyGraph <UInt64, Int64, String, String, Object,
                                                        UInt64, Int64, String, String, Object,
                                                        UInt64, Int64, String, String, Object,
                                                        UInt64, Int64, String, String, Object> SocialGraph)
        {
            var _Stopwatch = new Stopwatch();

            _Stopwatch.Start();

            //CSV.ParseFile(_FileName, _CSVLine =>
            //                              {

            //                                  var _VertexId0 = UInt64.Parse(_CSVLine[0]);

            //                                  for (var i = 1; i < _CSVLine.Count(); i++)
            //                                      SocialGraph.AddEdge(
            //                                          SocialGraph.VertexById(_VertexId0),
            //                                          SocialGraph.VertexById(UInt64.Parse(_CSVLine[i]))
            //                                      );

            //                              }).Wait();

            _Stopwatch.Stop();

            Console.WriteLine("Edge import: {0}:{1:00} min", _Stopwatch.Elapsed.Minutes, _Stopwatch.Elapsed.Seconds);
        }
示例#3
0
 public GlypheGraph(IGenericPropertyGraph<String, Int64, String, String, Object,
                                          String, Int64, String, String, Object,
                                          String, Int64, String, String, Object,
                                          String, Int64, String, String, Object> Graph)
 {
     _TAGraph = Graph;
 }
示例#4
0
        /// <summary>
        /// A project.
        /// </summary>
        /// <param name="Name">The name of the project.</param>
        /// <param name="Graph">The property graph of the project.</param>
        public Project(String Name,
                       IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                             UInt64, Int64, String, String, Object,
                                             UInt64, Int64, String, String, Object,
                                             UInt64, Int64, String, String, Object> Graph)
        {
            this.Name  = Name;
            this.Graph = Graph;

            this.Vertex = Graph.AddVertex(v => v.SetProperty("Name",  Name).
                                                 SetProperty("Type",  "Project").
                                                 SetProperty("class", this));
        }
示例#5
0
        /// <summary>
        /// Run the tutorial.
        /// </summary>
        public void Run()
        {
            graph = GraphFactory.CreateGenericPropertyGraph_WithStringIds("Vanaheimr graph processing stack");

            var IlliasCommons = AddProject("Illias Commons");
            var Eunomia       = AddProject("Eunomia");
            var Blueprints    = AddProject("Blueprints", IlliasCommons, Eunomia);

            while (true)
            {
                Thread.Sleep(100);
            }
        }
示例#6
0
        public ListGraph(IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                               UInt64, Int64, String, String, Object,
                                               UInt64, Int64, String, String, Object,
                                               UInt64, Int64, String, String, Object> Graph,
                         TraversalGraphType TraversalGraphType)
        {
            this.Graph = Graph;

            _ListGraph = new UInt64[Graph.NumberOfVertices()][];

            Graph.Vertices().ForEach(v => {
                _ListGraph[v.Id - 1] = (from e in v.OutEdges() select e.Id).ToArray();
            });
        }
示例#7
0
        public MatrixArrayGraph(IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                                      UInt64, Int64, String, String, Object,
                                                      UInt64, Int64, String, String, Object,
                                                      UInt64, Int64, String, String, Object> PropertyGraph,
                                UInt64 X, UInt64 Y)
        {

            this.PropertyGraph = PropertyGraph;
            this._MatrixGraph  = new UInt64[X, Y];

            PropertyGraph.Vertices().ForEach(v =>
            {
                _MatrixGraph[v.Id - 1, 0] = (from e in v.OutEdges() select e.Id).ToArray().First();
            });

        }
示例#8
0
        public Objective(String Id,
                         String Name,
                         IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                               UInt64, Int64, String, String, Object,
                                               UInt64, Int64, String, String, Object,
                                               UInt64, Int64, String, String, Object> Graph)
        {
            this.Id     = Id;
            this.Name   = Name;
            this.Graph  = Graph;

            this.Vertex = Graph.AddVertex(v => v.SetProperty("Id_",   Id).
                                                 SetProperty("Name",  Name).
                                                 SetProperty("Type",  "Objective").
                                                 SetProperty("class", this));
        }
示例#9
0
        private void ImportVertices(IGenericPropertyGraph <UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object,
                                                           UInt64, Int64, String, String, Object> SocialGraph)
        {
            var _Stopwatch = new Stopwatch();

            _Stopwatch.Start();

            //CSV.ParseFile(_FileName, _CSVLine =>
            //                              {
            //                                  SocialGraph.AddVertex(UInt64.Parse(_CSVLine[0]));
            //                              }).Wait();

            _Stopwatch.Stop();

            Console.WriteLine("Vertex import: {0}:{1:00} min", _Stopwatch.Elapsed.Minutes, _Stopwatch.Elapsed.Seconds);
        }
示例#10
0
        public MatrixListGraph(IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                                     UInt64, Int64, String, String, Object,
                                                     UInt64, Int64, String, String, Object,
                                                     UInt64, Int64, String, String, Object> PropertyGraph,

                               VertexFilter         <UInt64, Int64, String, String, Object,
                                                     UInt64, Int64, String, String, Object,
                                                     UInt64, Int64, String, String, Object,
                                                     UInt64, Int64, String, String, Object> VertexFilter = null,

                               EdgeFilter           <UInt64, Int64, String, String, Object,
                                                     UInt64, Int64, String, String, Object,
                                                     UInt64, Int64, String, String, Object,
                                                     UInt64, Int64, String, String, Object> EdgeFilter   = null,

                               Func<IReadOnlyGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                                   UInt64, Int64, String, String, Object,
                                                                   UInt64, Int64, String, String, Object,
                                                                   UInt64, Int64, String, String, Object>, IEnumerable<UInt64>> Func = null)
        {
            this.PropertyGraph    = PropertyGraph;
            this.VertexFilter     = VertexFilter;
            this.EdgeFilter       = EdgeFilter;
            this.Func             = Func;
            this._MatrixListGraph = new List<List<UInt64>>();

            PropertyGraph.Vertices(VertexFilter).ForEach(v =>
            {

                var _List = new List<UInt64>();// { v.Id };
                _List.AddRange(Func(v));
                _MatrixListGraph.Add(_List);

            });

            PropertyGraph.OnVertexAddition.OnNotification += (g, v) => AddVertex(v);
            PropertyGraph.OnEdgeAddition.OnNotification   += (g, e) => AddEdge(e);
        }
        /// <summary>
        /// Initialize the GraphDevroom HTTP API using IPAddress.Any, http port 8080 and start the server.
        /// </summary>
        /// <param name="IPPort">The IP listing port.</param>
        public GraphDevroomHTTPAPI(IPPort                                                                   IPPort                            = null,
                                   String                                                                   DefaultServerName                 = __DefaultServerName,
                                   String                                                                   HTTPRoot                          = __DefaultHTTPRoot,
                                   String                                                                   URIPrefix                         = "",

                                   IGenericPropertyGraph<UInt64, Int64, GDVertexLabel,    String, Object,
                                                         UInt64, Int64, GDEdgeLabel,      String, Object,
                                                         UInt64, Int64, GDMultiEdgeLabel, String, Object,
                                                         UInt64, Int64, GDHyperEdgeLabel, String, Object>   Graph                             = null,

                                   String                                                                   ServerThreadName                  = null,
                                   ThreadPriority                                                           ServerThreadPriority              = ThreadPriority.AboveNormal,
                                   Boolean                                                                  ServerThreadIsBackground          = true,

                                   ConnectionIdBuilder                                                      ConnectionIdBuilder               = null,
                                   ConnectionThreadsNameBuilder                                             ConnectionThreadsNameBuilder      = null,
                                   ConnectionThreadsPriorityBuilder                                         ConnectionThreadsPriorityBuilder  = null,
                                   Boolean                                                                  ConnectionThreadsAreBackground    = true,
                                   TimeSpan?                                                                ConnectionTimeout                 = null,
                                   UInt32                                                                   MaxClientConnections              = TCPServer.__DefaultMaxClientConnections,

                                   IEnumerable<Assembly>                                                    CallingAssemblies                 = null,

                                   Boolean                                                                  Autostart                         = false)
            : base((IPPort != null) ? IPPort : IPPort.Parse(8080),
                   "",
                   DefaultServerName,

                   //ServerThreadName,
                   //ServerThreadPriority,
                   //ServerThreadIsBackground,
                   //
                   //ConnectionIdBuilder,
                   //ConnectionThreadsNameBuilder,
                   //ConnectionThreadsPriorityBuilder,
                   //ConnectionThreadsAreBackground,
                   //
                   //ConnectionTimeout,
                   //MaxClientConnections,
                   Autostart: false)
        {
            this._Graph            = (Graph != null) ? Graph : GraphDevroomGraphFactory.Create(1, "FOSDEM GraphDevroom Graph");
            this._HTTPRoot         = HTTPRoot;
            //this._Logger           = Logger;

            #region / (HTTPRoot)

            //this.RegisterResourcesFolder(URIPrefix + "/",
            //                             _HTTPRoot,
            //                             DefaultFilename: "index.html");

            // Redirect to GitHub pages
            this.RegisterMovedTemporarilyHandler("/", "http://graphdevroom.github.io");

            #endregion

            #region /raw

            this.AddMethodCallback(HTTPMethod.GET,
                                   "/raw",
                                   HTTPContentType.HTML_UTF8,
                                   HTTPRequest => {

                                       return new HTTPResponseBuilder()
                                       {
                                           HTTPStatusCode  = HTTPStatusCode.OK,
                                           ContentType     = HTTPContentType.TEXT_UTF8,
                                           Content         = HTTPRequest.RawHTTPHeader.ToString().ToUTF8Bytes(),
                                           CacheControl    = "private",
                                           //Expires         = "Mon, 25 Jun 2015 21:31:12 GMT",
                                           Connection      = "close"
                                       };

                                   });

            #endregion

            #region ~/{Year}/{Event}/schedule

            #region GET         ~/{Year}/{Event}/schedule

            #region HTML_UTF8

            // -----------------------------------------------------------------------------
            // curl -v -H "Accept: text/html" http://127.0.0.1:8080/{Year}/{Event}/schedule
            // -----------------------------------------------------------------------------
            this.AddMethodCallback(HTTPMethod.GET,
                                   "/{Year}/{Event}/schedule",
                                   HTTPContentType.HTML_UTF8,
                                   HTTPDelegate: HTTPRequest => {

                                       #region Parse Year

                                       UInt16 Year;

                                       if (HTTPRequest.ParsedURIParameters.Length < 1)
                                       {

                                           Log.Timestamp("Bad request: Missing year query parameter!");

                                           return new HTTPResponseBuilder() {
                                               HTTPStatusCode  = HTTPStatusCode.BadRequest,
                                               ContentType     = HTTPContentType.JSON_UTF8,
                                               Content         = new JObject(new JProperty("@context",    "http://emi3group.org/contexts/BadRequest.jsonld"),
                                                                             new JProperty("Description", "Missing year query parameter!")).
                                                                             ToString().ToUTF8Bytes()
                                           };

                                       }

                                       if (!UInt16.TryParse(HTTPRequest.ParsedURIParameters[0], out Year))
                                       {

                                           Log.Timestamp("Bad request: Invalid year query parameter!");

                                           return new HTTPResponseBuilder() {
                                               HTTPStatusCode  = HTTPStatusCode.BadRequest,
                                               ContentType     = HTTPContentType.JSON_UTF8,
                                               Content         = new JObject(new JProperty("@context",    "http://emi3group.org/contexts/BadRequest.jsonld"),
                                                                             new JProperty("Value",       HTTPRequest.ParsedURIParameters[0]),
                                                                             new JProperty("Description", "Invalid year query parameter!")).
                                                                             ToString().ToUTF8Bytes()
                                           };

                                       }

                                       #endregion

                                       var Content = "lala";

                                       return new HTTPResponseBuilder() {
                                           HTTPStatusCode  = HTTPStatusCode.OK,
                                           Server          = this.DefaultServerName,
                                           ETag            = "1",
                                           ContentType     = HTTPContentType.HTML_UTF8,
                                           Content         = Content.ToUTF8Bytes(),
                                           CacheControl    = "no-cache"
                                       };

                                   });

            #endregion

            #endregion

            #endregion

            this.AddEventSource(EventIdentification:     "Semantics.DebugLog",
                                MaxNumberOfCachedEvents: 100,
                                RetryIntervall:          TimeSpan.FromSeconds(5),
                                URITemplate:             URIPrefix + "/DebugLog");

            // HTTP ACCEPT TYPE  !=  HTTP CONTENT TYPE !!!

            if (Autostart)
                this.Start();
        }
示例#12
0
        public VertexEdge_MatrixListGraph(IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object> PropertyGraph,

                                          VertexFilter         <UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object> VertexFilter = null,

                                          EdgeFilter           <UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object,
                                                                UInt64, Int64, String, String, Object> EdgeFilter = null)

            : base(PropertyGraph,
                   VertexFilter,
                   EdgeFilter,
                   v => from e in v.OutEdges(EdgeFilter) select e.Id)

        {
        }
示例#13
0
        public VertexVertex_MatrixListGraph(IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                                                  UInt64, Int64, String, String, Object,
                                                                  UInt64, Int64, String, String, Object,
                                                                  UInt64, Int64, String, String, Object> PropertyGraph,

                                           String VertexLabel,
                                           String EdgeLabel)

            : this(PropertyGraph,
                   v => (VertexLabel != null) ? v.Label == VertexLabel : true,
                   e => (EdgeLabel   != null) ? e.Label == EdgeLabel   : true)

        { }
示例#14
0
        /// <summary>
        /// Run the tutorial.
        /// </summary>
        public void Run()
        {
            graph = GraphFactory.CreateGenericPropertyGraph2("Vanaheimr graph processing stack");

            var IlliasCommons  = AddProject("Illias Commons");
            var Eunomia        = AddProject("Eunomia");
            var Blueprints     = AddProject("Blueprints", IlliasCommons, Eunomia);

            while (true)
            {
                Thread.Sleep(100);
            }
        }
示例#15
0
        private void ImportVertices(IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                                          UInt64, Int64, String, String, Object,
                                                          UInt64, Int64, String, String, Object,
                                                          UInt64, Int64, String, String, Object> SocialGraph)
        {
            var _Stopwatch = new Stopwatch();
            _Stopwatch.Start();

            //CSV.ParseFile(_FileName, _CSVLine =>
            //                              {
            //                                  SocialGraph.AddVertex(UInt64.Parse(_CSVLine[0]));
            //                              }).Wait();

            _Stopwatch.Stop();

            Console.WriteLine("Vertex import: {0}:{1:00} min", _Stopwatch.Elapsed.Minutes, _Stopwatch.Elapsed.Seconds);
        }
示例#16
0
        private void ImportEdges(IGenericPropertyGraph<UInt64, Int64, String, String, Object,
                                                       UInt64, Int64, String, String, Object,
                                                       UInt64, Int64, String, String, Object,
                                                       UInt64, Int64, String, String, Object> SocialGraph)
        {
            var _Stopwatch = new Stopwatch();
            _Stopwatch.Start();

            //CSV.ParseFile(_FileName, _CSVLine =>
            //                              {

            //                                  var _VertexId0 = UInt64.Parse(_CSVLine[0]);

            //                                  for (var i = 1; i < _CSVLine.Count(); i++)
            //                                      SocialGraph.AddEdge(
            //                                          SocialGraph.VertexById(_VertexId0),
            //                                          SocialGraph.VertexById(UInt64.Parse(_CSVLine[i]))
            //                                      );

            //                              }).Wait();

            _Stopwatch.Stop();

            Console.WriteLine("Edge import: {0}:{1:00} min", _Stopwatch.Elapsed.Minutes, _Stopwatch.Elapsed.Seconds);
        }