get_instanceof_fromsitelink = (article, project = "enwiki", lang = "en" ) => {
return fetch(
wdk.getEntitiesFromSitelinks({titles: article, sites: project})
)
.then(response => response.json())
.then(wdk.parse.wb.entities)
.then(out => {
if (Object.keys(out)[0] === "-1") {
return aq.table({qid: "", label: ""})
}
else if (Object.values(out)[0].claims["P31"] === undefined) {
return aq.table({qid: "", label: ""})
}
else {
return get_labels(Object.values(out)[0].claims.P31, lang)
}
}
)
.then(df => df
.rename({ qid: 'instanceof', label : 'instanceofLabel' })
.derive({article: aq.escape(d => article)}, { before: 'instanceof' })
)
}