All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.semanticweb.elk.matching.InferenceMatchMapImpl Maven / Gradle / Ivy

There is a newer version: 0.35.0
Show newest version
/*
 * #%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.matching;

import java.util.Collection;

import org.semanticweb.elk.matching.conclusions.BackwardLinkMatch1;
import org.semanticweb.elk.matching.conclusions.BackwardLinkMatch1Watch;
import org.semanticweb.elk.matching.conclusions.BackwardLinkMatch2;
import org.semanticweb.elk.matching.conclusions.BackwardLinkMatch2Watch;
import org.semanticweb.elk.matching.conclusions.BackwardLinkMatch3;
import org.semanticweb.elk.matching.conclusions.BackwardLinkMatch3Watch;
import org.semanticweb.elk.matching.conclusions.ClassInconsistencyMatch1;
import org.semanticweb.elk.matching.conclusions.ClassInconsistencyMatch1Watch;
import org.semanticweb.elk.matching.conclusions.ConclusionMatch;
import org.semanticweb.elk.matching.conclusions.DisjointSubsumerMatch1;
import org.semanticweb.elk.matching.conclusions.DisjointSubsumerMatch1Watch;
import org.semanticweb.elk.matching.conclusions.ForwardLinkMatch1;
import org.semanticweb.elk.matching.conclusions.ForwardLinkMatch1Watch;
import org.semanticweb.elk.matching.conclusions.ForwardLinkMatch2;
import org.semanticweb.elk.matching.conclusions.ForwardLinkMatch2Watch;
import org.semanticweb.elk.matching.conclusions.ForwardLinkMatch3;
import org.semanticweb.elk.matching.conclusions.ForwardLinkMatch3Watch;
import org.semanticweb.elk.matching.conclusions.IndexedDisjointClassesAxiomMatch1;
import org.semanticweb.elk.matching.conclusions.IndexedDisjointClassesAxiomMatch1Watch;
import org.semanticweb.elk.matching.conclusions.IndexedEquivalentClassesAxiomMatch1;
import org.semanticweb.elk.matching.conclusions.IndexedEquivalentClassesAxiomMatch1Watch;
import org.semanticweb.elk.matching.conclusions.IndexedObjectPropertyRangeAxiomMatch1;
import org.semanticweb.elk.matching.conclusions.IndexedObjectPropertyRangeAxiomMatch1Watch;
import org.semanticweb.elk.matching.conclusions.IndexedSubClassOfAxiomMatch1;
import org.semanticweb.elk.matching.conclusions.IndexedSubClassOfAxiomMatch1Watch;
import org.semanticweb.elk.matching.conclusions.IndexedSubObjectPropertyOfAxiomMatch1;
import org.semanticweb.elk.matching.conclusions.IndexedSubObjectPropertyOfAxiomMatch1Watch;
import org.semanticweb.elk.matching.conclusions.PropagationMatch1;
import org.semanticweb.elk.matching.conclusions.PropagationMatch1Watch;
import org.semanticweb.elk.matching.conclusions.PropertyRangeMatch1;
import org.semanticweb.elk.matching.conclusions.PropertyRangeMatch1Watch;
import org.semanticweb.elk.matching.conclusions.SubClassInclusionComposedMatch1;
import org.semanticweb.elk.matching.conclusions.SubClassInclusionComposedMatch1Watch;
import org.semanticweb.elk.matching.conclusions.SubClassInclusionDecomposedMatch1;
import org.semanticweb.elk.matching.conclusions.SubClassInclusionDecomposedMatch1Watch;
import org.semanticweb.elk.matching.conclusions.SubPropertyChainMatch1;
import org.semanticweb.elk.matching.conclusions.SubPropertyChainMatch1Watch;
import org.semanticweb.elk.matching.inferences.InferenceMatch;
import org.semanticweb.elk.reasoner.indexing.model.IndexedDeclarationAxiom;
import org.semanticweb.elk.reasoner.indexing.model.IndexedDeclarationAxiomInference;
import org.semanticweb.elk.reasoner.indexing.model.IndexedDisjointClassesAxiom;
import org.semanticweb.elk.reasoner.indexing.model.IndexedDisjointClassesAxiomInference;
import org.semanticweb.elk.reasoner.indexing.model.IndexedEquivalentClassesAxiom;
import org.semanticweb.elk.reasoner.indexing.model.IndexedEquivalentClassesAxiomInference;
import org.semanticweb.elk.reasoner.indexing.model.IndexedObjectPropertyRangeAxiom;
import org.semanticweb.elk.reasoner.indexing.model.IndexedObjectPropertyRangeAxiomInference;
import org.semanticweb.elk.reasoner.indexing.model.IndexedSubClassOfAxiom;
import org.semanticweb.elk.reasoner.indexing.model.IndexedSubClassOfAxiomInference;
import org.semanticweb.elk.reasoner.indexing.model.IndexedSubObjectPropertyOfAxiom;
import org.semanticweb.elk.reasoner.indexing.model.IndexedSubObjectPropertyOfAxiomInference;
import org.semanticweb.elk.reasoner.saturation.conclusions.model.BackwardLink;
import org.semanticweb.elk.reasoner.saturation.conclusions.model.ClassInconsistency;
import org.semanticweb.elk.reasoner.saturation.conclusions.model.DisjointSubsumer;
import org.semanticweb.elk.reasoner.saturation.conclusions.model.ForwardLink;
import org.semanticweb.elk.reasoner.saturation.conclusions.model.Propagation;
import org.semanticweb.elk.reasoner.saturation.conclusions.model.PropertyRange;
import org.semanticweb.elk.reasoner.saturation.conclusions.model.SubClassInclusionComposed;
import org.semanticweb.elk.reasoner.saturation.conclusions.model.SubClassInclusionDecomposed;
import org.semanticweb.elk.reasoner.saturation.conclusions.model.SubPropertyChain;
import org.semanticweb.elk.reasoner.saturation.inferences.BackwardLinkInference;
import org.semanticweb.elk.reasoner.saturation.inferences.ClassInconsistencyInference;
import org.semanticweb.elk.reasoner.saturation.inferences.DisjointSubsumerInference;
import org.semanticweb.elk.reasoner.saturation.inferences.ForwardLinkInference;
import org.semanticweb.elk.reasoner.saturation.inferences.PropagationInference;
import org.semanticweb.elk.reasoner.saturation.inferences.SubClassInclusionComposedInference;
import org.semanticweb.elk.reasoner.saturation.inferences.SubClassInclusionDecomposedInference;
import org.semanticweb.elk.reasoner.saturation.properties.inferences.PropertyRangeInference;
import org.semanticweb.elk.reasoner.saturation.properties.inferences.SubPropertyChainInference;
import org.semanticweb.elk.reasoner.tracing.TracingProof;
import org.semanticweb.elk.util.collections.HashListMultimap;
import org.semanticweb.elk.util.collections.Multimap;

// TODO: avoid casts
@SuppressWarnings("unchecked")
class InferenceMatchMapImpl
		implements InferenceMap, InferenceMatchMap, InferenceMatchMapWriter {

	private final TracingProof inferences_;

	private final Multimap watchedInferences_ = new HashListMultimap();

	InferenceMatchMapImpl(TracingProof inferences) {
		this.inferences_ = inferences;
	}

	@Override
	public void add(BackwardLinkMatch1 conclusion,
			BackwardLinkMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);
	}

	@Override
	public void add(BackwardLinkMatch2 conclusion,
			BackwardLinkMatch2Watch inference) {
		watchedInferences_.add(conclusion, inference);
	}

	@Override
	public void add(BackwardLinkMatch3 conclusion,
			BackwardLinkMatch3Watch inference) {
		watchedInferences_.add(conclusion, inference);
	}

	@Override
	public void add(ClassInconsistencyMatch1 conclusion,
			ClassInconsistencyMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);
	}

	@Override
	public void add(DisjointSubsumerMatch1 conclusion,
			DisjointSubsumerMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);

	}

	@Override
	public void add(ForwardLinkMatch1 conclusion,
			ForwardLinkMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);

	}

	@Override
	public void add(ForwardLinkMatch2 conclusion,
			ForwardLinkMatch2Watch inference) {
		watchedInferences_.add(conclusion, inference);
	}

	@Override
	public void add(ForwardLinkMatch3 conclusion,
			ForwardLinkMatch3Watch inference) {
		watchedInferences_.add(conclusion, inference);
	}

	@Override
	public void add(IndexedDisjointClassesAxiomMatch1 conclusion,
			IndexedDisjointClassesAxiomMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);

	}

	@Override
	public void add(IndexedEquivalentClassesAxiomMatch1 conclusion,
			IndexedEquivalentClassesAxiomMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);

	}

	@Override
	public void add(IndexedObjectPropertyRangeAxiomMatch1 conclusion,
			IndexedObjectPropertyRangeAxiomMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);

	}

	@Override
	public void add(IndexedSubClassOfAxiomMatch1 conclusion,
			IndexedSubClassOfAxiomMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);
	}

	@Override
	public void add(IndexedSubObjectPropertyOfAxiomMatch1 conclusion,
			IndexedSubObjectPropertyOfAxiomMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);

	}

	@Override
	public void add(PropagationMatch1 conclusion,
			PropagationMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);
	}

	@Override
	public void add(PropertyRangeMatch1 conclusion,
			PropertyRangeMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);

	}

	@Override
	public void add(SubClassInclusionComposedMatch1 conclusion,
			SubClassInclusionComposedMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);
	}

	@Override
	public void add(SubClassInclusionDecomposedMatch1 conclusion,
			SubClassInclusionDecomposedMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);

	}

	@Override
	public void add(SubPropertyChainMatch1 conclusion,
			SubPropertyChainMatch1Watch inference) {
		watchedInferences_.add(conclusion, inference);

	}

	@Override
	public Iterable get(
			BackwardLink conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			BackwardLinkMatch1 conclusion) {
		return (Iterable) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			BackwardLinkMatch2 conclusion) {
		return (Iterable) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			BackwardLinkMatch3 conclusion) {
		return (Iterable) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			ClassInconsistency conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			ClassInconsistencyMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			DisjointSubsumer conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			DisjointSubsumerMatch1 conclusion) {
		return (Iterable) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			ForwardLink conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			ForwardLinkMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			ForwardLinkMatch2 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			ForwardLinkMatch3 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			IndexedDeclarationAxiom conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			IndexedDisjointClassesAxiom conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			IndexedDisjointClassesAxiomMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			IndexedEquivalentClassesAxiom conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			IndexedEquivalentClassesAxiomMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			IndexedObjectPropertyRangeAxiom conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			IndexedObjectPropertyRangeAxiomMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			IndexedSubClassOfAxiom conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			IndexedSubClassOfAxiomMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			IndexedSubObjectPropertyOfAxiom conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			IndexedSubObjectPropertyOfAxiomMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			Propagation conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			PropagationMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			PropertyRange conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			PropertyRangeMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			SubClassInclusionComposed conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			SubClassInclusionComposedMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			SubClassInclusionDecomposed conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			SubClassInclusionDecomposedMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	@Override
	public Iterable get(
			SubPropertyChain conclusion) {
		return (Iterable) inferences_
				.getInferences(conclusion);
	}

	@Override
	public Iterable get(
			SubPropertyChainMatch1 conclusion) {
		return (Collection) getWatchInferences(
				conclusion);
	}

	private Collection getWatchInferences(
			ConclusionMatch conclusion) {
		// need this method since some java compilers have problems for casting
		// directly
		return watchedInferences_.get(conclusion);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy