org.semanticweb.elk.reasoner.taxonomy.TaxonomyCleaning Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elk-reasoner Show documentation
Show all versions of elk-reasoner Show documentation
The core ELK Reasoner package
/*
* #%L
* ELK Reasoner
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2011 - 2012 Department of Computer Science, University of Oxford
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package org.semanticweb.elk.reasoner.taxonomy;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import org.semanticweb.elk.owl.interfaces.ElkClass;
import org.semanticweb.elk.owl.interfaces.ElkNamedIndividual;
import org.semanticweb.elk.reasoner.ProgressMonitor;
import org.semanticweb.elk.reasoner.ReasonerComputationWithInputs;
import org.semanticweb.elk.reasoner.indexing.model.IndexedClass;
import org.semanticweb.elk.reasoner.indexing.model.IndexedClassEntity;
import org.semanticweb.elk.reasoner.indexing.model.IndexedDefinedClass;
import org.semanticweb.elk.reasoner.indexing.model.IndexedIndividual;
import org.semanticweb.elk.reasoner.indexing.model.IndexedPredefinedClass;
import org.semanticweb.elk.reasoner.taxonomy.model.InstanceNode;
import org.semanticweb.elk.reasoner.taxonomy.model.NonBottomTaxonomyNode;
import org.semanticweb.elk.reasoner.taxonomy.model.TypeNode;
import org.semanticweb.elk.reasoner.taxonomy.model.UpdateableInstanceTaxonomy;
import org.semanticweb.elk.reasoner.taxonomy.model.UpdateableTaxonomy;
import org.semanticweb.elk.util.concurrent.computation.ConcurrentExecutor;
import org.semanticweb.elk.util.concurrent.computation.DelegateInterruptMonitor;
import org.semanticweb.elk.util.concurrent.computation.InputProcessor;
import org.semanticweb.elk.util.concurrent.computation.InputProcessorFactory;
import org.semanticweb.elk.util.concurrent.computation.InterruptMonitor;
/**
* Cleans both class and instance taxonomy concurrently.
*
* @author Pavel Klinov
*
* [email protected]
* @author Peter Skocovsky
*/
public class TaxonomyCleaning
extends
ReasonerComputationWithInputs {
public TaxonomyCleaning(final Collection inputs,
final InterruptMonitor interrupter,
final UpdateableTaxonomy classTaxonomy,
final UpdateableInstanceTaxonomy instanceTaxonomy,
final ConcurrentExecutor executor, final int maxWorkers,
final ProgressMonitor progressMonitor) {
super(inputs,
new TaxonomyCleaningFactory(interrupter, classTaxonomy,
instanceTaxonomy),
executor, maxWorkers, progressMonitor);
}
}
/**
*
* @author Pavel Klinov
*
* [email protected]
* @author Peter Skocovsky
*/
class TaxonomyCleaningFactory extends DelegateInterruptMonitor
implements
InputProcessorFactory> {
private final UpdateableTaxonomy classTaxonomy_;
private final UpdateableInstanceTaxonomy instanceTaxonomy_;
TaxonomyCleaningFactory(final InterruptMonitor interrupter,
final UpdateableTaxonomy classTaxonomy,
final UpdateableInstanceTaxonomy instanceTaxonomy) {
super(interrupter);
classTaxonomy_ = classTaxonomy;
instanceTaxonomy_ = instanceTaxonomy;
}
@Override
public InputProcessor getEngine() {
return new InputProcessor() {
// a simple dispatching visitor
private final IndexedClassEntity.Visitor> submissionVisitor_ = new IndexedClassEntity.Visitor