2

Given a term/concept, I want to decide if it belongs to computer science. For that, I am checking if the concept has a property path to computer science node. In other words, I am checking whether computer science is an ancestral concept.

For this purpose, I am using the following wikidata query.

SELECT DISTINCT ?item {
VALUES ?searchTerm { "word2vec"}
SERVICE wikibase:mwapi {
    bd:serviceParam wikibase:api "EntitySearch".
    bd:serviceParam wikibase:endpoint "www.wikidata.org".
    bd:serviceParam wikibase:limit 3 .
    bd:serviceParam mwapi:search ?searchTerm.
    bd:serviceParam mwapi:language "en".
    ?item wikibase:apiOutputItem mwapi:item.
    ?num wikibase:apiOrdinal true.
}
?item (wdt:P279|wdt:P31) ?type
filter exists {?type (wdt:P279|wdt:P361)* wd:Q21198}
}
ORDER BY ?searchTerm ?num

However, the query gets timeout.

Therefore, I would like to know if there is another way of solving my approach.

I am only interested in concepts that reaches computer science node using 8 or less hops. For example, is it possible to get all the nodes related to computer science node in 8 or less hops before, and then use this node list as a vocabulary to validate the concepts. Please let me know if my explaination is not clear.

I am happy to provide more details if needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.