Closed EvaSeidlmayer closed 3 years ago
the stack trace seems to indicate that you don't have the latest version; if that's correct, could you try to update to the latest version and retry? that can be done with the following command:
npm i -g wikibase-cli@latest
I updated to version 15.2.1, but the error still occurs.
TypeError: Cannot read property 'unit' of undefined
at Object.quantity (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/datatype_tests.js:60:42)
at Object.snakValue (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/validate.js:59:41)
at fullClaimBuilder (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/build_claim.js:48:14)
at module.exports (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/build_claim.js:21:12)
at obj.(anonymous function).values.map.value (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/format.js:51:39)
at Array.map (<anonymous>)
at /usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/format.js:51:26
at Array.reduce (<anonymous>)
at Object.claims (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/format.js:26:32)
at module.exports (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/edit.js:48:45)
So it seems that the provided data misses a quantity value, could you share the content of your Q123.json
file?
Otherwise, I'm not sure if it's related, but to re-create an item in another Wikibase, you would need to already have created the properties used by the item in that new Wikibase, is that the case?
I don't think it has to do with the SPARQL endpoint, as, as announced in #46, the SPARQL endpoint isn't used for data validation anymore
So, what I try to do is testing a bot (https://github.com/EvaSeidlmayer/orcid-for-wikidata) on wikidata test instance. But first I need to create those items I try to change (or better fill up with new information) by the bot. With regard to the properties used in the test instance I changed all properties. This is reduced version of one of the items I try to create:
{
"type": "item",
"labels": {
"nl": "The progression of 102 Brazilian patients with bipolar disorder: outcome of first 12 months of prospective follow-up."
},
"descriptions": {
"en": "scientific article"
},
"aliases": {},
"claims": {
"P433": {
"value": "1",
"references": [
{
"P149": "Q5412157",
"P698": "27000544",
"P93": "https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=EXT_ID:27000544%20AND%20SRC:MED&resulttype=core&format=json",
"P388": {
"time": "2020-06-01T00:00:00.000Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
}
}
],
"id": "Q39900762$11DDA1CD-B570-4B85-8C7F-7C78E0C2C662"
},
"P80807": [
{
"value": "Fernanda Novis",
"qualifiers": {
"P1545": "1"
},
"references": [
{
"P149": "Q5412157",
"P698": "27000544",
"P93": "https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=EXT_ID:27000544%20AND%20SRC:MED&resulttype=core&format=json",
"P388": {
"time": "2020-06-01T00:00:00.000Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
}
}
],
"id": "Q39900762$4882DC81-CCD2-4F1F-80DA-EF4909CDDC50"
},
{
"value": "Patricia Cirillo",
"qualifiers": {
"P1545": "2"
},
"references": [
{
"P149": "Q5412157",
"P698": "27000544",
"P93": "https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=EXT_ID:27000544%20AND%20SRC:MED&resulttype=core&format=json",
"P388": {
"time": "2020-06-01T00:00:00.000Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
}
}
],
"id": "Q39900762$39F21CC3-C822-4F0A-BFA1-3FB7A5A38FE0"
},
{
"value": "Rafael Assis da Silva",
"qualifiers": {
"P1545": "3"
},
"references": [
{
"P149": "Q5412157",
"P698": "27000544",
"P93": "https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=EXT_ID:27000544%20AND%20SRC:MED&resulttype=core&format=json",
"P388": {
"time": "2020-06-01T00:00:00.000Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
}
}
],
"id": "Q39900762$72D9F52A-AE2B-4DF8-9398-5442ED798972"
},
{
"value": "Ana Letícia Santos",
"qualifiers": {
"P1545": "4"
},
"references": [
{
"P149": "Q5412157",
"P698": "27000544",
"P93": "https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=EXT_ID:27000544%20AND%20SRC:MED&resulttype=core&format=json",
"P388": {
"time": "2020-06-01T00:00:00.000Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
}
}
],
"id": "Q39900762$180E85EB-35D2-4C5B-96BC-B8D2E659016A"
},
{
"value": "Luciana Angélica Silva Silveira",
"qualifiers": {
"P1545": "5"
},
"references": [
{
"P149": "Q5412157",
"P698": "27000544",
"P93": "https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=EXT_ID:27000544%20AND%20SRC:MED&resulttype=core&format=json",
"P388": {
"time": "2020-06-01T00:00:00.000Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
}
}
],
"id": "Q39900762$24E66E70-398A-4012-801A-C2BC3696D36D"
},
{
"value": "Adriana Cardoso",
"qualifiers": {
"P1545": "6"
},
"references": [
{
"P149": "Q5412157",
"P698": "27000544",
"P93": "https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=EXT_ID:27000544%20AND%20SRC:MED&resulttype=core&format=json",
"P388": {
"time": "2020-06-01T00:00:00.000Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
}
}
],
"id": "Q39900762$2ACB2D67-7D5A-4BCF-AEA5-E4F497FB0B67"
},
{
"value": "Pedro Coscarelli",
"qualifiers": {
"P1545": "7"
},
"references": [
{
"P149": "Q5412157",
"P698": "27000544",
"P93": "https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=EXT_ID:27000544%20AND%20SRC:MED&resulttype=core&format=json",
"P388": {
"time": "2020-06-01T00:00:00.000Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
}
}
],
"id": "Q39900762$D169DD3C-B73D-4C58-9C90-A4BF797F183B"
},
{
"value": "Antônio Egidio Nardi",
"qualifiers": {
"P1545": "8"
},
"references": [
{
"P149": "Q5412157",
"P698": "27000544",
"P93": "https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=EXT_ID:27000544%20AND%20SRC:MED&resulttype=core&format=json",
"P388": {
"time": "2020-06-01T00:00:00.000Z",
"timezone": 0,
"before": 0,
"after": 0,
"precision": 11,
"calendarmodel": "http://www.wikidata.org/entity/Q1985727"
}
}
],
"id": "Q39900762$528875D1-8434-4B4E-A0A7-7D3B5B6CB977"
}
]
},
"sitelinks": {}
}
Now I get the message that I do not have the bot rights... Okay. So it seems, the Wikibase-CLI works. It's some problem with the json. Thank you!
You're welcome! Should that issue be closed then? That error message is still a mystery thought ^^
Maybe you can wait one more day till you close the issue? Then I can be sure I can fix all errors by modifying the json file. Thank you!
I closed as the request day (+ some margin ;)) expired, but feel welcome to reopen if the problem occurs again
I created a json file from a template in order to create the same item in an other wikibase instance. When I try... wb create-entity Q123.json or: wb edit-entity Q123.json
I get the following error message:
TypeError: Cannot read property 'unit' of undefined at Object.quantity (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/datatype_tests.js:55:42) at Object.snakValue (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/validate.js:58:41) at fullClaimBuilder (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/build_claim.js:48:14) at module.exports (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/build_claim.js:21:12) at obj.(anonymous function).values.map.value (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/format.js:46:39) at Array.map ()
at /usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/format.js:46:26
at Array.reduce ()
at Object.claims (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/format.js:26:32)
at module.exports (/usr/local/lib/node_modules/wikibase-cli/node_modules/wikibase-edit/lib/entity/edit.js:48:33)
The problem seems to be similar to the one described in the closed issue #46. The error should be fixed, but it still occurs. I also tried the suggested workaround with a specified SPARQL-endpoint:
wb create-entity Q123.json --sparql-endpoint https://query.wikidata.org/
Hm. What am I doing wrong?