示例#1
0
文件: Program.cs 项目: Astn/ekati
        public static IEnumerable <Node> BuildLotsNodes()
        {
            var now          = DateTime.Now.Ticks;
            var seededRandom = new Random(1337);

            KeyValue fn()
            {
                return(Utils.PropString("FirstName", "Austin", now));
            }

            KeyValue ln()
            {
                return(Utils.PropString("LastName", "Harris", now));
            }

            KeyValue follo(string id)
            {
                return(Utils.PropData("follows", Utils.DataId(new NodeID {
                    Iri = id
                }), now));
            }

            KeyValue[] pregenStuff(string id)
            {
                return(new[]
                {
                    fn(),
                    ln(),
                    follo(id),
                    follo(id),
                    follo(id)
                });
            }

            Node mkNode(string id)
            {
                var nid = new NodeID
                {
                    Iri = id,
                };
                var attrs = pregenStuff(id);
                var m     = new Map {
                    Items = attrs
                };

                return(new Node
                {
                    Id = nid,
                    Attributes = m
                });
            }

            for (int i = 0; i < 200000; i++)
            {
                yield return(mkNode(i.ToString()));
            }
        }
示例#2
0
文件: Utils.cs 项目: Astn/ekati
 public static KeyValue Link(string key, string linkedId, long time)
 {
     return(Utils.PropData(key, Utils.Id(linkedId), time));
 }