/* * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. * * This file is part of the reasoning system Konclude. * For details and support, see . * * Konclude is free software: you can redistribute it and/or modify * it under the terms of version 3 of the GNU Lesser General Public * License (LGPLv3) as published by the Free Software Foundation. * * Konclude 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 Konclude. If not, see . * */ #include "COntologyBuildData.h" namespace Konclude { namespace Reasoner { namespace Ontology { COntologyBuildData::COntologyBuildData(COntologyContext* ontoContext) : mExpressionCounter(ontoContext) { mOntoContext = ontoContext; CMemoryAllocationManager* memAllocMan = CContext::getMemoryAllocationManager(mOntoContext); mTellAxiomSet = CObjectParameterizingAllocator< CONTOLOGYAXIOMSET,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mRetractAxiomSet = CObjectParameterizingAllocator< CONTOLOGYAXIOMSET,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mTellUpdatedAxiomSet = CObjectParameterizingAllocator< CONTOLOGYAXIOMSET,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mRetractUpdatedAxiomSet = CObjectParameterizingAllocator< CONTOLOGYAXIOMSET,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mChangeAxiomList = CObjectParameterizingAllocator< CONTOLOGYAXIOMLIST< QPair >,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mChangeUpdatedAxiomList = CObjectParameterizingAllocator< CONTOLOGYAXIOMLIST< QPair >,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mDeclarationAxiomSet = CObjectParameterizingAllocator< CBUILDSET,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mTopClassExpression = nullptr; mBottomClassExpression = nullptr; mTopDataRangeExpression = nullptr; mBottomDataRangeExpression = nullptr; mTopObjPropExpression = nullptr; mBottomObjPropExpression = nullptr; mTopDataPropExpression = nullptr; mBottomDataPropExpression = nullptr; mExpressionBuildHash = CObjectParameterizingAllocator< CBUILDHASH,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mClassBuildHash = CObjectParameterizingAllocator< CBUILDHASH,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mObjectPropertyBuildHash = CObjectParameterizingAllocator< CBUILDHASH,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mIndividualBuildHash = CObjectParameterizingAllocator< CBUILDHASH,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mAnoIndividualBuildHash = CObjectParameterizingAllocator< CBUILDHASH,CAnonymousIndividualExpression*>,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mDatatypeIRIDatatypeBuildHash = CObjectParameterizingAllocator< CBUILDHASH,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mDataPropertyBuildHash = CObjectParameterizingAllocator< CBUILDHASH,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mDataLexicalValueBuildHash = CObjectParameterizingAllocator< CBUILDHASH,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mFacetIRIFacetBuildHash = CObjectParameterizingAllocator< CBUILDHASH,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mExpressionBuildListContainer = CObjectParameterizingAllocator< CBUILDLIST,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mInverseObjectPropertyHash = CObjectParameterizingAllocator< CBUILDHASH,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mInverseObjectPropertyList = CObjectParameterizingAllocator< CBUILDLIST< QPair >,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mIndividualVariableIDHash = CObjectParameterizingAllocator< CBUILDHASH,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mNominalIndividualVariableBuildHash = CObjectParameterizingAllocator< CBUILDHASH,CObjectIndividualVariableExpression*>,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildConceptSet = CObjectParameterizingAllocator< CBUILDSET,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildObjectRoleSet = CObjectParameterizingAllocator< CBUILDSET,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildIndividualSet = CObjectParameterizingAllocator< CBUILDSET,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildDataRoleSet = CObjectParameterizingAllocator< CBUILDSET,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildDatatypeSet = CObjectParameterizingAllocator< CBUILDSET,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildDataRangesSet = CObjectParameterizingAllocator< CBUILDSET,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildConceptList = CObjectParameterizingAllocator< CBUILDLIST,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildObjectRoleList = CObjectParameterizingAllocator< CBUILDLIST,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildIndividualList = CObjectParameterizingAllocator< CBUILDLIST,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildDataRoleList = CObjectParameterizingAllocator< CBUILDLIST,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildDatatypeList = CObjectParameterizingAllocator< CBUILDLIST,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mBuildDataRangesList = CObjectParameterizingAllocator< CBUILDLIST,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mImportDataHash = CObjectParameterizingAllocator< CBUILDHASH,CContext* >::allocateAndConstructAndParameterize(memAllocMan,mOntoContext); mNamedIndividualVariableBuildHash = CObjectParameterizingAllocator< CBUILDHASH, CContext* >::allocateAndConstructAndParameterize(memAllocMan, mOntoContext); mAnonymousIndividualVariableBuildHash = CObjectParameterizingAllocator< CBUILDHASH, CContext* >::allocateAndConstructAndParameterize(memAllocMan, mOntoContext); mClassVariableBuildHash = CObjectParameterizingAllocator< CBUILDHASH, CContext* >::allocateAndConstructAndParameterize(memAllocMan, mOntoContext); mObjectPropertyVariableBuildHash = CObjectParameterizingAllocator< CBUILDHASH, CContext* >::allocateAndConstructAndParameterize(memAllocMan, mOntoContext); mDataPropertyVariableBuildHash = CObjectParameterizingAllocator< CBUILDHASH, CContext* >::allocateAndConstructAndParameterize(memAllocMan, mOntoContext); mDataValueVariableBuildHash = CObjectParameterizingAllocator< CBUILDHASH, CContext* >::allocateAndConstructAndParameterize(memAllocMan, mOntoContext); mDataLiteralVariableBuildHash = CObjectParameterizingAllocator< CBUILDHASH, CContext* >::allocateAndConstructAndParameterize(memAllocMan, mOntoContext); mAxiomNumber = 0; mEntityNumber = 0; } COntologyBuildData::~COntologyBuildData() { CMemoryAllocationManager* memAllocMan = CContext::getMemoryAllocationManager(mOntoContext); // TODO: delete all //cDeleteAll(*mExpressionBuildListContainer); COPADestroyAndRelease(mTellAxiomSet,memAllocMan); COPADestroyAndRelease(mRetractAxiomSet,memAllocMan); COPADestroyAndRelease(mTellUpdatedAxiomSet,memAllocMan); COPADestroyAndRelease(mRetractUpdatedAxiomSet,memAllocMan); COPADestroyAndRelease(mChangeAxiomList,memAllocMan); COPADestroyAndRelease(mChangeUpdatedAxiomList,memAllocMan); COPADestroyAndRelease(mDeclarationAxiomSet,memAllocMan); COPADestroyAndRelease(mExpressionBuildHash,memAllocMan); COPADestroyAndRelease(mClassBuildHash,memAllocMan); COPADestroyAndRelease(mObjectPropertyBuildHash,memAllocMan); COPADestroyAndRelease(mIndividualBuildHash,memAllocMan); COPADestroyAndRelease(mAnoIndividualBuildHash,memAllocMan); COPADestroyAndRelease(mDatatypeIRIDatatypeBuildHash,memAllocMan); COPADestroyAndRelease(mExpressionBuildListContainer,memAllocMan); COPADestroyAndRelease(mDataPropertyBuildHash,memAllocMan); COPADestroyAndRelease(mDataLexicalValueBuildHash,memAllocMan); COPADestroyAndRelease(mFacetIRIFacetBuildHash,memAllocMan); COPADestroyAndRelease(mInverseObjectPropertyHash,memAllocMan); COPADestroyAndRelease(mInverseObjectPropertyList,memAllocMan); COPADestroyAndRelease(mIndividualVariableIDHash,memAllocMan); COPADestroyAndRelease(mNominalIndividualVariableBuildHash, memAllocMan); COPADestroyAndRelease(mNamedIndividualVariableBuildHash, memAllocMan); COPADestroyAndRelease(mAnonymousIndividualVariableBuildHash, memAllocMan); COPADestroyAndRelease(mClassVariableBuildHash, memAllocMan); COPADestroyAndRelease(mObjectPropertyVariableBuildHash, memAllocMan); COPADestroyAndRelease(mDataPropertyVariableBuildHash, memAllocMan); COPADestroyAndRelease(mBuildConceptSet,memAllocMan); COPADestroyAndRelease(mBuildObjectRoleSet,memAllocMan); COPADestroyAndRelease(mBuildIndividualSet,memAllocMan); COPADestroyAndRelease(mBuildDataRoleSet,memAllocMan); COPADestroyAndRelease(mBuildDatatypeSet,memAllocMan); COPADestroyAndRelease(mBuildDataRangesSet,memAllocMan); COPADestroyAndRelease(mDataValueVariableBuildHash, memAllocMan); COPADestroyAndRelease(mDataLiteralVariableBuildHash, memAllocMan); COPADestroyAndRelease(mBuildConceptList,memAllocMan); COPADestroyAndRelease(mBuildObjectRoleList,memAllocMan); COPADestroyAndRelease(mBuildDataRoleList,memAllocMan); COPADestroyAndRelease(mBuildIndividualList,memAllocMan); COPADestroyAndRelease(mBuildDatatypeList,memAllocMan); COPADestroyAndRelease(mBuildDataRangesList,memAllocMan); COPADestroyAndRelease(mImportDataHash,memAllocMan); } COntologyBuildData* COntologyBuildData::referenceBuildData(COntologyBuildData* buildData) { *mTellAxiomSet = *buildData->mTellAxiomSet; *mRetractAxiomSet = *buildData->mRetractAxiomSet; mTellUpdatedAxiomSet->clear(); mRetractUpdatedAxiomSet->clear(); *mChangeAxiomList = *buildData->mChangeAxiomList; mChangeUpdatedAxiomList->clear(); //*mTellUpdatedAxiomSet = *buildData->mTellUpdatedAxiomSet; //*mRetractUpdatedAxiomSet = *buildData->mRetractUpdatedAxiomSet; *mDeclarationAxiomSet = *buildData->mDeclarationAxiomSet; mTopClassExpression = buildData->mTopClassExpression; mBottomClassExpression = buildData->mBottomClassExpression; mTopDataRangeExpression = buildData->mTopDataRangeExpression; mBottomDataRangeExpression = buildData->mBottomDataRangeExpression; mTopObjPropExpression = buildData->mTopObjPropExpression; mBottomObjPropExpression = buildData->mBottomObjPropExpression; mTopDataPropExpression = buildData->mTopDataPropExpression; mBottomDataPropExpression = buildData->mBottomDataPropExpression; *mExpressionBuildHash = *buildData->mExpressionBuildHash; *mClassBuildHash = *buildData->mClassBuildHash; *mObjectPropertyBuildHash = *buildData->mObjectPropertyBuildHash; *mIndividualBuildHash = *buildData->mIndividualBuildHash; *mAnoIndividualBuildHash = *buildData->mAnoIndividualBuildHash; *mDatatypeIRIDatatypeBuildHash = *buildData->mDatatypeIRIDatatypeBuildHash; *mDataPropertyBuildHash = *buildData->mDataPropertyBuildHash; *mDataLexicalValueBuildHash = *buildData->mDataLexicalValueBuildHash; *mFacetIRIFacetBuildHash = *buildData->mFacetIRIFacetBuildHash; *mExpressionBuildListContainer = *buildData->mExpressionBuildListContainer; *mInverseObjectPropertyHash = *buildData->mInverseObjectPropertyHash; *mInverseObjectPropertyList = *buildData->mInverseObjectPropertyList; *mIndividualVariableIDHash = *buildData->mIndividualVariableIDHash; *mNominalIndividualVariableBuildHash = *buildData->mNominalIndividualVariableBuildHash; *mNamedIndividualVariableBuildHash = *buildData->mNamedIndividualVariableBuildHash; *mAnonymousIndividualVariableBuildHash = *buildData->mAnonymousIndividualVariableBuildHash; *mDataValueVariableBuildHash = *buildData->mDataValueVariableBuildHash; *mDataLiteralVariableBuildHash = *buildData->mDataLiteralVariableBuildHash; *mClassVariableBuildHash = *buildData->mClassVariableBuildHash; *mObjectPropertyVariableBuildHash = *buildData->mObjectPropertyVariableBuildHash; *mDataPropertyVariableBuildHash = *buildData->mDataPropertyVariableBuildHash; *mBuildIndividualList = *buildData->mBuildIndividualList; *mBuildConceptList = *buildData->mBuildConceptList; *mBuildObjectRoleList = *buildData->mBuildObjectRoleList; *mBuildDataRoleList = *buildData->mBuildDataRoleList; *mBuildDatatypeList = *buildData->mBuildDatatypeList; *mBuildDataRangesList = *buildData->mBuildDataRangesList; *mImportDataHash = *buildData->mImportDataHash; mAxiomNumber = buildData->mAxiomNumber; mEntityNumber = buildData->mEntityNumber; mExpressionCounter.referenceBuildExpressionCounter(&buildData->mExpressionCounter); return this; } CBUILDHASH* COntologyBuildData::getImportDataHash() { return mImportDataHash; } CONTOLOGYAXIOMSET* COntologyBuildData::getTellAxiomSet() { return mTellAxiomSet; } CONTOLOGYAXIOMSET* COntologyBuildData::getRetractAxiomSet() { return mRetractAxiomSet; } CONTOLOGYAXIOMSET* COntologyBuildData::getUpdatedTellAxiomSet() { return mTellUpdatedAxiomSet; } CONTOLOGYAXIOMSET* COntologyBuildData::getUpdatedRetractAxiomSet() { return mRetractUpdatedAxiomSet; } CONTOLOGYAXIOMLIST< QPair >* COntologyBuildData::getChangeAxiomList() { return mChangeAxiomList; } CONTOLOGYAXIOMLIST< QPair >* COntologyBuildData::getUpdatedChangeAxiomList() { return mChangeUpdatedAxiomList; } CBUILDSET* COntologyBuildData::getDeclarationAxiomSet() { return mDeclarationAxiomSet; } CClassTermExpression* COntologyBuildData::getTopClassExpression() { return mTopClassExpression; } CClassTermExpression* COntologyBuildData::getBottomClassExpression() { return mBottomClassExpression; } CDataRangeTermExpression* COntologyBuildData::getTopDataRangeExpression() { return mTopDataRangeExpression; } CDataRangeTermExpression* COntologyBuildData::getBottomDataRangeExpression() { return mBottomDataRangeExpression; } CObjectPropertyTermExpression* COntologyBuildData::getTopObjectPropertyExpression() { return mTopObjPropExpression; } CObjectPropertyTermExpression* COntologyBuildData::getBottomObjectPropertyExpression() { return mBottomObjPropExpression; } CDataPropertyTermExpression* COntologyBuildData::getTopDataPropertyExpression() { return mTopDataPropExpression; } CDataPropertyTermExpression* COntologyBuildData::getBottomDataPropertyExpression() { return mBottomDataPropExpression; } COntologyBuildData* COntologyBuildData::setTopClassExpression(CClassTermExpression* topClassExp) { mTopClassExpression = topClassExp; return this; } COntologyBuildData* COntologyBuildData::setBottomClassExpression(CClassTermExpression* bottomClassExp) { mBottomClassExpression = bottomClassExp; return this; } COntologyBuildData* COntologyBuildData::setTopDataRangeExpression(CDataRangeTermExpression* dataRangeExp) { mTopDataRangeExpression = dataRangeExp; return this; } COntologyBuildData* COntologyBuildData::setBottomDataRangeExpression(CDataRangeTermExpression* dataRangeExp) { mBottomDataRangeExpression = dataRangeExp; return this; } COntologyBuildData* COntologyBuildData::setTopObjectPropertyExpression(CObjectPropertyTermExpression* topObjectPropertyExp) { mTopObjPropExpression = topObjectPropertyExp; return this; } COntologyBuildData* COntologyBuildData::setBottomObjectPropertyExpression(CObjectPropertyTermExpression* bottomObjectPropertyExp) { mBottomObjPropExpression = bottomObjectPropertyExp; return this; } COntologyBuildData* COntologyBuildData::setTopDataPropertyExpression(CDataPropertyTermExpression* dataPropertyExp) { mTopDataPropExpression = dataPropertyExp; return this; } COntologyBuildData* COntologyBuildData::setBottomDataPropertyExpression(CDataPropertyTermExpression* dataPropertyExp) { mBottomDataPropExpression = dataPropertyExp; return this; } CBUILDHASH* COntologyBuildData::getStructuralExpressionBuildHash() { return mExpressionBuildHash; } CBUILDHASH* COntologyBuildData::getClassEntityBuildHash() { return mClassBuildHash; } CBUILDHASH* COntologyBuildData::getObjectPropertyEntityBuildHash() { return mObjectPropertyBuildHash; } CBUILDHASH* COntologyBuildData::getDataPropertyEntityBuildHash() { return mDataPropertyBuildHash; } CBUILDHASH* COntologyBuildData::getDataLexicalValueBuildHash() { return mDataLexicalValueBuildHash; } CBUILDHASH* COntologyBuildData::getIndividualEntityBuildHash() { return mIndividualBuildHash; } CBUILDHASH,CAnonymousIndividualExpression*>* COntologyBuildData::getAnonymousIndividualBuildHash() { return mAnoIndividualBuildHash; } CBUILDHASH* COntologyBuildData::getDatatypeIRIBuildHash() { return mDatatypeIRIDatatypeBuildHash; } CBUILDHASH* COntologyBuildData::getFacetIRIBuildHash() { return mFacetIRIFacetBuildHash; } CBUILDLIST* COntologyBuildData::getExpressionBuildListContainer() { return mExpressionBuildListContainer; } CBUILDHASH* COntologyBuildData::getInverseObjectPropertyHash() { return mInverseObjectPropertyHash; } CBUILDLIST< QPair >* COntologyBuildData::getInverseObjectPropertyList() { return mInverseObjectPropertyList; } CBUILDHASH* COntologyBuildData::getIndividualVariableIDHash() { return mIndividualVariableIDHash; } CBUILDHASH,CObjectIndividualVariableExpression*>* COntologyBuildData::getNominalIndividualVariableBuildHash() { return mNominalIndividualVariableBuildHash; } CBUILDHASH* COntologyBuildData::getNamedIndividualVariableBuildHash() { return mNamedIndividualVariableBuildHash; } CBUILDHASH* COntologyBuildData::getDataValueVariableBuildHash() { return mDataValueVariableBuildHash; } CBUILDHASH* COntologyBuildData::getDataLiteralVariableBuildHash() { return mDataLiteralVariableBuildHash; } CBUILDHASH* COntologyBuildData::getAnonymousIndividualVariableBuildHash() { return mAnonymousIndividualVariableBuildHash; } CBUILDHASH* COntologyBuildData::getClassVariableBuildHash() { return mClassVariableBuildHash; } CBUILDHASH* COntologyBuildData::getObjectPropertyVariableBuildHash() { return mObjectPropertyVariableBuildHash; } CBUILDHASH* COntologyBuildData::getDataPropertyVariableBuildHash() { return mDataPropertyVariableBuildHash; } CBUILDSET* COntologyBuildData::getBuildConceptSet() { return mBuildConceptSet; } CBUILDSET* COntologyBuildData::getBuildObjectRoleSet() { return mBuildObjectRoleSet; } CBUILDSET* COntologyBuildData::getBuildDataRoleSet() { return mBuildDataRoleSet; } CBUILDSET* COntologyBuildData::getBuildDataRangeSet() { return mBuildDataRangesSet; } CBUILDSET* COntologyBuildData::getBuildDatatypeSet() { return mBuildDatatypeSet; } CBUILDSET* COntologyBuildData::getBuildIndividualSet() { return mBuildIndividualSet; } CBUILDLIST* COntologyBuildData::getBuildConceptList() { return mBuildConceptList; } CBUILDLIST* COntologyBuildData::getBuildObjectRoleList() { return mBuildObjectRoleList; } CBUILDLIST* COntologyBuildData::getBuildDataRoleList() { return mBuildDataRoleList; } CBUILDLIST* COntologyBuildData::getBuildIndividualList() { return mBuildIndividualList; } CBUILDLIST* COntologyBuildData::getBuildDataRangeList() { return mBuildDataRangesList; } CBUILDLIST* COntologyBuildData::getBuildDatatypeList() { return mBuildDatatypeList; } cint64 COntologyBuildData::getNextAxiomNumber(bool moveNext) { cint64 nextNumber = mAxiomNumber; if (moveNext) { ++mAxiomNumber; } return nextNumber; } COntologyBuildData* COntologyBuildData::setNextAxiomNumber(cint64 axiomNumber) { mAxiomNumber = axiomNumber; return this; } cint64 COntologyBuildData::getNextEntityNumber(bool moveNext) { cint64 nextNumber = mEntityNumber; if (moveNext) { ++mEntityNumber; } return nextNumber; } COntologyBuildData* COntologyBuildData::setNextEntityNumber(cint64 entityNumber) { mEntityNumber = entityNumber; return this; } COntologyBuildExpressionCounter* COntologyBuildData::getBuildExpressionCounter() { return &mExpressionCounter; } }; // end namespace Ontology }; // end namespace Reasoner }; // end namespace Konclude