org.semanticweb.elk.owl.inferences.ElkInferenceHash Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elk-proofs Show documentation
Show all versions of elk-proofs Show documentation
Utilities to present tracing results (encoded proofs) to the
user
/*
* #%L
* ELK Proofs Package
* $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%
*/
package org.semanticweb.elk.owl.inferences;
import org.semanticweb.elk.util.hashing.HashGenerator;
public class ElkInferenceHash implements ElkInference.Visitor {
private static final ElkInferenceHash INSTANCE_ = new ElkInferenceHash();
private static int combinedHashCode(int... hashes) {
return HashGenerator.combineListHash(hashes);
}
public static ElkInference.Visitor getHashVisitor() {
return INSTANCE_;
}
private static int hashCode(int n) {
return n;
}
private static int hashCode(Object o) {
return o.hashCode();
}
// forbid construction; only static methods should be used
private ElkInferenceHash() {
}
@Override
public Integer visit(final ElkClassAssertionOfClassInclusion inference) {
return combinedHashCode(
hashCode(ElkClassAssertionOfClassInclusion.class),
hashCode(inference.getInstance()),
hashCode(inference.getType()));
}
@Override
public Integer visit(
ElkClassInclusionEmptyObjectOneOfOwlNothing inference) {
return combinedHashCode(hashCode(
ElkClassInclusionOwlThingEmptyObjectIntersectionOf.class));
}
@Override
public Integer visit(
ElkClassInclusionEmptyObjectUnionOfOwlNothing inference) {
return combinedHashCode(hashCode(
ElkClassInclusionOwlThingEmptyObjectIntersectionOf.class));
}
@Override
public Integer visit(ElkClassInclusionExistentialComposition inference) {
return combinedHashCode(
hashCode(ElkClassInclusionExistentialComposition.class),
hashCode(inference.getClassExpressions()),
hashCode(inference.getSubChain()),
hashCode(inference.getSuperProperty()));
}
@Override
public Integer visit(
ElkClassInclusionExistentialFillerExpansion inference) {
return combinedHashCode(
hashCode(ElkClassInclusionExistentialFillerExpansion.class),
hashCode(inference.getSubClass()),
hashCode(inference.getSuperClass()),
hashCode(inference.getProperty()));
}
@Override
public Integer visit(
ElkClassInclusionExistentialOfObjectHasSelf inference) {
return combinedHashCode(
hashCode(ElkClassInclusionExistentialOfObjectHasSelf.class),
hashCode(inference.getSubClass()),
hashCode(inference.getProperty()));
}
@Override
public Integer visit(ElkClassInclusionExistentialOwlNothing inference) {
return combinedHashCode(
hashCode(ElkClassInclusionExistentialOwlNothing.class),
hashCode(inference.getProperty()));
}
@Override
public Integer visit(
ElkClassInclusionExistentialPropertyExpansion inference) {
return combinedHashCode(
hashCode(ElkClassInclusionExistentialPropertyExpansion.class),
hashCode(inference.getSubProperty()),
hashCode(inference.getSuperProperty()),
hashCode(inference.getFiller()));
}
@Override
public Integer visit(ElkClassInclusionExistentialRange inference) {
return combinedHashCode(
hashCode(ElkClassInclusionExistentialRange.class),
hashCode(inference.getProperty()),
hashCode(inference.getFiller()),
hashCode(inference.getRanges()));
}
@Override
public Integer visit(ElkClassInclusionExistentialTransitivity inference) {
return combinedHashCode(
hashCode(ElkClassInclusionExistentialTransitivity.class),
hashCode(inference.getClassExpressions()),
hashCode(inference.getTransitiveProperty()));
}
@Override
public Integer visit(ElkClassInclusionHierarchy inference) {
return combinedHashCode(hashCode(ElkClassInclusionHierarchy.class),
hashCode(inference.getExpressions()));
}
@Override
public Integer visit(ElkClassInclusionNegationClash inference) {
return combinedHashCode(hashCode(ElkClassInclusionNegationClash.class),
hashCode(inference.getExpression()));
}
@Override
public Integer visit(
ElkClassInclusionObjectIntersectionOfComposition inference) {
return combinedHashCode(
hashCode(
ElkClassInclusionObjectIntersectionOfComposition.class),
hashCode(inference.getSubExpression()),
hashCode(inference.getConjuncts()));
}
@Override
public Integer visit(
ElkClassInclusionObjectIntersectionOfDecomposition inference) {
return combinedHashCode(
hashCode(
ElkClassInclusionObjectIntersectionOfDecomposition.class),
hashCode(inference.getConjuncts()),
hashCode(inference.getConjunctPos()));
}
@Override
public Integer visit(
ElkClassInclusionObjectIntersectionOfInclusion inference) {
return combinedHashCode(
hashCode(ElkClassInclusionObjectIntersectionOfInclusion.class),
hashCode(inference.getSubClasses()),
hashCode(inference.getSuperPositions()));
}
@Override
public Integer visit(ElkClassInclusionObjectOneOfInclusion inference) {
return combinedHashCode(
hashCode(ElkClassInclusionObjectOneOfInclusion.class),
hashCode(inference.getSuperIndividuals()),
hashCode(inference.getSubIndividualPositions()));
}
@Override
public Integer visit(ElkClassInclusionObjectUnionOfComposition inference) {
return combinedHashCode(
hashCode(ElkClassInclusionObjectUnionOfComposition.class),
hashCode(inference.getDisjuncts()),
hashCode(inference.getDisjunctPos()));
}
@Override
public Integer visit(ElkClassInclusionOfClassAssertion inference) {
return combinedHashCode(
hashCode(ElkClassInclusionOfClassAssertion.class),
hashCode(inference.getInstance()),
hashCode(inference.getType()));
}
@Override
public Integer visit(ElkClassInclusionOfDisjointClasses inference) {
return combinedHashCode(
hashCode(ElkClassInclusionOfDisjointClasses.class),
hashCode(inference.getExpressions()),
hashCode(inference.getFirstPos()),
hashCode(inference.getSecondPos()));
}
@Override
public Integer visit(ElkClassInclusionOfEquivaletClasses inference) {
return combinedHashCode(
hashCode(ElkClassInclusionOfEquivaletClasses.class),
hashCode(inference.getExpressions()),
hashCode(inference.getSubPos()),
hashCode(inference.getSuperPos()));
}
@Override
public Integer visit(ElkClassInclusionOfObjectPropertyAssertion inference) {
return combinedHashCode(
hashCode(ElkClassInclusionOfObjectPropertyAssertion.class),
hashCode(inference.getSubject()),
hashCode(inference.getProperty()),
hashCode(inference.getObject()));
}
@Override
public Integer visit(ElkClassInclusionOfObjectPropertyDomain inference) {
return combinedHashCode(
hashCode(ElkClassInclusionOfObjectPropertyDomain.class),
hashCode(inference.getProperty()),
hashCode(inference.getDomain()));
}
@Override
public Integer visit(ElkClassInclusionOfReflexiveObjectProperty inference) {
return combinedHashCode(
hashCode(ElkClassInclusionOfReflexiveObjectProperty.class),
hashCode(inference.getProperty()));
}
@Override
public Integer visit(
final ElkClassInclusionOwlBottomObjectProperty inference) {
return combinedHashCode(
hashCode(ElkClassInclusionOwlBottomObjectProperty.class));
}
@Override
public Integer visit(ElkClassInclusionOwlNothing inference) {
return combinedHashCode(hashCode(ElkClassInclusionOwlNothing.class),
hashCode(inference.getSuperClass()));
}
@Override
public Integer visit(ElkClassInclusionOwlThing inference) {
return combinedHashCode(hashCode(ElkClassInclusionOwlThing.class),
hashCode(inference.getSubClass()));
}
@Override
public Integer visit(
final ElkClassInclusionOwlTopObjectProperty inference) {
return combinedHashCode(
hashCode(ElkClassInclusionOwlTopObjectProperty.class));
}
@Override
public Integer visit(
ElkClassInclusionOwlThingEmptyObjectIntersectionOf inference) {
return combinedHashCode(hashCode(
ElkClassInclusionOwlThingEmptyObjectIntersectionOf.class));
}
@Override
public Integer visit(ElkClassInclusionReflexivePropertyRange inference) {
return combinedHashCode(
hashCode(ElkClassInclusionReflexivePropertyRange.class),
hashCode(inference.getSubClass()),
hashCode(inference.getProperty()),
hashCode(inference.getRange()));
}
@Override
public Integer visit(
ElkClassInclusionSingletonObjectUnionOfDecomposition inference) {
return combinedHashCode(
hashCode(
ElkClassInclusionOwlThingEmptyObjectIntersectionOf.class),
hashCode(inference.getDisjunct()));
}
@Override
public Integer visit(ElkClassInclusionTautology inference) {
return combinedHashCode(hashCode(ElkClassInclusionTautology.class),
hashCode(inference.getExpression()));
}
@Override
public Integer visit(ElkClassInclusionTopObjectHasValue inference) {
return combinedHashCode(
hashCode(ElkClassInclusionTopObjectHasValue.class),
hashCode(inference.getValue()));
}
@Override
public Integer visit(
final ElkDifferentIndividualsOfDisjointClasses inference) {
return combinedHashCode(
hashCode(ElkDifferentIndividualsOfDisjointClasses.class),
hashCode(inference.getDifferent()));
}
@Override
public Integer visit(
final ElkDisjointClassesIntersectionInconsistencies inference) {
return combinedHashCode(
hashCode(ElkDisjointClassesIntersectionInconsistencies.class),
hashCode(inference.getExpressions()));
}
@Override
public Integer visit(ElkDisjointClassesOfDifferentIndividuals inference) {
return combinedHashCode(
hashCode(ElkDisjointClassesOfDifferentIndividuals.class),
hashCode(inference.getDifferent()));
}
@Override
public Integer visit(ElkDisjointClassesOfDisjointUnion inference) {
return combinedHashCode(
hashCode(ElkDisjointClassesOfDisjointUnion.class),
hashCode(inference.getDefined()),
hashCode(inference.getDisjoint()));
}
@Override
public Integer visit(ElkEquivalentClassesCycle inference) {
return combinedHashCode(hashCode(ElkEquivalentClassesCycle.class),
hashCode(inference.getExpressions()));
}
@Override
public Integer visit(ElkEquivalentClassesObjectHasValue inference) {
return combinedHashCode(
hashCode(ElkPropertyInclusionOfTransitiveObjectProperty.class),
hashCode(inference.getProperty()),
hashCode(inference.getValue()));
}
@Override
public Integer visit(ElkEquivalentClassesObjectOneOf inference) {
return combinedHashCode(hashCode(ElkEquivalentClassesObjectOneOf.class),
hashCode(inference.getMembers()));
}
@Override
public Integer visit(ElkEquivalentClassesOfDisjointUnion inference) {
return combinedHashCode(
hashCode(ElkEquivalentClassesOfDisjointUnion.class),
hashCode(inference.getDefined()),
hashCode(inference.getDisjoint()));
}
@Override
public Integer visit(ElkEquivalentClassesOfSameIndividual inference) {
return combinedHashCode(
hashCode(ElkEquivalentClassesOfSameIndividual.class),
hashCode(inference.getSame()));
}
@Override
public Integer visit(
final ElkObjectPropertyAssertionOfClassInclusion inference) {
return combinedHashCode(
hashCode(ElkObjectPropertyAssertionOfClassInclusion.class),
hashCode(inference.getSubject()),
hashCode(inference.getProperty()),
hashCode(inference.getObject()));
}
@Override
public Integer visit(
final ElkObjectPropertyDomainOfClassInclusion inference) {
return combinedHashCode(
hashCode(ElkObjectPropertyDomainOfClassInclusion.class),
hashCode(inference.getProperty()),
hashCode(inference.getDomain()));
}
@Override
public Integer visit(ElkPropertyInclusionHierarchy inference) {
return combinedHashCode(hashCode(ElkPropertyInclusionHierarchy.class),
hashCode(inference.getSubExpression()),
hashCode(inference.getExpressions()));
}
@Override
public Integer visit(ElkPropertyInclusionOfEquivalence inference) {
return combinedHashCode(
hashCode(ElkPropertyInclusionOfEquivalence.class),
hashCode(inference.getExpressions()),
hashCode(inference.getSubPos()),
hashCode(inference.getSuperPos()));
}
@Override
public Integer visit(
ElkPropertyInclusionOfTransitiveObjectProperty inference) {
return combinedHashCode(
hashCode(ElkPropertyInclusionOfTransitiveObjectProperty.class),
hashCode(inference.getProperty()));
}
@Override
public Integer visit(ElkPropertyInclusionTautology inference) {
return combinedHashCode(hashCode(ElkPropertyInclusionTautology.class),
hashCode(inference.getExpression()));
}
@Override
public Integer visit(ElkPropertyRangePropertyExpansion inference) {
return combinedHashCode(
hashCode(ElkPropertyRangePropertyExpansion.class),
hashCode(inference.getSubProperty()),
hashCode(inference.getSuperProperty()),
hashCode(inference.getRange()));
}
@Override
public Integer visit(final ElkSameIndividualOfEquivalentClasses inference) {
return combinedHashCode(
hashCode(ElkSameIndividualOfEquivalentClasses.class),
hashCode(inference.getSame()));
}
@Override
public Integer visit(ElkToldAxiom inference) {
return combinedHashCode(hashCode(ElkToldAxiom.class),
hashCode(inference.getAxiom()));
}
}