예제 #1
0
        /// <summary>
        /// Runs iteration on the data.
        /// </summary>
        internal void WriteDB(string output, EdgeProvider inputEdges, EdgeProvider outputEdges)
        {
            iterateLines(writeTargetIds);
            Console.WriteLine("Writing {0} entities.", _entitiesToWrite.Count);

            _writer = new DumpWriter(output);
            foreach (var value in _entitiesToWrite.Values)
            {
                if (value.Label == null || value.Description == null)
                {
                    //skip incomplete entities
                    continue;
                }

                _writer.Write(value.FreebaseId, value.Label, value.Aliases, value.Description, inputEdges(value.FreebaseId), outputEdges(value.FreebaseId));
            }

            _writer.Close();
            _writer = null;
        }
예제 #2
0
        public ProviderStack(Construct scope, string id) : base(scope, id)
        {
            var providerOpt = new EdgeProvider(this, "edge", new EdgeProviderConfig {
                Reqstr  = "reqstr",
                Reqnum  = 123,
                Reqbool = true
            });
            var providerFull = new EdgeProvider(this, "edge_full", new EdgeProviderConfig {
                Reqstr       = "reqstr",
                Reqnum       = 123,
                Reqbool      = true,
                Optstr       = "optstr",
                Optnum       = 456,
                Optbool      = false,
                Computedstr  = "computedstr",
                Computednum  = 789,
                Computedbool = true,
                Alias        = "full"
            });

            // Non-null assertion because provider.reqbool may be undefined
            // although it is required to be set and therefor never actually is undefined
            new RequiredAttributeResource(this, "reqOpt", new RequiredAttributeResourceConfig {
                Bool     = providerOpt.Reqbool,
                Num      = providerOpt.Reqnum.Value,
                Str      = providerOpt.Reqstr,
                StrList  = new [] { providerOpt.Reqstr },
                NumList  = new [] { providerOpt.Reqnum.Value },
                BoolList = new [] { providerOpt.Reqbool }
            });

            new OptionalAttributeResource(this, "optOpt", new OptionalAttributeResourceConfig {
                Bool = providerOpt.Optbool,
                Str  = providerOpt.Optstr,
                Num  = providerOpt.Optnum
            });

            new OptionalAttributeResource(this, "computedOpt", new OptionalAttributeResourceConfig {
                Bool = providerOpt.Computedbool,
                Str  = providerOpt.Computedstr,
                Num  = providerOpt.Computednum
            });

            new RequiredAttributeResource(this, "reqFull", new RequiredAttributeResourceConfig {
                Bool     = providerFull.Reqbool,
                Num      = providerFull.Reqnum.Value,
                Str      = providerFull.Reqstr,
                StrList  = new [] { providerFull.Reqstr },
                NumList  = new [] { providerFull.Reqnum.Value },
                BoolList = new [] { providerFull.Reqbool }
            });

            new OptionalAttributeResource(this, "optFull", new OptionalAttributeResourceConfig {
                Bool = providerFull.Optbool,
                Str  = providerFull.Optstr,
                Num  = providerFull.Optnum
            });

            new OptionalAttributeResource(this, "computedFull", new OptionalAttributeResourceConfig {
                Bool = providerFull.Computedbool,
                Str  = providerFull.Computedstr,
                Num  = providerFull.Computednum
            });
        }