Closed jiangjiechen closed 4 years ago
You can load the mapping.sling
file into memory as a SLING store, e.g.:
import sling
mapping = sling.Store()
mapping.load("mapping.sling")
You can use the API in sling/nlp/wiki/wikipedia-map.h to convert from Wikipedia article names to Wikidata QIDs. This uses mapping.sling
together with redirects.sling
. The formats are described in the wiki workflow file.
Thanks!
I now understand how to get QIDs with Wikipedia article NAMEs with mapping.sling
, though it still troubles me to get QIDs with Wikipedia PAGEIDs (i.e. WIDs). I know that the WID can be acquired when queried with the corresponding QID in documents@10.rec
, but can it be done reversely, and more elegantly/efficiently?
i.e. 1) is there a way to get QIDs with WIDs in sling with Python? or 2) is there a way to get article NAMEs with WIDs in sling with Python?
The Wikipedia page ids are not recorded in Wikidata, so we do the mapping through Wikipedia article names instead. We keep the Wikipedia page ids in documents@10.rec
so you can make your own mapping.
OK, thanks a lot.
I understand that
e/wiki/en/mapping.sling
is created bywikipedia-mapping
task, but how can I access the mapping between the article ids (PAGEIDs) of Wikipedia and entity ids (QIDs) of Wikidata using this "mapping.sling" or something else? Is there an api to convert article ids to entity ids and vice versa? Thank you in advance.