Skip to content
Pruthiv Rajan edited this page Aug 1, 2020 · 23 revisions

Owner : Pruthivrajan

Dictionary : Drugs

Overview:

Creating Dictionary using SPARQL query

Procedure

  1. Run SPARQL query using following command:

SELECT ?moleculeLabel ?formule ?picture ?molecule ?moleculeAltLabel ?moleculeDescription ?wikipedia WHERE { ?molecule wdt:P31 wd:Q12140; wdt:P274 ?formule; wdt:P117 ?picture. SERVICE wikibase:label { bd:serviceParam wikibase:language "en, de". } OPTIONAL { ?wikipedia schema:about ?molecule . ?wikipedia schema:inLanguage "en" . ?wikipedia schema:isPartOf <https://en.wikipedia.org/> . } } ORDER BY (?moleculeLabel) LIMIT 10000

  1. Downloaded the results from SPARQL endpoint.

  2. Open the SPARQL results in notepad.

  3. Use amidict for SPARQL mapping. Command for SPARQL mapping as follows:

amidict -vv --dictionary drug --directory dict --input drugs.sparql.xml create --informat=wikisparqlxml --sparqlmap wikidata=molecule,term=moleculeLabel,name=moleculeLabel,description=moleculeDescription,wikipedia=wikipedia,_picture=picture,_formula=formule --synonyms=moleculeAltLabel

  1. Commit all these results in Github

Outcome

Dictionary contains:

  • Wikidata Id
  • Molecular name
  • Molecular formula
  • Compound picture
  • Molecular Alt Label
  • Molecular description
  • Wikipedia link

Clone this wiki locally