Пример #1
0
        /// <summary>
        /// Creates a new instance of <see cref="WikiDataBot"/>.
        /// </summary>
        /// <param name="helper">Wiki data helper.</param>
        /// <exception cref="ArgumentNullException"><paramref name="helper"/> is <c>null</c>.</exception>
        public WikiDataBot(WikiDataHelper helper)
        {
            if (helper == null)
            {
                throw new ArgumentNullException("helper");
            }

            _helper  = helper;
            _runInfo = new Dictionary <WikiDataState, Int32>();

            _availableTasks = new List <WikiDataTaskInfo>();
            WikiDataTaskDelegate setDescriptionEnglish = (IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetDescription(Language.English, entities, collisionInfo, overrideData);
            WikiDataTaskDelegate setDescriptionThai    = (IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetDescription(Language.Thai, entities, collisionInfo, overrideData);
            WikiDataTaskDelegate setDescriptionGerman  = (IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetDescription(Language.German, entities, collisionInfo, overrideData);

            _availableTasks.Add(new WikiDataTaskInfo("Set description [en]", setDescriptionEnglish));
            _availableTasks.Add(new WikiDataTaskInfo("Set description [de]", setDescriptionGerman));
            _availableTasks.Add(new WikiDataTaskInfo("Set description [th]", setDescriptionThai));
            WikiDataTaskDelegate setLabelEnglish = (IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetLabel(Language.English, entities, collisionInfo, overrideData);
            WikiDataTaskDelegate setLabelGerman  = (IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetLabel(Language.German, entities, collisionInfo, overrideData);
            WikiDataTaskDelegate setLabelThai    = (IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetLabel(Language.Thai, entities, collisionInfo, overrideData);

            _availableTasks.Add(new WikiDataTaskInfo("Set label [en]", setLabelEnglish));
            _availableTasks.Add(new WikiDataTaskInfo("Set label [de]", setLabelGerman));
            _availableTasks.Add(new WikiDataTaskInfo("Set label [th]", setLabelThai));
            _availableTasks.Add(new WikiDataTaskInfo("Set Thai abbreviation", SetThaiAbbreviation));
            _availableTasks.Add(new WikiDataTaskInfo("Set country", SetCountry));
            _availableTasks.Add(new WikiDataTaskInfo("Set is in administrative unit", SetIsInAdministrativeUnit));
            WikiDataTaskDelegate setInstanceOf = (IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetTypeOfAdministrativeUnit(entities, collisionInfo, overrideData);

            // _availableTasks.Add(new WikiDataTaskInfo("Set type of administrative unit", setTypeOfAdministrativeUnit));
            _availableTasks.Add(new WikiDataTaskInfo("Set instance of", setInstanceOf));
            _availableTasks.Add(new WikiDataTaskInfo("Set OpenStreetMap", SetOpenStreetMap));
            SetContainsSubdivisionTask = new WikiDataTaskInfo("Set ContainsSubdivisions", SetContainsSubdivisions);
            _availableTasks.Add(SetContainsSubdivisionTask);
            SetLocatorMapTask = new WikiDataTaskInfo("Set locator map", SetLocatorMap);
            _availableTasks.Add(SetLocatorMapTask);
            _availableTasks.Add(new WikiDataTaskInfo("Set TIS 1099", SetGeocode));
            _availableTasks.Add(new WikiDataTaskInfo("Set GND reference", SetGnd));
            _availableTasks.Add(new WikiDataTaskInfo("Set Postal code", SetPostalCode));
            _availableTasks.Add(new WikiDataTaskInfo("Set Location", SetLocation));
            WikiDataTaskDelegate setCensus2010 = (IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetPopulationData(entities, collisionInfo, overrideData, PopulationDataSourceType.Census, 2010);

            _availableTasks.Add(new WikiDataTaskInfo("Set Census 2010", setCensus2010));
            WikiDataTaskDelegate setDopa2014 = (IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetPopulationData(entities, collisionInfo, overrideData, PopulationDataSourceType.DOPA, 2014);

            _availableTasks.Add(new WikiDataTaskInfo("Set DOPA population 2014", setDopa2014));
            WikiDataTaskDelegate setCensus2000 = (IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetPopulationData(entities, collisionInfo, overrideData, PopulationDataSourceType.Census, 2000);

            _availableTasks.Add(new WikiDataTaskInfo("Set Census 2000", setCensus2000));
            WikiDataTaskDelegate setCensus1990 = (IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetPopulationData(entities, collisionInfo, overrideData, PopulationDataSourceType.Census, 1990);

            _availableTasks.Add(new WikiDataTaskInfo("Set Census 1990", setCensus1990));
            _availableTasks.Add(new WikiDataTaskInfo("Set Slogan", SetSlogan));
            _availableTasks.Add(new WikiDataTaskInfo("Set native label", SetNativeLabel));
            _availableTasks.Add(new WikiDataTaskInfo("Set bounding entities", SetShareBorderWith));
        }
Пример #2
0
        /// <summary>
        /// Creates a new instance of <see cref="WikiDataBot"/>.
        /// </summary>
        /// <param name="helper">Wiki data helper.</param>
        /// <exception cref="ArgumentNullException"><paramref name="helper"/> is <c>null</c>.</exception>
        public WikiDataBot(WikiDataHelper helper)
        {
            if ( helper == null )
            {
                throw new ArgumentNullException("helper");
            }

            _helper = helper;
            _runInfo = new Dictionary<WikiDataState, Int32>();

            _availableTasks = new List<WikiDataTaskInfo>();
            WikiDataTaskDelegate setDescriptionEnglish = (IEnumerable<Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetDescription(Language.English, entities, collisionInfo, overrideData);
            WikiDataTaskDelegate setDescriptionThai = (IEnumerable<Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetDescription(Language.Thai, entities, collisionInfo, overrideData);
            WikiDataTaskDelegate setDescriptionGerman = (IEnumerable<Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetDescription(Language.German, entities, collisionInfo, overrideData);
            _availableTasks.Add(new WikiDataTaskInfo("Set description [en]", setDescriptionEnglish));
            _availableTasks.Add(new WikiDataTaskInfo("Set description [de]", setDescriptionGerman));
            _availableTasks.Add(new WikiDataTaskInfo("Set description [th]", setDescriptionThai));
            WikiDataTaskDelegate setLabelEnglish = (IEnumerable<Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetLabel(Language.English, entities, collisionInfo, overrideData);
            WikiDataTaskDelegate setLabelGerman = (IEnumerable<Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetLabel(Language.German, entities, collisionInfo, overrideData);
            WikiDataTaskDelegate setLabelThai = (IEnumerable<Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetLabel(Language.Thai, entities, collisionInfo, overrideData);
            _availableTasks.Add(new WikiDataTaskInfo("Set label [en]", setLabelEnglish));
            _availableTasks.Add(new WikiDataTaskInfo("Set label [de]", setLabelGerman));
            _availableTasks.Add(new WikiDataTaskInfo("Set label [th]", setLabelThai));
            _availableTasks.Add(new WikiDataTaskInfo("Set Thai abbreviation", SetThaiAbbreviation));
            _availableTasks.Add(new WikiDataTaskInfo("Set country", SetCountry));
            _availableTasks.Add(new WikiDataTaskInfo("Set is in administrative unit", SetIsInAdministrativeUnit));
            WikiDataTaskDelegate setInstanceOf = (IEnumerable<Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetTypeOfAdministrativeUnit(entities, collisionInfo, overrideData);
            // _availableTasks.Add(new WikiDataTaskInfo("Set type of administrative unit", setTypeOfAdministrativeUnit));
            _availableTasks.Add(new WikiDataTaskInfo("Set instance of", setInstanceOf));
            _availableTasks.Add(new WikiDataTaskInfo("Set OpenStreetMap", SetOpenStreetMap));
            SetContainsSubdivisionTask = new WikiDataTaskInfo("Set ContainsSubdivisions", SetContainsSubdivisions);
            _availableTasks.Add(SetContainsSubdivisionTask);
            SetLocatorMapTask = new WikiDataTaskInfo("Set locator map", SetLocatorMap);
            _availableTasks.Add(SetLocatorMapTask);
            _availableTasks.Add(new WikiDataTaskInfo("Set TIS 1099", SetGeocode));
            _availableTasks.Add(new WikiDataTaskInfo("Set GND reference", SetGnd));
            _availableTasks.Add(new WikiDataTaskInfo("Set Postal code", SetPostalCode));
            _availableTasks.Add(new WikiDataTaskInfo("Set Location", SetLocation));
            WikiDataTaskDelegate setCensus2010 = (IEnumerable<Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetPopulationData(entities, collisionInfo, overrideData, PopulationDataSourceType.Census, 2010);
            _availableTasks.Add(new WikiDataTaskInfo("Set Census 2010", setCensus2010));
            WikiDataTaskDelegate setDopa2014 = (IEnumerable<Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetPopulationData(entities, collisionInfo, overrideData, PopulationDataSourceType.DOPA, 2014);
            _availableTasks.Add(new WikiDataTaskInfo("Set DOPA population 2014", setDopa2014));
            WikiDataTaskDelegate setCensus2000 = (IEnumerable<Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetPopulationData(entities, collisionInfo, overrideData, PopulationDataSourceType.Census, 2000);
            _availableTasks.Add(new WikiDataTaskInfo("Set Census 2000", setCensus2000));
            WikiDataTaskDelegate setCensus1990 = (IEnumerable<Entity> entities, StringBuilder collisionInfo, Boolean overrideData) => SetPopulationData(entities, collisionInfo, overrideData, PopulationDataSourceType.Census, 1990);
            _availableTasks.Add(new WikiDataTaskInfo("Set Census 1990", setCensus1990));
            _availableTasks.Add(new WikiDataTaskInfo("Set Slogan", SetSlogan));
            _availableTasks.Add(new WikiDataTaskInfo("Set native label", SetNativeLabel));
            _availableTasks.Add(new WikiDataTaskInfo("Set bounding entities", SetShareBorderWith));
            _availableTasks.Add(new WikiDataTaskInfo("Set Inception", SetInception));
        }