/* * 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 "CConceptDependence.h" namespace Konclude { namespace Reasoner { namespace Ontology { CConceptDependence::CConceptDependence() { conceptDepTag = 0; conceptDepsLinker = 0; roleDepsLinker = 0; indiDepsLinker = 0; } CConceptDependence::~CConceptDependence() { } CConceptDependence *CConceptDependence::init(qint64 conTag, CConceptDependence *conceptDep, CMemoryManager > *linkerMemMan) { conceptDepTag = conTag; conceptDepsLinker = 0; if (linkerMemMan) { CSortedNegLinker *linkIt = 0; if (conceptDep) { linkIt = conceptDep->conceptDepsLinker; } while (linkIt) { CSortedNegLinker *conLink = linkerMemMan->allocate(); conLink->init(linkIt->getData(),linkIt->isNegated()); addConceptDependenceLinker(conLink); linkIt = (CSortedNegLinker *)linkIt->getNext(); } linkIt = 0; if (conceptDep) { linkIt = conceptDep->roleDepsLinker; } while (linkIt) { CSortedNegLinker *roleLink = linkerMemMan->allocate(); roleLink->init(linkIt->getData(),linkIt->isNegated()); addRoleDependenceLinker(roleLink); linkIt = (CSortedNegLinker *)linkIt->getNext(); } linkIt = 0; if (conceptDep) { linkIt = conceptDep->indiDepsLinker; } while (linkIt) { CSortedNegLinker *indiLink = linkerMemMan->allocate(); indiLink->init(linkIt->getData(),linkIt->isNegated()); addIndividualDependenceLinker(indiLink); linkIt = (CSortedNegLinker *)linkIt->getNext(); } } return this; } CConceptDependence *CConceptDependence::init(CConcept *concept) { conceptDepTag = concept->getConceptTag(); conceptDepsLinker = 0; roleDepsLinker = 0; indiDepsLinker = 0; return this; } CConceptDependence *CConceptDependence::setConceptDependenceList(CSortedNegLinker *conceptList) { conceptDepsLinker = conceptList; return this; } CConceptDependence *CConceptDependence::addConceptDependenceLinker(CSortedNegLinker *conceptLinker) { if (conceptDepsLinker) { conceptDepsLinker = conceptDepsLinker->insertSortedNextSorted(conceptLinker); } else { conceptDepsLinker = conceptLinker; } return this; } CSortedNegLinker *CConceptDependence::getConceptDependenceList() { return conceptDepsLinker; } CConceptDependence *CConceptDependence::setRoleDependenceList(CSortedNegLinker *roleList) { roleDepsLinker = roleList; return this; } CConceptDependence *CConceptDependence::addRoleDependenceLinker(CSortedNegLinker *roleLinker) { if (roleDepsLinker) { roleDepsLinker = roleDepsLinker->insertSortedNextSorted(roleLinker); } else { roleDepsLinker = roleLinker; } return this; } CSortedNegLinker *CConceptDependence::getRoleDependenceList() { return roleDepsLinker; } qint64 CConceptDependence::getConceptDependenceTag() { return conceptDepTag; } CConceptDependence *CConceptDependence::getConceptDependenceTag(qint64 tag) { conceptDepTag = tag; return this; } CConceptDependence *CConceptDependence::setIndividualDependenceList(CSortedNegLinker *indiList) { indiDepsLinker = indiList; return this; } CConceptDependence *CConceptDependence::addIndividualDependenceLinker(CSortedNegLinker *indiLinker) { if (indiDepsLinker) { indiDepsLinker = indiDepsLinker->insertSortedNextSorted(indiLinker); } else { indiDepsLinker = indiLinker; } return this; } CSortedNegLinker *CConceptDependence::getIndividualDependenceList() { return indiDepsLinker; } }; // end namespace Ontology }; // end namespace Reasoner }; // end namespace Konclude