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

org.semanticweb.elk.reasoner.saturation.rulesystem.InferenceSystem Maven / Gradle / Ivy

There is a newer version: 0.4.3
Show newest version
/*
 * #%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%
 */
package org.semanticweb.elk.reasoner.saturation.rulesystem;

import java.util.ArrayList;
import java.util.List;

import org.semanticweb.elk.reasoner.indexing.hierarchy.IndexedClassExpression;

/**
 * Abstract base class for inference systems. An inference system defines the
 * rules and data structures that form the basis of saturation-based reasoning.
 * It is parameterized by a generic Context type that its rules are based on. It
 * maintains a list of inference rules that implement a saturation calculus. The
 * generic context parameter is used to check the compatibility of the set of
 * rules with the context at compile time.
 * 
 * @author Markus Kroetzsch
 * 
 * @param 
 */
public abstract class InferenceSystem {

	protected List> inferenceRules = new ArrayList>();

	/**
	 * Add an inference rule to this inference system. This is typically done in
	 * the constructor of concrete inference systems.
	 * 
	 * @param inferenceRule
	 */
	public void add(InferenceRule inferenceRule) {
		inferenceRules.add(inferenceRule);
	}

	/**
	 * @return the list of inference rules of this inference system.
	 */
	public List> getInferenceRules() {
		return inferenceRules;
	}

	/**
	 * Create a new context for the given {@link IndexedClassExpression}.
	 * 
	 * @param root
	 *            an {@link IndexedClassExpression} for which the context should
	 *            be constructed
	 * @return a new context for the given {@link IndexedClassExpression}.
	 */
	public abstract C createContext(IndexedClassExpression root);

	/**
	 * Temporary method to cast contexts that have been stored without
	 * specifying C back to C. This is mainly needed for indexed objects, since
	 * they do not depend on C but currently store contexts; this will be fixed
	 * by storing contexts elsewhere.
	 * 
	 * @deprecated This method will vanish soon. Do not use it unless you
	 *             really, really must.
	 * @param context
	 * @return the context casted to the given type
	 */
	@SuppressWarnings("unchecked")
	@Deprecated
	public C castContext(Context context) {
		return (C) context;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy