org.semanticweb.HermiT.tableau.ExtensionManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.semanticweb.hermit Show documentation
Show all versions of org.semanticweb.hermit Show documentation
HermiT is reasoner for ontologies written using the Web
Ontology Language (OWL). Given an OWL file, HermiT can determine whether or
not the ontology is consistent, identify subsumption relationships between
classes, and much more.
This is the maven build of HermiT and is designed for people who wish to use
HermiT from within the OWL API. It is now versioned in the main HermiT
version repository, although not officially supported by the HermiT
developers.
The version number of this package is a composite of the HermiT version and
an value representing releases of this packaged version. So, 1.3.7.1 is the
first release of the mavenized version of HermiT based on the 1.3.7 release
of HermiT.
This package includes the Jautomata library
(http://jautomata.sourceforge.net/), and builds with it directly. This
library appears to be no longer under active development, and so a "fork"
seems appropriate. No development is intended or anticipated on this code
base.
/* Copyright 2008, 2009, 2010 by the Oxford University Computing Laboratory
This file is part of HermiT.
HermiT is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
HermiT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with HermiT. If not, see .
*/
package org.semanticweb.HermiT.tableau;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.semanticweb.HermiT.model.AnnotatedEquality;
import org.semanticweb.HermiT.model.AtomicConcept;
import org.semanticweb.HermiT.model.AtomicRole;
import org.semanticweb.HermiT.model.Concept;
import org.semanticweb.HermiT.model.DLPredicate;
import org.semanticweb.HermiT.model.DataRange;
import org.semanticweb.HermiT.model.DescriptionGraph;
import org.semanticweb.HermiT.model.Equality;
import org.semanticweb.HermiT.model.InternalDatatype;
import org.semanticweb.HermiT.model.InverseRole;
import org.semanticweb.HermiT.model.Role;
import org.semanticweb.HermiT.monitor.TableauMonitor;
public final class ExtensionManager implements Serializable {
private static final long serialVersionUID=5900300914631070591L;
protected final Tableau m_tableau;
protected final TableauMonitor m_tableauMonitor;
protected final DependencySetFactory m_dependencySetFactory;
protected final Map m_extensionTablesByArity;
protected final ExtensionTable[] m_allExtensionTablesArray;
protected final ExtensionTable m_binaryExtensionTable;
protected final ExtensionTable m_ternaryExtensionTable;
protected final Object[] m_binaryAuxiliaryTupleContains;
protected final Object[] m_binaryAuxiliaryTupleAdd;
protected final Object[] m_ternaryAuxiliaryTupleContains;
protected final Object[] m_ternaryAuxiliaryTupleAdd;
protected final Object[] m_fouraryAuxiliaryTupleContains;
protected final Object[] m_fouraryAuxiliaryTupleAdd;
protected PermanentDependencySet m_clashDependencySet;
protected boolean m_addActive;
public ExtensionManager(Tableau tableau) {
m_tableau=tableau;
m_tableauMonitor=m_tableau.m_tableauMonitor;
m_dependencySetFactory=m_tableau.m_dependencySetFactory;
m_extensionTablesByArity=new HashMap();
m_binaryExtensionTable=
new ExtensionTableWithTupleIndexes(m_tableau,2,!m_tableau.isDeterministic(),
new TupleIndex[] {
new TupleIndex(new int[] { 1,0 }),
new TupleIndex(new int[] { 0,1 })
}
) {
private static final long serialVersionUID=1462821385000191875L;
public boolean isTupleActive(Object[] tuple) {
return ((Node)tuple[1]).isActive();
}
public boolean isTupleActive(int tupleIndex) {
return ((Node)m_tupleTable.getTupleObject(tupleIndex,1)).isActive();
}
};
m_extensionTablesByArity.put(new Integer(2),m_binaryExtensionTable);
m_ternaryExtensionTable=
new ExtensionTableWithTupleIndexes(m_tableau,3,!m_tableau.isDeterministic(),
new TupleIndex[] {
new TupleIndex(new int[] { 0,1,2 }),
new TupleIndex(new int[] { 1,2,0 }),
new TupleIndex(new int[] { 2,0,1 })
}
) {
private static final long serialVersionUID=-731201626401421877L;
public boolean isTupleActive(Object[] tuple) {
return ((Node)tuple[1]).isActive() && ((Node)tuple[2]).isActive();
}
public boolean isTupleActive(int tupleIndex) {
return ((Node)m_tupleTable.getTupleObject(tupleIndex,1)).isActive()
&& ((Node)m_tupleTable.getTupleObject(tupleIndex,2)).isActive();
}
};
m_extensionTablesByArity.put(new Integer(3),m_ternaryExtensionTable);
for (DescriptionGraph descriptionGraph : m_tableau.m_permanentDLOntology.getAllDescriptionGraphs()) {
Integer arityInteger=Integer.valueOf(descriptionGraph.getNumberOfVertices()+1);
if (!m_extensionTablesByArity.containsKey(arityInteger))
m_extensionTablesByArity.put(arityInteger,new ExtensionTableWithFullIndex(m_tableau,descriptionGraph.getNumberOfVertices()+1,!m_tableau.isDeterministic()));
}
m_allExtensionTablesArray=new ExtensionTable[m_extensionTablesByArity.size()];
m_extensionTablesByArity.values().toArray(m_allExtensionTablesArray);
m_binaryAuxiliaryTupleContains=new Object[2];
m_binaryAuxiliaryTupleAdd=new Object[2];
m_ternaryAuxiliaryTupleContains=new Object[3];
m_ternaryAuxiliaryTupleAdd=new Object[3];
m_fouraryAuxiliaryTupleContains=new Object[4];
m_fouraryAuxiliaryTupleAdd=new Object[4];
}
public void clear() {
for (int index=m_allExtensionTablesArray.length-1;index>=0;--index)
m_allExtensionTablesArray[index].clear();
m_clashDependencySet=null;
m_binaryAuxiliaryTupleContains[0]=null;
m_binaryAuxiliaryTupleContains[1]=null;
m_binaryAuxiliaryTupleAdd[0]=null;
m_binaryAuxiliaryTupleAdd[1]=null;
m_ternaryAuxiliaryTupleContains[0]=null;
m_ternaryAuxiliaryTupleContains[1]=null;
m_ternaryAuxiliaryTupleContains[2]=null;
m_ternaryAuxiliaryTupleAdd[0]=null;
m_ternaryAuxiliaryTupleAdd[1]=null;
m_ternaryAuxiliaryTupleAdd[2]=null;
m_fouraryAuxiliaryTupleContains[0]=null;
m_fouraryAuxiliaryTupleContains[1]=null;
m_fouraryAuxiliaryTupleContains[2]=null;
m_fouraryAuxiliaryTupleContains[3]=null;
m_fouraryAuxiliaryTupleAdd[0]=null;
m_fouraryAuxiliaryTupleAdd[1]=null;
m_fouraryAuxiliaryTupleAdd[2]=null;
m_fouraryAuxiliaryTupleAdd[3]=null;
}
public void branchingPointPushed() {
for (int index=m_allExtensionTablesArray.length-1;index>=0;--index)
m_allExtensionTablesArray[index].branchingPointPushed();
}
public void backtrack() {
for (int index=m_allExtensionTablesArray.length-1;index>=0;--index)
m_allExtensionTablesArray[index].backtrack();
}
public ExtensionTable getBinaryExtensionTable() {
return m_binaryExtensionTable;
}
public ExtensionTable getTernaryExtensionTable() {
return m_ternaryExtensionTable;
}
public ExtensionTable getExtensionTable(int arity) {
switch (arity) {
case 2:
return m_binaryExtensionTable;
case 3:
return m_ternaryExtensionTable;
default:
return m_extensionTablesByArity.get(arity);
}
}
public Collection getExtensionTables() {
return m_extensionTablesByArity.values();
}
public boolean propagateDeltaNew() {
boolean hasChange=false;
for (int index=0;index
© 2015 - 2025 Weber Informatics LLC | Privacy Policy