About this board

Babel user information
es-N Este usuario tiene una comprensión nativa del español.
en-3 This user has advanced knowledge of English.
pt-2 Este utilizador tem um nível médio de português.
fr-1 Cet utilisateur dispose de connaissances de base en français.
it-1 Questo utente può contribuire con un livello elementare in italiano.
Users by language

Previous discussion was archived at User talk:Ivanhercaz/Archive 1 on 2017-01-02.

81.61.119.223 (talkcontribs)

Hola Iván. He estado mirando el nombre de Yanira y si aparece en Wikipedia, pero cuando se busca en Wikidata no aparece. ¿Es eso normal?.

Un saludo,

Esperanza

Ivanhercaz (talkcontribs)

Buenas, Esperanza:

Si eres quien creo, que intuyo que sí, te recomiendo que aproveches que tienes una cuenta creada e inicies sesión para contribuir y discutir en las páginas de discusión, así no expones tu IP a los demás.

Acabo de mirar lo que comentas: existe Yanira en Wikipedia en español, pero es una página de desambiguación, es decir, que expone los diferentes conceptos a los que se puede referir "Yanira". Sin embargo, no hay artículo para el nombre ni para los personajes mitológicos que menciona en la desambiguación.

Si te fijas en Ianira (Q3791505), señala que es el elemento de una página de desambiguación. Por lo tanto, no sería correcto vincular la name (P2561) con ese elemento. Mi consejo es que crees el elemento con el siguiente esquema:

Esas son las tres propiedades con las que tienes que crear como mínimo el elemento para el nombre "Yanira". Cuando hayas creado el elemento, puedes compartirlo conmigo y yo lo reviso y le añado cualquier detalle que se me ocurra.

Saludos

Reply to "Creación de un nombre en Wikidata"

New OpenRefine reconciliation service

2
Pintoch (talkcontribs)

Hi!

Thank you for wearing the {{User loves OpenRefine}} userbox on your user page!

Because the existing Wikidata reconciliation service has had severe performance issues recently, I have created a new one which should be faster and more robust. You can add it to OpenRefine in the reconciliation dialog with the following URL: https://wikidata.reconci.link/en/api (or by replacing en by any other language code).

If you have any issues with this new service, let me know.

Happy reconciling!

Ivanhercaz (talkcontribs)

Thank you for the notification, @Pintoch!

Reply to "New OpenRefine reconciliation service"

Reminder: Community Insights Survey

1
MediaWiki message delivery (talkcontribs)

RMaung (WMF) 19:54, 20 September 2019 (UTC)

Reply to "Reminder: Community Insights Survey"
MediaWiki message delivery (talkcontribs)

RMaung (WMF) 17:38, 10 September 2019 (UTC)

Reply to "Community Insights Survey"
Summary by Ivanhercaz

How change labels and descriptions with a Python script made by Edoderoo.

Edoderoo (talkcontribs)
Ivanhercaz (talkcontribs)

Hi Edoderoo! It sounds great, it is a way to begin with a easy task and learn how to work Wikidata with a bot. I have moved your script to my user page and changed all the "nl" to "es" (I have thought I could make the same for Portuguese).

CanaryBot is running in PAWS when it works in the es-wiki. I could use the script in a Python notebook, don't you think? Sorry, but haven't worked with Python notebook deeply yet, so I would like to know if there is some way to test it with logfiles without writing the items.

Tonight I will request the bot permission for "Set Spanish and Portuguese label and description" and I will explain how I am going to work and that I will begin to set the Spanish task for all Indonesian villages.

If you answer my doubt I would try to begin with test edits that night. I want to be sure before to run the task because with less errors, better.

Thanks in advance!

Regards, Ivanhercaz

P. S. Well, I could use site = pywikibot.Site('test', 'wikidata') to test this script, no? What I need if I want to test it in this test-space is to be sure that exists "Indonesian villages" where I could make the change, no?

Edoderoo (talkcontribs)

You can indeed use test.wikidata to test your edits. When I wrote this script yesterday evening, I replaced the village.editEntity() with a print() as a start, until it showed me well enough results... After replacing the print() with .editEntity() I often add a print(0/0) temporarily after my editEntity(), this will cause a runtime error just after the edit, so it will be limited to one edit... Then I can check my edit in the browser, and when all is fine, I remove the "divide by zero" Obviously, when using test.wikidata you can take more risks and less precautions.

Ivanhercaz (talkcontribs)

I have test the code in Test-Wikidata but it didn't works, I think that it could be because there isn't the query service, no? I created items with "instance of" : "indonesian village" and "country" : "Indonesia" and change in your query code the P and Q to the new created (Q40354 and Q40355).

Could it be happens because Test-Wikidata hasn't a query service available and therefore it doesn't execute the main query to search the items that the script have to set?

Edoderoo (talkcontribs)

That might be possible, I never used test.wikidata (or maybe once in my early days). Then my suggestion is to put a # remark before the editEntry to comment it out, and see how the script will work on the real Wikidata... When that runs fine, you can put the editEntry back...

Edoderoo (talkcontribs)

Another solution can be: Instead of using wd_sparql_query, which is just a generator to list items, you can manually pick a few items that exist on test.wikidata.org and put them in your own generator....

def generate_a_few:

 myitemlist=['Q40354','Q40355']
 for wd in myitemlist:
   if (wd.exists()):
     wd.get(get_redirect=True)
     yield wd

It seems that test.wikidata.org is pretty empty after all. For Q2225692 there is no record, and I've seen just now that the two records above were created by yourself...

Ivanhercaz (talkcontribs)

First, reply to your last comment about how empty is test.wikidata.org: yes, there isn't so much properties nor items, but I created the necessary to execute the query; I created, as you have said, the items that I shared with you, the "instance of", because it didn't exist, and the Q40353 (Indonesian village).

I am going to test first with the second solution: create an array of items to modify. I will notify you in this post if it works fine in test.wikidata.org

Then, if it doesn't work, I would put a # remark before the editEntry.

What I don't want is make any edit in Wikidata yet because I haven't got the task approved or the permission to execute it. I will request the task to test it in Wikidata as soon as possible.

When I will have some news about the script or the task, I will notify you!

Regards, Ivanhercaz

Edoderoo (talkcontribs)

First of all, good luck. Secondly, you are allowed to make some test edits with your bot, as it is part of requesting a bot-flag. So I would not wait till you get aproval, but just create like 50 edits to be a good example of what you want to achieve. You can double check these edits manually, and keep in mind: your bot is allowed to make any edit that you would have done manually with your own account too, only a bot is allowed to make edits faster, like 1 edit per second. Standard the pywikibot-throttle is set to 10 seconds, so I don't expect people will complain.

Ivanhercaz (talkcontribs)

All right Edoderoo! Thank you for your help and the information. When I request the task, I will begin to made it, but only 50 edits to check that it works fine. I have thought that when I have the permission, I am going to config user-config to execute it with a maxlag = 5.

Finally I have decided to comment the editEntry because the other way didn't run. What I get in the Python notebook is:

Q14635224-0-0-17-[]-<>
Q14634769-0-0-31-[]-<>
Q13486880-0-0-57-[]-<>
Q14652128-0-0-61-[]-<>
Q14634980-0-0-64-[]-<>
Q14684990-0-0-90-[]-<>
Q13571010-0-0-108-[]-<>

I understand that if there is a Indonesian label, the script set the Spanish label. But if the result, like Q14684990-0-0-90-[]-<> hasn't anything at the right, after the <>, I understand that it doesn't exist a Indonesian label to set the Spanish label. I have checked some items ―Q14635224, Q14633921 and Q14684990― and I didn't see the Indonesian label, but there is in Dutch and Germany, I thought it could be useful to use the nl tag to set the Spanish, but when I replace the "id" for "nl" it checks items where the "id" is set and not the "nl".

I think there is something in the code that I am not understanding. Excuse me, the code isn't hard, but there is something that I am not seeing.

Edoderoo (talkcontribs)

just before the try: line, put something like: print('[%s]-<%s>' % (nl,id))

this will print the Spanish label (nl) within <> and the Indonesian label between [] ... The first one/Spanish will be blank, and the Indonesian one will be filled ... Something else you can do is use print(data) that will print the variable data, that will look something like '{labels : {es:Indonesian village name}}' and this is exactly the "command" for editEntity() to change the es-label ...

Later on you can also add: data.update('{descriptions:{%s:%s}}' % (lang,'pueblo en Indonesia')) This will set the description ...

Ivanhercaz (talkcontribs)

Thank you so much Edoderoo! Now it seems to work fine and I understand it. About description, could it make at the same time? Something like:

      es_blank += 1  
      data={}
      data.update({'labels':{lang:id}})
      data.update('{descriptions':'{%s:%s}'}' % (lang,'pueblo en Indonesia'))
      print('[%s]-<%s>' % (es,id))
      print(data)

Or, do I need to make another function and execute in another instance to add descriptions?

I am reading Pywikibot API Docs., so I hope to clarify more how to develop with it.

Edoderoo (talkcontribs)

Yes, you can do the label and description in one editEntity(). You build the data part in two steps, like you show above, and send that to editEntity(data,summary='Edit summary')

Ivanhercaz (talkcontribs)

If I use:

      es_blank += 1  
      data={}
      data.update({'labels':{lang:id}})
      data.update('{descriptions:{%s:%s}}' % (lang,'pueblo en Indonesia'))
      print('[%s]-<%s>' % (es,id))
      print(data)

I get a ValueError:

ValueError                                Traceback (most recent call last)
<ipython-input-20-cf0e0cf7c5ee> in <module>()
     29       data={}
     30       data.update({'labels':{lang:id}})
---> 31       data.update('{descriptions:{%s:%s}}' % (lang,'pueblo en Indonesia'))
     32       print('[%s]-<%s>' % (es,id))
     33       print(data)

ValueError: dictionary update sequence element #0 has length 1; 2 is required

I am trying to solve it, any idea?

Edoderoo (talkcontribs)

I made a mistake, the format for data.update is : data.update({ : }) ... within the brackets you get two values, so: data.update({'labels':{'es':'pueblo en Indonesia'}}) (the second one is nested, to make it a bit harder ;-)) line 31 has a slightly different (and therefor wrong) format in the end... sorry for that!

data.update({'descriptions':'{%s:%s}' % ('es','pueblo en Indonesia')})

Ivanhercaz (talkcontribs)

Don't worry Edoderoo! Now it works perfectly, thank you. I suppose that the error was something with :, but I didn't find how fix it. I am going to request the task tonight, I will mention you because this script is yours and I am very grateful with you.

Edoderoo (talkcontribs)

You're welcome, I'm glad to help to make free knowledge better ;-)

There are no older topics