MaRDI4NFDI / portal-compose

docker-composer repo for mardi
https://portal.mardi4nfdi.de
GNU General Public License v3.0
3 stars 1 forks source link

Malformed input in point in time for Software Heritage ID #460

Closed eloiferrer closed 3 months ago

eloiferrer commented 5 months ago

Issue description: I cannot edit items that have statements with the Software Heritage ID property (P1454).

The error I get when trying to update such items is that the input in the 'point in time' qualifier is malformed.

This is due to values such as +2021-07-09T21:46:51Z in (https://portal.mardi4nfdi.de/wiki/Item:Q31528). According to the wikidata documentation (https://www.wikidata.org/wiki/Help:Dates#Precision) precision higher than days is not allowed. So I wonder how the data was introduced in the first place.

TODOS:

Acceptance-Criteria

Checklist for this issue:

eloiferrer commented 5 months ago

@physikerwelt Do we need to save hours:minutes:seconds for the qualifier in the Software Heritage ID, or is it ok if we just save the day?

physikerwelt commented 5 months ago

I think the exact point in time is helpful to find the timestamp. However, the precision can be changed, https://github.com/wikimedia/mediawiki-extensions-MathSearch/blob/9142a97c96a4f8e455760e041bf562f2934afb5a/maintenance/AddSwhids.php#L111 I wonder if there is an easier way to do that.

eloiferrer commented 3 months ago

Now that an update for the R packages has been completed, @physikerwelt you could add back the SWH statements to see if they are created with the right time precision and whether the items are editable afterwards.

physikerwelt commented 3 months ago

I think the exact point in time is helpful to find the timestamp. However, the precision can be changed, https://github.com/wikimedia/mediawiki-extensions-MathSearch/blob/9142a97c96a4f8e455760e041bf562f2934afb5a/maintenance/AddSwhids.php#L111 I wonder if there is an easier way to do that.

Was done here https://github.com/wikimedia/mediawiki-extensions-MathSearch/commit/daeaf6bc8f12ced15063efa60f27dba051c0f18b so the script is ready to be executed again

physikerwelt commented 3 months ago

Some documentation for future use.

The first thing you have to is to create a new swh token from

https://archive.softwareheritage.org/oidc/profile/#tokens

then put this into localsettings

$wgMathSearchSwhToken

physikerwelt commented 3 months ago

run it in a screen session

mardi-test-user@mardi02:~/portal-compose$ docker compose exec -it wikibase /bin/bash
root@b8ae8b9618ca:/var/www/html# ./maintenance/run ./extensions/MathSearch/maintenance/AddSwhids.php 
2024-03-12 16:54:18 b8ae8b9618ca my_wiki: mquery tag registered
^C
root@b8ae8b9618ca:/var/www/

I stopped it after a second so that @eloiferrer can check one or two the entries manually.

Examples are latest edits here https://portal.mardi4nfdi.de/wiki/Special:Contributions/Swh_import

physikerwelt commented 3 months ago

From the chat

I've tested it now. They look good, but the stored precision still seems to be in seconds. I get this error if I try to edit: https://portal.mardi4nfdi.de/wiki/Item:Q1334176

'Malformed input: [+2021-08](tel:202108)-02T12:37:05Z'

This should be [+2021-08](tel:202108)-02T00:00:00Z in order for us to edit it through the API
physikerwelt commented 3 months ago

This is now complete