Пример #1
0
 private void SetContainsSubdivisions(IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData)
 {
     if (entities == null)
     {
         throw new ArgumentNullException("entities");
     }
     ClearRunInfo();
     foreach (var entity in entities)
     {
         if (entity.entity.Where(x => !x.IsObsolete && !x.type.IsLocalGovernment()).All(x => x.wiki != null && !String.IsNullOrEmpty(x.wiki.wikidata)))
         {
             var item = _helper.GetWikiDataItemForEntity(entity);
             if (item == null)
             {
                 _runInfo[WikiDataState.ItemNotFound]++;
                 collisionInfo.AppendFormat("{0}: {1} was deleted!", entity.wiki.wikidata, entity.english);
             }
             else
             {
                 foreach (var subEntity in entity.entity.Where(x => !x.type.IsLocalGovernment()))
                 {
                     var state = _helper.ContainsSubdivisionsCorrect(item, entity, subEntity);
                     _runInfo[state]++;
                     if (state == WikiDataState.Incomplete)
                     {
                         var statement = _helper.SetContainsSubdivisions(item, entity, subEntity);
                         if (statement != null)
                         {
                             statement.save(_helper.GetClaimSaveEditSummary(statement));
                         }
                     }
                 }
             }
         }
     }
 }