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

uk.ac.manchester.cs.owl.owlapi.AbstractInternalsImpl Maven / Gradle / Ivy

/*
 * This file is part of the OWL API.
 *
 * The contents of this file are subject to the LGPL License, Version 3.0.
 *
 * Copyright (C) 2011, The University of Manchester
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/.
 *
 *
 * Alternatively, the contents of this file may be used under the terms of the Apache License, Version 2.0
 * in which case, the provisions of the Apache License Version 2.0 are applicable instead of those above.
 *
 * Copyright 2011, University of Manchester
 *
 * 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.
 */
package uk.ac.manchester.cs.owl.owlapi;

import static org.semanticweb.owlapi.model.AxiomType.*;
import static uk.ac.manchester.cs.owl.owlapi.InitVisitorFactory.*;

import java.io.Serializable;
import java.util.Map;

import org.semanticweb.owlapi.model.AxiomType;
import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom;
import org.semanticweb.owlapi.model.OWLAnnotationSubject;
import org.semanticweb.owlapi.model.OWLAsymmetricObjectPropertyAxiom;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLAxiomVisitorEx;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassAssertionAxiom;
import org.semanticweb.owlapi.model.OWLClassAxiom;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom;
import org.semanticweb.owlapi.model.OWLDataPropertyDomainAxiom;
import org.semanticweb.owlapi.model.OWLDataPropertyExpression;
import org.semanticweb.owlapi.model.OWLDataPropertyRangeAxiom;
import org.semanticweb.owlapi.model.OWLDifferentIndividualsAxiom;
import org.semanticweb.owlapi.model.OWLDisjointClassesAxiom;
import org.semanticweb.owlapi.model.OWLDisjointDataPropertiesAxiom;
import org.semanticweb.owlapi.model.OWLDisjointObjectPropertiesAxiom;
import org.semanticweb.owlapi.model.OWLDisjointUnionAxiom;
import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom;
import org.semanticweb.owlapi.model.OWLEquivalentDataPropertiesAxiom;
import org.semanticweb.owlapi.model.OWLEquivalentObjectPropertiesAxiom;
import org.semanticweb.owlapi.model.OWLFunctionalDataPropertyAxiom;
import org.semanticweb.owlapi.model.OWLFunctionalObjectPropertyAxiom;
import org.semanticweb.owlapi.model.OWLHasKeyAxiom;
import org.semanticweb.owlapi.model.OWLIndividual;
import org.semanticweb.owlapi.model.OWLInverseFunctionalObjectPropertyAxiom;
import org.semanticweb.owlapi.model.OWLInverseObjectPropertiesAxiom;
import org.semanticweb.owlapi.model.OWLIrreflexiveObjectPropertyAxiom;
import org.semanticweb.owlapi.model.OWLNegativeDataPropertyAssertionAxiom;
import org.semanticweb.owlapi.model.OWLNegativeObjectPropertyAssertionAxiom;
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom;
import org.semanticweb.owlapi.model.OWLObjectPropertyDomainAxiom;
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression;
import org.semanticweb.owlapi.model.OWLObjectPropertyRangeAxiom;
import org.semanticweb.owlapi.model.OWLReflexiveObjectPropertyAxiom;
import org.semanticweb.owlapi.model.OWLSameIndividualAxiom;
import org.semanticweb.owlapi.model.OWLSubClassOfAxiom;
import org.semanticweb.owlapi.model.OWLSubDataPropertyOfAxiom;
import org.semanticweb.owlapi.model.OWLSubObjectPropertyOfAxiom;
import org.semanticweb.owlapi.model.OWLSymmetricObjectPropertyAxiom;
import org.semanticweb.owlapi.model.OWLTransitiveObjectPropertyAxiom;
import org.semanticweb.owlapi.util.CollectionFactory;

/** this class encapsulates all lazily built indexes */
public abstract class AbstractInternalsImpl implements Internals, Serializable {

    private static final long serialVersionUID = 30406L;

    protected  MapPointer build(AxiomType t,
            OWLAxiomVisitorEx v) {
        return new MapPointer(t, v, true, this);
    }

    protected  MapPointer build() {
        return build(null, null);
    }

    protected  MapPointer buildLazy(AxiomType t,
            OWLAxiomVisitorEx v) {
        return new MapPointer(t, v, false, this);
    }

    protected ClassAxiomByClassPointer buildClassAxiomByClass() {
        return new ClassAxiomByClassPointer(null, null, false, this);
    }


    protected final MapPointer classAxiomsByClass = buildClassAxiomByClass();



    protected final MapPointer subClassAxiomsByLHS = buildLazy(
            SUBCLASS_OF, classsubnamed);
    protected final MapPointer subClassAxiomsByRHS = buildLazy(
            SUBCLASS_OF, classsupernamed);
    protected final MapPointer equivalentClassesAxiomsByClass = buildLazy(
            EQUIVALENT_CLASSES, classcollections);
    protected final MapPointer disjointClassesAxiomsByClass = buildLazy(
            DISJOINT_CLASSES, classcollections);
    protected final MapPointer disjointUnionAxiomsByClass = buildLazy(
            DISJOINT_UNION, classcollections);
    protected final MapPointer hasKeyAxiomsByClass = buildLazy(
            HAS_KEY, classsupernamed);
    protected final MapPointer objectSubPropertyAxiomsByLHS = buildLazy(
            SUB_OBJECT_PROPERTY, opsubnamed);
    protected final MapPointer objectSubPropertyAxiomsByRHS = buildLazy(
            SUB_OBJECT_PROPERTY, opsupernamed);
    protected final MapPointer equivalentObjectPropertyAxiomsByProperty = buildLazy(
            EQUIVALENT_OBJECT_PROPERTIES, opcollections);
    protected final MapPointer disjointObjectPropertyAxiomsByProperty = buildLazy(
            DISJOINT_OBJECT_PROPERTIES, opcollections);
    protected final MapPointer objectPropertyDomainAxiomsByProperty = buildLazy(
            OBJECT_PROPERTY_DOMAIN, opsubnamed);
    protected final MapPointer objectPropertyRangeAxiomsByProperty = buildLazy(
            OBJECT_PROPERTY_RANGE, opsubnamed);
    protected final MapPointer functionalObjectPropertyAxiomsByProperty = buildLazy(
            FUNCTIONAL_OBJECT_PROPERTY, opsubnamed);
    protected final MapPointer inverseFunctionalPropertyAxiomsByProperty = buildLazy(
            INVERSE_FUNCTIONAL_OBJECT_PROPERTY, opsubnamed);
    protected final MapPointer symmetricPropertyAxiomsByProperty = buildLazy(
            SYMMETRIC_OBJECT_PROPERTY, opsubnamed);
    protected final MapPointer asymmetricPropertyAxiomsByProperty = buildLazy(
            ASYMMETRIC_OBJECT_PROPERTY, opsubnamed);
    protected final MapPointer reflexivePropertyAxiomsByProperty = buildLazy(
            REFLEXIVE_OBJECT_PROPERTY, opsubnamed);
    protected final MapPointer irreflexivePropertyAxiomsByProperty = buildLazy(
            IRREFLEXIVE_OBJECT_PROPERTY, opsubnamed);
    protected final MapPointer transitivePropertyAxiomsByProperty = buildLazy(
            TRANSITIVE_OBJECT_PROPERTY, opsubnamed);
    protected final MapPointer inversePropertyAxiomsByProperty = buildLazy(
            INVERSE_OBJECT_PROPERTIES, opcollections);
    protected final MapPointer dataSubPropertyAxiomsByLHS = buildLazy(
            SUB_DATA_PROPERTY, dpsubnamed);
    protected final MapPointer dataSubPropertyAxiomsByRHS = buildLazy(
            SUB_DATA_PROPERTY, dpsupernamed);
    protected final MapPointer equivalentDataPropertyAxiomsByProperty = buildLazy(
            EQUIVALENT_DATA_PROPERTIES, dpcollections);
    protected final MapPointer disjointDataPropertyAxiomsByProperty = buildLazy(
            DISJOINT_DATA_PROPERTIES, dpcollections);
    protected final MapPointer dataPropertyDomainAxiomsByProperty = buildLazy(
            DATA_PROPERTY_DOMAIN, dpsubnamed);
    protected final MapPointer dataPropertyRangeAxiomsByProperty = buildLazy(
            DATA_PROPERTY_RANGE, dpsubnamed);
    protected final MapPointer functionalDataPropertyAxiomsByProperty = buildLazy(
            FUNCTIONAL_DATA_PROPERTY, dpsubnamed);
    protected final MapPointer classAssertionAxiomsByIndividual = buildLazy(
            CLASS_ASSERTION, individualsubnamed);
    protected final MapPointer classAssertionAxiomsByClass = buildLazy(
            CLASS_ASSERTION, classexpressions);
    protected final MapPointer objectPropertyAssertionsByIndividual = buildLazy(
            OBJECT_PROPERTY_ASSERTION, individualsubnamed);
    protected final MapPointer dataPropertyAssertionsByIndividual = buildLazy(
            DATA_PROPERTY_ASSERTION, individualsubnamed);
    protected final MapPointer negativeObjectPropertyAssertionAxiomsByIndividual = buildLazy(
            NEGATIVE_OBJECT_PROPERTY_ASSERTION, individualsubnamed);
    protected final MapPointer negativeDataPropertyAssertionAxiomsByIndividual = buildLazy(
            NEGATIVE_DATA_PROPERTY_ASSERTION, individualsubnamed);
    protected final MapPointer differentIndividualsAxiomsByIndividual = buildLazy(
            DIFFERENT_INDIVIDUALS, icollections);
    protected final MapPointer sameIndividualsAxiomsByIndividual = buildLazy(
            SAME_INDIVIDUAL, icollections);
    protected final MapPointer annotationAssertionAxiomsBySubject = buildLazy(
            ANNOTATION_ASSERTION, annotsupernamed);

    protected  Map createMap() {
        return CollectionFactory.createMap();
    }

    @Override
    public MapPointer getClassAxiomsByClass() {
        return classAxiomsByClass;
    }

    @Override
    public MapPointer getSubClassAxiomsByLHS() {
        return subClassAxiomsByLHS;
    }

    @Override
    public MapPointer getSubClassAxiomsByRHS() {
        return subClassAxiomsByRHS;
    }

    @Override
    public MapPointer getEquivalentClassesAxiomsByClass() {
        return equivalentClassesAxiomsByClass;
    }

    @Override
    public MapPointer getDisjointClassesAxiomsByClass() {
        return disjointClassesAxiomsByClass;
    }

    @Override
    public MapPointer getDisjointUnionAxiomsByClass() {
        return disjointUnionAxiomsByClass;
    }

    @Override
    public MapPointer getHasKeyAxiomsByClass() {
        return hasKeyAxiomsByClass;
    }

    @Override
    public MapPointer getObjectSubPropertyAxiomsByLHS() {
        return objectSubPropertyAxiomsByLHS;
    }

    @Override
    public MapPointer getObjectSubPropertyAxiomsByRHS() {
        return objectSubPropertyAxiomsByRHS;
    }

    @Override
    public MapPointer getEquivalentObjectPropertyAxiomsByProperty() {
        return equivalentObjectPropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getDisjointObjectPropertyAxiomsByProperty() {
        return disjointObjectPropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getObjectPropertyDomainAxiomsByProperty() {
        return objectPropertyDomainAxiomsByProperty;
    }

    @Override
    public MapPointer getObjectPropertyRangeAxiomsByProperty() {
        return objectPropertyRangeAxiomsByProperty;
    }

    @Override
    public MapPointer getFunctionalObjectPropertyAxiomsByProperty() {
        return functionalObjectPropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getInverseFunctionalPropertyAxiomsByProperty() {
        return inverseFunctionalPropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getSymmetricPropertyAxiomsByProperty() {
        return symmetricPropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getAsymmetricPropertyAxiomsByProperty() {
        return asymmetricPropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getReflexivePropertyAxiomsByProperty() {
        return reflexivePropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getIrreflexivePropertyAxiomsByProperty() {
        return irreflexivePropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getTransitivePropertyAxiomsByProperty() {
        return transitivePropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getInversePropertyAxiomsByProperty() {
        return inversePropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getDataSubPropertyAxiomsByLHS() {
        return dataSubPropertyAxiomsByLHS;
    }

    @Override
    public MapPointer getDataSubPropertyAxiomsByRHS() {
        return dataSubPropertyAxiomsByRHS;
    }

    @Override
    public MapPointer getEquivalentDataPropertyAxiomsByProperty() {
        return equivalentDataPropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getDisjointDataPropertyAxiomsByProperty() {
        return disjointDataPropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getDataPropertyDomainAxiomsByProperty() {
        return dataPropertyDomainAxiomsByProperty;
    }

    @Override
    public MapPointer getDataPropertyRangeAxiomsByProperty() {
        return dataPropertyRangeAxiomsByProperty;
    }

    @Override
    public MapPointer getFunctionalDataPropertyAxiomsByProperty() {
        return functionalDataPropertyAxiomsByProperty;
    }

    @Override
    public MapPointer getClassAssertionAxiomsByIndividual() {
        return classAssertionAxiomsByIndividual;
    }

    @Override
    public MapPointer getClassAssertionAxiomsByClass() {
        return classAssertionAxiomsByClass;
    }

    @Override
    public MapPointer getObjectPropertyAssertionsByIndividual() {
        return objectPropertyAssertionsByIndividual;
    }

    @Override
    public MapPointer getDataPropertyAssertionsByIndividual() {
        return dataPropertyAssertionsByIndividual;
    }

    @Override
    public MapPointer getNegativeObjectPropertyAssertionAxiomsByIndividual() {
        return negativeObjectPropertyAssertionAxiomsByIndividual;
    }

    @Override
    public MapPointer getNegativeDataPropertyAssertionAxiomsByIndividual() {
        return negativeDataPropertyAssertionAxiomsByIndividual;
    }

    @Override
    public MapPointer getDifferentIndividualsAxiomsByIndividual() {
        return differentIndividualsAxiomsByIndividual;
    }

    @Override
    public MapPointer getSameIndividualsAxiomsByIndividual() {
        return sameIndividualsAxiomsByIndividual;
    }

    @Override
    public MapPointer getAnnotationAssertionAxiomsBySubject() {
        return annotationAssertionAxiomsBySubject;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy