/* * 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 "CConceptCycleData.h" namespace Konclude { namespace Reasoner { namespace Ontology { CConceptCycleData::CConceptCycleData(CContext* context) : mContext(context),mCycleConceptSet(context) { } cint64 CConceptCycleData::getCycleID() { return mCycleID; } CConceptCycleData* CConceptCycleData::setCycleID(cint64 cycleID) { mCycleID = cycleID; return this; } CConceptCycleData* CConceptCycleData::initConceptCycleData(CConceptCycleData* prevData) { if (prevData) { mCycleID = prevData->mCycleID; mCycleConceptSet = prevData->mCycleConceptSet; mRepCycleClass = prevData->mRepCycleClass; mNominalConnection = prevData->mNominalConnection; } else { mCycleID = 0; mCycleConceptSet.clear(); mRepCycleClass = nullptr; mNominalConnection = false; } return this; } cint64 CConceptCycleData::getConceptCount() { return mCycleConceptSet.count(); } CBOXSET* CConceptCycleData::getCycleConceptSet() { return &mCycleConceptSet; } CConceptCycleData* CConceptCycleData::addCycleConcept(CConcept* concept, bool negation) { addCycleConcept(TConceptNegPair(concept,negation)); return this; } CConceptCycleData* CConceptCycleData::addCycleConcept(const TConceptNegPair& conNegPair) { mCycleConceptSet.insert(conNegPair); CConcept* concept = conNegPair.first; bool conNeg = conNegPair.second; if (!conNeg && concept->hasClassName()) { mCycleClassSet.insert(concept); if (!mRepCycleClass) { mRepCycleClass = concept; } } return this; } CConceptCycleData* CConceptCycleData::addCycleConcepts(const QSet& conNegPairSet) { for (QSet::const_iterator it = conNegPairSet.constBegin(), itEnd = conNegPairSet.constEnd(); it != itEnd; ++it) { addCycleConcept(*it); } return this; } CBOXSET* CConceptCycleData::getCycleClassSet() { return &mCycleClassSet; } CConcept* CConceptCycleData::getRepresentativeCycleClass() { return mRepCycleClass; } bool CConceptCycleData::hasNominalConnection() { return mNominalConnection; } CConceptCycleData* CConceptCycleData::setNominalConnection(bool nominalConnection) { mNominalConnection = nominalConnection; return this; } }; // end namespace Ontology }; // end namespace Reasoner }; // end namespace Konclude