egonw / ons-wikidata

Open Notebook for Wikidata scripts
MIT License
3 stars 3 forks source link

[suggestion] Exclude automatically statements generated with "null" #10

Closed Adafede closed 1 year ago

Adafede commented 2 years ago

This would make the QuickStatements cleaner.

Here is an example:

groovy quickstatements.groovy -d 10.1101/2021.12.24.474089

returns

qid,P2860,S248,s854,s813
# Fetching 10.1101/2021.12.24.474089 from https://opencitations.net/index/coci/api/v1/citations/10.1101/2021.12.24.474089 ...
# Found citing DOIs for 10.1101/2021.12.24.474089: 0
# citing articles for 10.1101/2021.12.24.474089
# Fetching 10.1101/2021.12.24.474089 from https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089 ...
# Found cited DOIs for 10.1101/2021.12.24.474089: 41
# cited articles for 10.1101/2021.12.24.474089
null,Q27818844,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q108844055,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q44704388,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q98513836,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q36179301,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q98665248,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q113307511,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q102075594,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q36226791,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q29616057,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q29547435,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q40020934,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q24616873,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q41016968,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q105742243,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q100951293,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q91135365,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q27807488,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q41474027,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q24629036,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q27136473,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q91218352,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q63352058,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q107272666,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q35129381,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q39993461,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q106856815,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q38050514,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q37473763,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q30004214,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q27921801,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q91903041,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q38655770,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q84573952,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q39115283,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q38864380,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q108126799,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11
null,Q51147300,Q107507940,"""https://opencitations.net/index/coci/api/v1/references/10.1101/2021.12.24.474089""",+2022-10-25T00:00:00Z/11

(because the preprint is not on Wikidata)

The same behavior exists in the citing articles:

groovy quickstatements.groovy -d 10.26434/CHEMRXIV.13721770

returns:

qid,P2860,S248,s854,s813
# Fetching 10.26434/CHEMRXIV.13721770 from https://opencitations.net/index/coci/api/v1/citations/10.26434/CHEMRXIV.13721770 ...
# Found citing DOIs for 10.26434/CHEMRXIV.13721770: 2
# citing articles for 10.26434/CHEMRXIV.13721770
Q109715863,null,Q107507940,"""https://opencitations.net/index/coci/api/v1/citations/10.26434/CHEMRXIV.13721770""",+2022-10-25T00:00:00Z/11
Q109736854,null,Q107507940,"""https://opencitations.net/index/coci/api/v1/citations/10.26434/CHEMRXIV.13721770""",+2022-10-25T00:00:00Z/11
# Fetching 10.26434/CHEMRXIV.13721770 from https://opencitations.net/index/coci/api/v1/references/10.26434/CHEMRXIV.13721770 ...
# Found cited DOIs for 10.26434/CHEMRXIV.13721770: 0
# cited articles for 10.26434/CHEMRXIV.13721770
egonw commented 2 years ago

Thanks, yeah, it should. In fact, the null should not even happen. Clearly need further debugging :(

egonw commented 1 year ago

Should be fixed in https://github.com/egonw/ons-wikidata/commit/853140e832ccb135ea4a78be2def51e3cfb04a09