Skip to content
Pruthiv Rajan edited this page Oct 12, 2020 · 23 revisions

Owner : Pruthivrajan

Dictionary : Drugs

Overview:

Creating Dictionary using SPARQL query

Procedure

  1. Run SPARQL query using following command:

SELECT ?wikidata ?wikidataLabel ?wikipedia ?wikidataAltLabel ?wikidataDescription ?wikidataformule ?wikidatapicture ?hindi ?hindiLabel ?hindialtlabel ?hindiwikipedia ?tamil ?tamilLabel ?tamilaltlabel ?tamilwikipedia ?sanskrit ?sanskritLabel ?sanskritaltLabel ?sanskritwikipedia ?spanish ?spanishLabel ?spanishaltLabel ?spanishwikipedia ?urdu ?urduLabel ?urdualtLabel ?urduwikipedia WHERE { ?wikidata wdt:P31 wd:Q12140; wdt:P274 ?wikidataformule; wdt:P117 ?wikidatapicture. OPTIONAL { ?wikipedia schema:about ?wikidata; schema:isPartOf https://en.wikipedia.org/ } OPTIONAL { ?hindiwikipedia schema:about ?wikidata; schema:isPartOf https://hi.wikipedia.org/ } OPTIONAL { ?tamilwikipedia schema:about ?wikidata; schema:isPartOf https://ta.wikipedia.org/ } OPTIONAL { ?sanskritwikipedia schema:about ?wikidata; schema:isPartOf https://sa.wikipedia.org/ } OPTIONAL { ?spanishwikipedia schema:about ?wikidata; schema:isPartOf https://es.wikipedia.org/ } OPTIONAL { ?urduwikipedia schema:about ?wikidata; schema:isPartOf https://ur.wikipedia.org/ } SERVICE wikibase:label { bd:serviceParam wikibase:language "en".

Selecting the prefered label

?wikidata skos:altLabel ?wikidataAltLabel ; rdfs:label ?wikidataLabel; schema:description  ?wikidataDescription          

} SERVICE wikibase:label { bd:serviceParam wikibase:language "hi".

Selecting the prefered label

?wikidata skos:altLabel ?hindialtlabel .
?wikidata rdfs:label ?hindiLabel .
?wikidata schema:description ?hindi ;

} SERVICE wikibase:label { bd:serviceParam wikibase:language "ta".

Selecting the prefered label

?wikidata skos:altLabel ?tamilaltlabel .
?wikidata rdfs:label ?tamilLabel .
?wikidata schema:description ?tamil ;

} SERVICE wikibase:label { bd:serviceParam wikibase:language "sa".

Selecting the prefered label

?wikidata skos:altLabel ?sanskritaltlabel .
?wikidata rdfs:label ?sanskritLabel .
?wikidata schema:description ?sanskrit ;

} SERVICE wikibase:label { bd:serviceParam wikibase:language "es".

Selecting the prefered label

?wikidata skos:altLabel ?spanishaltlabel .
?wikidata rdfs:label ?spanishLabel .
?wikidata schema:description ?spanish ;

} SERVICE wikibase:label { bd:serviceParam wikibase:language "ur".

Selecting the prefered label

?wikidata skos:altLabel ?urdualtlabel .
?wikidata rdfs:label ?urduLabel .
?wikidata schema:description ?urdu ;

} }

  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
  • Language : English,தமிழ்,हिन्दी,اردو,spanish,sanskrit

Clone this wiki locally