2

I would like to use RDFS level inferencing in some queries posed in the Wikidata Query Service which uses SPARQL. Does it support inferencing/reasoning? If so, in what kind? For example, is it Forward Chaining?

4

You can test that by inspecting the results of executing a query that assumes reasoning. For example, subclass of in RDFS is a transitive property. Therefore, querying for subclass of author, should return both its direct and indirect subclasses. Try it:

SELECT ?author ?authorLabel 
WHERE 
{
  ?author wdt:P279 wd:Q482980.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

When I executed it, it returned 28 results. However, finding the subclasses of writer, which is a subclass of author, returns 71 results, more than the author. Try it:

SELECT ?author ?authorLabel 
WHERE 
{
  ?author wdt:P279 wd:Q36180.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

This means that inferencing is not supported at the time of writing this answer, since when searching for author subclasses, it should have returned the subclasses of writer too (and its subclasses' subclasess etc.).

One workaround is to use, property paths. For example, entering the below query, even without inferencing, will return all subclasses of author in any level. Try it:

SELECT ?author ?authorLabel 
WHERE 
{
  ?author wdt:P279* wd:Q482980.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

By appending * to the wdt:P279 property, means a sequence of 0 or more subclass of properties.

Conducting a short research on the web, I have found two sources: [1], [2], from Wikidata, that are about the support of reasoning and inferencing. It is a really useful feature and I hope we will see it in the future.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.