
org.semanticweb.elk.protege.proof.AbstractFlattenedInclusionHierarchyStep Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elk-protege Show documentation
Show all versions of elk-protege Show documentation
ELK plug-in for Protege ontology editor
The newest version!
package org.semanticweb.elk.protege.proof;
/*-
* #%L
* ELK OWL API Binding
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2011 - 2016 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.List;
import org.liveontologies.puli.ProofNode;
import org.liveontologies.puli.ProofStep;
import org.semanticweb.owlapi.model.OWLAxiom;
abstract class AbstractFlattenedInclusionHierarchyStep
extends AbstractInlinedStep implements ProofStep {
AbstractFlattenedInclusionHierarchyStep(ProofStep step) {
super(step);
}
abstract boolean canConvert(ProofStep step);
@Override
void process(ProofStep step) {
List extends ProofNode> premises = step.getPremises();
for (int i = 0; i < premises.size(); i++) {
ProofNode premise = premises.get(i);
if (!process(premise)) {
// inferences for the premise cannot be flattened
addPremise(premise);
}
}
}
private boolean process(ProofNode node) {
Collection extends ProofStep> steps = node.getInferences();
if (steps.size() > 1) {
// don't expand multiple inferences
return false;
}
for (ProofStep step : steps) {
// just one step
if (canConvert(step)) {
process(step);
return true;
}
}
// else
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy