Skip to content

Building SPARQL to Wikidata map for dictionaries

VAISHALI ARORA edited this page Sep 20, 2020 · 4 revisions

Aim : To do SPARQL to Wikidata mapping for the dictionary


My SPARQL output for dictionary funder : https://github.com/petermr/openVirus/blob/master/dictionaries/funders/funder.sparql.xml


To convert SPARQL output to ami dict format, I used the following command:

amidict -vv --dictionary funder --directory mydictionaries --input funder.sparql.xml create --informat wikisparqlxml --sparqlmap wikidataID=Funder,wikidataURL=Funder,term=FunderLabel,name=FunderLabel,country=CountryLabel,crossrefid=crossrefid,description=FunderDescription,wikipediaPage=Funder,wikipediaURL=wikipedia

The few initials of my command after running for approx. 30 seconds, are as follows and yes, no output in the directory😞.

....
--outformats        : d [Lorg.contentmine.ami.tools.AbstractAMIDictTool$DictionaryFileFormat;@cf93bb
--query             : d      null
--sparqlmap         : m {wikidataID=Funder, wikidataURL=Funder, term=FunderLabel, name=FunderLabel, _country=CountryLabel, _crossrefid=crossrefid, description=FunderDescription, wikipediaPage=Funder, wikipediaURL=wikipedia}
....
dictionaryName: funder
{Funder=[wikidataID, wikidataURL, wikipediaPage], crossrefid=[_crossrefid], FunderLabel=[term, name], FunderDescription=[description], CountryLabel=[_country], wikipedia=[wikipediaURL]}
sparqlVariables [Funder, FunderLabel, FunderDescription, Country, CountryLabel, instanceofLabel, crossrefid, wikipedia]
sparqlNameByAmiName: {country=CountryLabel, wikidataID=Funder, name=FunderLabel, description=FunderDescription, term=FunderLabel, wikidataURL=Funder, wikipediaPage=Funder, crossrefid=crossrefid, wikipediaURL=wikipedia}
amiNames [_country, wikidataID, name, description, term, wikidataURL, wikipediaPage, crossrefid, wikipediaURL]
WS>[_country, wikidataID, name, description, term, wikidataURL, wikipediaPage, crossrefid, wikipediaURL]
Personal ami name: country
Personal ami name: crossrefid
[_country, _crossrefid, description, name, term, wikidataID, wikidataURL, wikipediaPage, wikipediaURL]
search: [CountryLabel, Funder, FunderLabel, FunderDescription, FunderLabel, Funder, Funder, crossrefid, wikipedia]
target: [Funder, FunderLabel, FunderDescription, Country, CountryLabel, instanceofLabel, crossrefid, wikipedia]
java.lang.NullPointerException
        at java.util.ArrayList.addAll(Unknown Source)
        at org.contentmine.ami.tools.dictionary.WikidataSparql.checkWikidataVariables(WikidataSparql.java:84)
......

Thanks! This looks like a software BUG! I will look at it immediately.

-Bug fixed, output obtained is at: https://github.com/petermr/openVirus/blob/master/dictionaries/funders/sparql2ami/funder.xml

Clone this wiki locally