Manual:Pywikibot/Compat/Wikidata/es

Crear un objeto DataPage
Different ways to create a DataPage and Page object for Wikidata: First way is creating a data_repo first, use this way only when you have ID of the item (Q####)

La segunda forma es:

No puedes cambiar ningún elemento, valor o etiqueta sin antes obtener los datos.

Obtener datos
Obtén los datos de una manera sencilla

Cambiar o crear afirmaciones/sentencias

 * property can be a string like "capital" or "p36" or "P36" or "36" or 36
 * value can be a string like "Moscow" or "Q649" or "q649" or "649" or 649
 * refs is optional and if you don't add any references the bot will change either:
 * ref1 can be a string like "imported from" or "p143" or etc
 * value1 can be a string like "English Wikipedia" or "q328" or etc
 * other refs are optional too


 * Remember:Important:language of values must the same as the Wikipedia page you load at first. For example, if you load Russia from Deutsch Wikipedia your values must be:

y si ejecutas tu bot con valores en inglés, el bot no funcionará

If there was a claim already the code changes the claim, and if not the code adds the claim.

Removing claim or claims
you can add the property in the way shown above, value is optional and it's better to use when we have multiple claims for a statement if you don't use value, every claim that uses the property will be removed

Ejemplo
Ejemplo simple para crear elementos nuevos.

Use this code snippet with care. It does not test whether a data repository item already exists. It only test whether it exists for a given site page. This could also mean that a given site page has no language link on a given repository page. This should be checked before a page is created.