WikiCrawler/MediaWiki/Wikidata.cs
/// <summary>
/// Creates an authority control template for the specified entity.
/// </summary>
/// <param name="additionalOptions"></param>
/// <returns></returns>
Creates an authority control template for the specified entity.
Creates an authority control template for the specified entity .
public static string GetAuthorityControlTemplate(Entity entity,
			string additionalOptions,
			Dictionary<string, string> additionalKeys)
		{
			string result = "";
			foreach (string auth in CommonsAuthorities)
			{
				if (EntityHasAuthority(auth, entity))
				{
					result += "|" + auth + "=" + ConvertAuthorityFromWikidataToCommons(auth, entity);
				}
			}
			if (additionalKeys != null)
			{
				foreach (KeyValuePair<string, string> kv in additionalKeys)
				{
					if (!EntityHasAuthority(kv.Key, entity))
					{
						result += "|" + kv.Key + "=" + kv.Value;
					}
				}
			}
			if (!string.IsNullOrEmpty(result))
			{
				result += "|Q=" + entity.id;
				if (!string.IsNullOrEmpty(additionalOptions))
				{
					result += "|" + additionalOptions;
				}
				return "{{Authority control" + result + "}}";
			}
			else
			{
				return "";
			}
		}
public static string GetAuthorityControlTemplate ( Entity entity , string additionalOptions , Dictionary < string , string > additionalKeys ) { string result = " " ; foreach ( string auth in CommonsAuthorities ) { if ( EntityHasAuthority ( auth , entity ) ) { result += " " + auth + " " + ConvertAuthorityFromWikidataToCommons ( auth , entity ) ; } } if ( additionalKeys != null ) { foreach ( KeyValuePair < string , string > kv in additionalKeys ) { if ( ! EntityHasAuthority ( kv . Key , entity ) ) { result += " " + kv . Key + " " + kv . Value ; } } } if ( ! string . IsNullOrEmpty ( result ) ) { result += " " + entity . id ; if ( ! string . IsNullOrEmpty ( additionalOptions ) ) { result += " " + additionalOptions ; } return " " + result + " " ; } else { return " " ; } }
Creates an authority control template for the specified entity.
Creates an authority control template for the specified entity .
// wikidata by itself is not enough to warrant the template
None
entity
Entity
additionalOptions
string
None
additionalKeys
Dictionary<string, string>