org.semanticweb.elk.reasoner.taxonomy.ConcurrentClassTaxonomy 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 Oxford University Computing Laboratory
* %%
* 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.Set;
import org.semanticweb.elk.owl.interfaces.ElkClass;
import org.semanticweb.elk.owl.interfaces.ElkEntity;
import org.semanticweb.elk.owl.predefined.PredefinedElkClassFactory;
import org.semanticweb.elk.reasoner.taxonomy.impl.AbstractDistinctBottomTaxonomy;
import org.semanticweb.elk.reasoner.taxonomy.impl.AbstractUpdateableGenericTaxonomy;
import org.semanticweb.elk.reasoner.taxonomy.impl.BottomGenericTaxonomyNode;
import org.semanticweb.elk.reasoner.taxonomy.impl.ConcurrentNodeStore;
import org.semanticweb.elk.reasoner.taxonomy.impl.NonBottomGenericTaxonomyNode;
import org.semanticweb.elk.reasoner.taxonomy.model.ComparatorKeyProvider;
import org.semanticweb.elk.reasoner.taxonomy.model.GenericTaxonomyNode;
import org.semanticweb.elk.reasoner.taxonomy.model.TaxonomyNodeFactory;
/**
* Class taxonomy that is suitable for concurrent processing. Taxonomy objects
* are only constructed for consistent ontologies, and some consequences of this
* are hardcoded here.
*
* @author Yevgeny Kazakov
* @author Frantisek Simancik
* @author Markus Kroetzsch
* @author Pavel Klinov
* @author Peter Skocovsky
*/
public class ConcurrentClassTaxonomy
extends AbstractUpdateableGenericTaxonomy<
ElkClass,
GenericTaxonomyNode.Projection,
NonBottomGenericTaxonomyNode.Projection
> {
private final GenericTaxonomyNode.Projection bottomNode_;
public ConcurrentClassTaxonomy(final PredefinedElkClassFactory elkFactory,
final ComparatorKeyProvider classKeyProvider) {
super(
new ConcurrentNodeStore<
ElkClass,
NonBottomGenericTaxonomyNode.Projection
>(classKeyProvider),
new TaxonomyNodeFactory<
ElkClass,
NonBottomGenericTaxonomyNode.Projection,
AbstractDistinctBottomTaxonomy<
ElkClass,
GenericTaxonomyNode.Projection,
NonBottomGenericTaxonomyNode.Projection
>
>() {
@Override
public NonBottomGenericTaxonomyNode.Projection createNode(
final Iterable extends ElkClass> members,
final int size,
final AbstractDistinctBottomTaxonomy<
ElkClass,
GenericTaxonomyNode.Projection,
NonBottomGenericTaxonomyNode.Projection
> taxonomy) {
return new NonBottomGenericTaxonomyNode.Projection(
taxonomy, members, size);
}
},
elkFactory.getOwlThing());
this.bottomNode_ = new BottomGenericTaxonomyNode.Projection(
this, elkFactory.getOwlNothing());
}
@Override
public GenericTaxonomyNode.Projection getBottomNode() {
return bottomNode_;
}
@Override
protected Set extends GenericTaxonomyNode.Projection> toTaxonomyNodes(
final Set extends NonBottomGenericTaxonomyNode.Projection> nodes) {
return nodes;
}
}