/* * 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 . * */ #ifndef KONCLUDE_REASONER_TAXONOMY_CCONCEPTCLASSESPARENTCHILDPREDECESSORHIERARCHYNODE_CPP #define KONCLUDE_REASONER_TAXONOMY_CCONCEPTCLASSESPARENTCHILDPREDECESSORHIERARCHYNODE_CPP #include "CConceptClassesParentChildPredecessorHierarchyNode.h" namespace Konclude { namespace Reasoner { namespace Taxonomy { template CConceptClassesParentChildPredecessorHierarchyNode::CConceptClassesParentChildPredecessorHierarchyNode(CConcept* representiveConcept) : CParentChildPredecessorHierarchyNode(representiveConcept) { } template T* CConceptClassesParentChildPredecessorHierarchyNode::addEquivalentConcept(CConcept* concept) { CParentChildPredecessorHierarchyNode::addEquivalentElement(concept); return (T*)this; } template QList* CConceptClassesParentChildPredecessorHierarchyNode::getEquivalentConceptList() { return CParentChildPredecessorHierarchyNode::getEquivalentElementList(); } template CConcept* CConceptClassesParentChildPredecessorHierarchyNode::getOneEquivalentConcept() { return CParentChildPredecessorHierarchyNode::getOneEquivalentElement(0); } template qint64 CConceptClassesParentChildPredecessorHierarchyNode::getEquivalentConceptCount() { return CParentChildPredecessorHierarchyNode::getEquivalentElementCount(); } template QString CConceptClassesParentChildPredecessorHierarchyNode::getEquivalentConceptsNodeString() { QString string; QList* eqList = CParentChildPredecessorHierarchyNode::getEquivalentElementList(); for (typename QList::const_iterator it = eqList->constBegin(), itEnd = eqList->constEnd(); it != itEnd; ++it) { CConcept* con = *it; QString iriClassNameString = CIRIName::getRecentIRIName(con->getClassNameLinker()); if (!string.isEmpty()) { string += QString(" <=> %1").arg(iriClassNameString); } else { string = iriClassNameString; } } return string; } template QString CConceptClassesParentChildPredecessorHierarchyNode::getHierarchyConceptsNodeString(qint64 depth) { QString string(depth,'\t'); string += QString("< ") + CParentChildPredecessorHierarchyNode::getEquivalentConceptsNodeString() + QString(" >\n"); QSet* childNodeSet = CParentChildPredecessorHierarchyNode::getChildNodeSet(); for (typename QSet::const_iterator it = childNodeSet->constBegin(), itEnd = childNodeSet->constEnd(); it != itEnd; ++it) { CConceptClassesParentChildPredecessorHierarchyNode* childNode = *it; string += childNode->getHierarchyConceptsNodeString(depth+1); } string += QString(depth,'\t')+QString("\n"); return string; } template QStringList CConceptClassesParentChildPredecessorHierarchyNode::getEquivalentConceptStringList(bool preferAbbreviatedNames) { QStringList stringList; QList* eqList = CParentChildPredecessorHierarchyNode::getEquivalentElementList(); for (typename QList::const_iterator it = eqList->constBegin(), itEnd = eqList->constEnd(); it != itEnd; ++it) { CConcept* con = *it; QStringList iriClassNameStringList; if (preferAbbreviatedNames) { iriClassNameStringList = CAbbreviatedIRIName::getAbbreviatedPrefixWithAbbreviatedIRINames(con->getClassNameLinker()); } if (!preferAbbreviatedNames || iriClassNameStringList.isEmpty()) { iriClassNameStringList = CIRIName::getIRINames(con->getClassNameLinker()); } stringList< void CConceptClassesParentChildPredecessorHierarchyNode::generateNodeRelationStrings() { parentNodeStrings.clear(); foreach (CConceptClassesParentChildPredecessorHierarchyNode* node, getParentNodeList()) { parentNodeStrings<getEquivalentConceptsNodeString(); } childNodeStrings.clear(); foreach (CConceptClassesParentChildPredecessorHierarchyNode* node, getChildNodeList()) { childNodeStrings<getEquivalentConceptsNodeString(); } precNodeStrings.clear(); foreach (CConceptClassesParentChildPredecessorHierarchyNode* node, getPredecessorNodeList()) { precNodeStrings<getEquivalentConceptsNodeString(); } } #endif #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS template void CConceptClassesParentChildPredecessorHierarchyNode::generateNodeElementStrings() { nodeStrings.clear(); nodeStrings = getEquivalentConceptStringList(true); } #endif }; // end namespace Taxonomy }; // end namespace Reasoner }; // end namespace Konclude #endif // KONCLUDE_REASONER_TAXONOMY_CCONCEPTCLASSESPARENTCHILDPREDECESSORHIERARCHYNODE_CPP