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
ELK consequence-based reasoning engine
/**
*
*/
package org.semanticweb.elk.reasoner.taxonomy;
/*
* #%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%
*/
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.semanticweb.elk.owl.interfaces.ElkClass;
import org.semanticweb.elk.owl.interfaces.ElkNamedIndividual;
import org.semanticweb.elk.owl.predefined.PredefinedElkClass;
import org.semanticweb.elk.reasoner.ProgressMonitor;
import org.semanticweb.elk.reasoner.ReasonerComputation;
import org.semanticweb.elk.reasoner.indexing.hierarchy.IndexedClass;
import org.semanticweb.elk.reasoner.indexing.hierarchy.IndexedClassEntity;
import org.semanticweb.elk.reasoner.indexing.hierarchy.IndexedIndividual;
import org.semanticweb.elk.reasoner.indexing.visitors.IndexedClassEntityVisitor;
import org.semanticweb.elk.reasoner.stages.ClassTaxonomyState;
import org.semanticweb.elk.reasoner.stages.InstanceTaxonomyState;
import org.semanticweb.elk.reasoner.taxonomy.model.UpdateableInstanceNode;
import org.semanticweb.elk.reasoner.taxonomy.model.UpdateableInstanceTaxonomy;
import org.semanticweb.elk.reasoner.taxonomy.model.UpdateableTaxonomy;
import org.semanticweb.elk.reasoner.taxonomy.model.UpdateableTaxonomyNode;
import org.semanticweb.elk.reasoner.taxonomy.model.UpdateableTypeNode;
import org.semanticweb.elk.util.concurrent.computation.ComputationExecutor;
import org.semanticweb.elk.util.concurrent.computation.InputProcessor;
import org.semanticweb.elk.util.concurrent.computation.InputProcessorFactory;
/**
* Cleans both class and instance taxonomies concurrently
*
* @author Pavel Klinov
*
* [email protected]
*/
public class TaxonomyCleaning extends
ReasonerComputation {
public TaxonomyCleaning(Collection inputs,
ClassTaxonomyState classTaxonomyState,
InstanceTaxonomyState instanceTaxonomyState,
ComputationExecutor executor, int maxWorkers,
ProgressMonitor progressMonitor) {
super(inputs, new TaxonomyCleaningFactory(classTaxonomyState,
instanceTaxonomyState), executor, maxWorkers, progressMonitor);
}
}
/**
*
* @author Pavel Klinov
*
* [email protected]
*/
class TaxonomyCleaningFactory
implements
InputProcessorFactory> {
/*private static final Logger LOGGER_ = Logger
.getLogger(TaxonomyCleaningFactory.class);*/
private final ClassTaxonomyState classTaxonomyState_;
private final InstanceTaxonomyState instanceTaxonomyState_;
TaxonomyCleaningFactory(final ClassTaxonomyState classTaxonomyState,
final InstanceTaxonomyState instanceTaxonomyState) {
classTaxonomyState_ = classTaxonomyState;
instanceTaxonomyState_ = instanceTaxonomyState;
}
@Override
public InputProcessor getEngine() {
return new InputProcessor() {
// a simple dispatching visitor
private final IndexedClassEntityVisitor> submissionVisitor_ = new IndexedClassEntityVisitor