The goal is simple: infer class membership (using rdfs:subClassOf and rdf:type predicates). Don't do it with a property path or something. You must let the reasoner do it.
I've tried to do this with a few reasoners. All unsuccessful.
- Apache Jena wasn't able to do it with 12GB of RAM.
- Stardog wasn't able to do it with 12GB of RAM.
- REQUIEM wasn't able to do it with 12GB of RAM.
In this zip file you'll find tbox.ttl
and abox.ttl
.
This is the query that should return 79 results:
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ex: <http://example.com/>
SELECT *
WHERE
{ ex:condition0 a ?type
}
Without reasoning it yields 1 result:
type |
---|
http://www\.wikidata\.org/entity/Q32552 |
But with RDFS reasoning enabled there should be 79 results.
e.g.
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ex: <http://example.com/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT *
WHERE
{ ex:condition0 rdf:type/(rdfs:subClassOf)* ?type }
Yields:
I've used this challenge to improve the reasoner in RDF4J. The improvements will be available in RDF4J 4.1.0.
On my laptop I'm able to run the challenge in just over 2 minutes with -Xmx12G.
RDF4J was previously only able to run the challenge if given significantly more memory (6 min with 24GB).
Here is the PR with the improvements: eclipse-rdf4j/rdf4j#3790
Here is the code i used to run the challenge: https://github.com/eclipse/rdf4j/blob/a023fb5d34d711ab25c113eee8e9902b7ae5e07f/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/RDFSChallenge.java