forked from ontop/ontop
QuestOWLEmptyEntitiesChecker
skomlaebri edited this page May 27, 2014
·
2 revisions
Using Quest, given an ontology which is connected to a database via mappings, we can know which are its empty concepts and roles, empty entities that are no populated to anything.
The method can be called from QuestOWL asking the reasoner to getEmptyEntitiesChecker().
This method returns an instance of the class QuestOWLEmptyEntitiesChecker containing the empty concepts and empty roles.
The class QuestOWLEmptyEntitiesChecker can also be used directly providing the ontology and the QuestOWL connection.
It returns empty concepts and roles based on the mappings. It generates a set of SPARQL queries that tests:
- if there are empty concepts:
SELECT ?x WHERE {?x a concept .}
- if there are empty roles:
SELECT * WHERE {?x role ?y.}
Example
// Creating a new instance of the reasoner QuestOWLFactory factory = new QuestOWLFactory(); factory.setOBDAController(obdaModel); factory.setPreferenceHolder(p); QuestOWL reasoner = (QuestOWL) factory.createReasoner(ontology, new SimpleConfiguration()); QuestOWLEmptyEntitiesChecker check = ((QuestOWL) reasoner).getEmptyEntitiesChecker(); //Return list for empty concepts List<Predicate> emptyC = check.getEmptyConcepts(); //Return list for empty roles List<Predicate> emptyR = check.getEmptyRoles();
An example of the use directly the class can be seen here in QuestOWLEmptyEntitiesCheckerTest.java