Exemplo n.º 1
0
 private void SetIsInAdministrativeUnit(IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData)
 {
     if (entities == null)
     {
         throw new ArgumentNullException("entities");
     }
     ClearRunInfo();
     foreach (var entity in entities)
     {
         var item = _helper.GetWikiDataItemForEntity(entity);
         if (item == null)
         {
             _runInfo[WikiDataState.ItemNotFound]++;
             collisionInfo.AppendFormat("{0}: {1} was deleted!", entity.wiki.wikidata, entity.english);
         }
         else
         {
             var state = _helper.IsInAdministrativeUnitCorrect(item, entity);
             _runInfo[state]++;
             if (state == WikiDataState.WrongValue)
             {
                 collisionInfo.AppendFormat("{0}: {1} has wrong parent", item.id, entity.english);
                 collisionInfo.AppendLine();
             }
             if (state != WikiDataState.Valid)
             {
                 var statement = _helper.SetIsInAdministrativeUnit(item, entity, overrideData);
                 if (statement != null)
                 {
                     statement.save(_helper.GetClaimSaveEditSummary(statement));
                 }
             }
         }
     }
 }