fix to ABoxRecomputer's test for whether sameAs reasoning is enabled
This commit is contained in:
parent
ed9b82258d
commit
e74f65350f
1 changed files with 30 additions and 35 deletions
|
@ -52,12 +52,12 @@ public class ABoxRecomputer {
|
||||||
|
|
||||||
private OntModel tboxModel; // asserted and inferred TBox axioms
|
private OntModel tboxModel; // asserted and inferred TBox axioms
|
||||||
private OntModel aboxModel;
|
private OntModel aboxModel;
|
||||||
|
private Model inferenceModel;
|
||||||
private RDFService rdfService;
|
private RDFService rdfService;
|
||||||
private SimpleReasoner simpleReasoner;
|
private SimpleReasoner simpleReasoner;
|
||||||
private Object lock1 = new Object();
|
private Object lock1 = new Object();
|
||||||
private volatile boolean recomputing = false;
|
private volatile boolean recomputing = false;
|
||||||
private boolean stopRequested = false;
|
private boolean stopRequested = false;
|
||||||
private boolean handleSameAs = false;
|
|
||||||
|
|
||||||
private final int BATCH_SIZE = 100;
|
private final int BATCH_SIZE = 100;
|
||||||
private final int REPORTING_INTERVAL = 1000;
|
private final int REPORTING_INTERVAL = 1000;
|
||||||
|
@ -75,11 +75,12 @@ public class ABoxRecomputer {
|
||||||
this.tboxModel = tboxModel;
|
this.tboxModel = tboxModel;
|
||||||
this.aboxModel = aboxModel;
|
this.aboxModel = aboxModel;
|
||||||
this.rdfService = rdfService;
|
this.rdfService = rdfService;
|
||||||
|
this.inferenceModel = RDFServiceGraph.createRDFServiceModel(
|
||||||
|
new RDFServiceGraph(rdfService, ModelNames.ABOX_INFERENCES));
|
||||||
this.simpleReasoner = simpleReasoner;
|
this.simpleReasoner = simpleReasoner;
|
||||||
this.searchIndexer = searchIndexer;
|
this.searchIndexer = searchIndexer;
|
||||||
recomputing = false;
|
recomputing = false;
|
||||||
stopRequested = false;
|
stopRequested = false;
|
||||||
handleSameAs = simpleReasoner.getSameAsEnabled();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,7 +184,8 @@ public class ABoxRecomputer {
|
||||||
log.trace((System.currentTimeMillis() - start) + " ms to get assertions.");
|
log.trace((System.currentTimeMillis() - start) + " ms to get assertions.");
|
||||||
Model additionalInferences = recomputeIndividual(
|
Model additionalInferences = recomputeIndividual(
|
||||||
individualURI, null, assertions, rebuildModel, RUN_PLUGINS);
|
individualURI, null, assertions, rebuildModel, RUN_PLUGINS);
|
||||||
if (handleSameAs) {
|
|
||||||
|
if (simpleReasoner.getSameAsEnabled()) {
|
||||||
Set<String> sameAsInds = getSameAsIndividuals(individualURI);
|
Set<String> sameAsInds = getSameAsIndividuals(individualURI);
|
||||||
for (String sameAsInd : sameAsInds) {
|
for (String sameAsInd : sameAsInds) {
|
||||||
// sameAs for plugins is handled by the SimpleReasoner
|
// sameAs for plugins is handled by the SimpleReasoner
|
||||||
|
@ -423,8 +425,6 @@ public class ABoxRecomputer {
|
||||||
*/
|
*/
|
||||||
protected void updateInferenceModel(Model rebuildModel,
|
protected void updateInferenceModel(Model rebuildModel,
|
||||||
Collection<String> individuals) throws RDFServiceException {
|
Collection<String> individuals) throws RDFServiceException {
|
||||||
Model inferenceModel = RDFServiceGraph.createRDFServiceModel(
|
|
||||||
new RDFServiceGraph(rdfService, ModelNames.ABOX_INFERENCES));
|
|
||||||
Model existing = ModelFactory.createDefaultModel();
|
Model existing = ModelFactory.createDefaultModel();
|
||||||
for (String individualURI : individuals) {
|
for (String individualURI : individuals) {
|
||||||
Resource subjInd = ResourceFactory.createResource(individualURI);
|
Resource subjInd = ResourceFactory.createResource(individualURI);
|
||||||
|
@ -432,8 +432,6 @@ public class ABoxRecomputer {
|
||||||
}
|
}
|
||||||
Model retractions = existing.difference(rebuildModel);
|
Model retractions = existing.difference(rebuildModel);
|
||||||
Model additions = rebuildModel.difference(existing);
|
Model additions = rebuildModel.difference(existing);
|
||||||
inferenceModel.enterCriticalSection(Lock.WRITE);
|
|
||||||
try {
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
ChangeSet change = rdfService.manufactureChangeSet();
|
ChangeSet change = rdfService.manufactureChangeSet();
|
||||||
change.addRemoval(makeN3InputStream(retractions),
|
change.addRemoval(makeN3InputStream(retractions),
|
||||||
|
@ -444,9 +442,6 @@ public class ABoxRecomputer {
|
||||||
log.debug((System.currentTimeMillis() - start) +
|
log.debug((System.currentTimeMillis() - start) +
|
||||||
" ms to retract " + retractions.size() +
|
" ms to retract " + retractions.size() +
|
||||||
" statements and add " + additions.size() + " statements");
|
" statements and add " + additions.size() + " statements");
|
||||||
} finally {
|
|
||||||
inferenceModel.leaveCriticalSection();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private InputStream makeN3InputStream(Model m) {
|
private InputStream makeN3InputStream(Model m) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue