/* * 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_CROLEPROPERTIESPARENTCHILDPREDECESSORHIERARCHYNODE_CPP #define KONCLUDE_REASONER_TAXONOMY_CROLEPROPERTIESPARENTCHILDPREDECESSORHIERARCHYNODE_CPP #include "CRolePropertiesParentChildPredecessorHierarchyNode.h" namespace Konclude { namespace Reasoner { namespace Taxonomy { template CRolePropertiesParentChildPredecessorHierarchyNode::CRolePropertiesParentChildPredecessorHierarchyNode(CRole* representiveRole) : CParentChildPredecessorHierarchyNode(representiveRole) { } template T* CRolePropertiesParentChildPredecessorHierarchyNode::addEquivalentRole(CRole* role) { CParentChildPredecessorHierarchyNode::addEquivalentElement(role); return (T*)this; } template QList* CRolePropertiesParentChildPredecessorHierarchyNode::getEquivalentRoleList() { return CParentChildPredecessorHierarchyNode::getEquivalentElementList(); } template CRole* CRolePropertiesParentChildPredecessorHierarchyNode::getOneEquivalentRole() { return CParentChildPredecessorHierarchyNode::getOneEquivalentElement(0); } template qint64 CRolePropertiesParentChildPredecessorHierarchyNode::getEquivalentRoleCount() { return CParentChildPredecessorHierarchyNode::getEquivalentElementCount(); } template QString CRolePropertiesParentChildPredecessorHierarchyNode::getEquivalentRoleNodeString() { QString string; QList* eqList = CParentChildPredecessorHierarchyNode::getEquivalentElementList(); for (typename QList::const_iterator it = eqList->constBegin(), itEnd = eqList->constEnd(); it != itEnd; ++it) { CRole* role = *it; QString iriPropertyNameString = CIRIName::getRecentIRIName(role->getPropertyNameLinker()); if (!string.isEmpty()) { string += QString(" <=> %1").arg(iriPropertyNameString); } else { string = iriPropertyNameString; } } return string; } template QString CRolePropertiesParentChildPredecessorHierarchyNode::getHierarchyRolesNodeString(qint64 depth) { QString string(depth,'\t'); string += QString("< ") + CParentChildPredecessorHierarchyNode::getEquivalentRoleNodeString() + QString(" >\n"); QSet* childNodeSet = CParentChildPredecessorHierarchyNode::getChildNodeSet(); for (typename QSet::const_iterator it = childNodeSet->constBegin(), itEnd = childNodeSet->constEnd(); it != itEnd; ++it) { CRolePropertiesParentChildPredecessorHierarchyNode* childNode = *it; string += childNode->getHierarchyRolesNodeString(depth+1); } string += QString(depth,'\t')+QString("\n"); return string; } template QStringList CRolePropertiesParentChildPredecessorHierarchyNode::getEquivalentRoleStringList(bool preferAbbreviatedNames) { QStringList stringList; QList* eqList = CParentChildPredecessorHierarchyNode::getEquivalentElementList(); for (typename QList::const_iterator it = eqList->constBegin(), itEnd = eqList->constEnd(); it != itEnd; ++it) { CRole* role = *it; QStringList iriClassNameStringList; if (preferAbbreviatedNames) { iriClassNameStringList = CAbbreviatedIRIName::getAbbreviatedPrefixWithAbbreviatedIRINames(role->getPropertyNameLinker()); } if (!preferAbbreviatedNames || iriClassNameStringList.isEmpty()) { iriClassNameStringList = CIRIName::getIRINames(role->getPropertyNameLinker()); } stringList< void CRolePropertiesParentChildPredecessorHierarchyNode::generateNodeRelationStrings() { parentNodeStrings.clear(); foreach (CRolePropertiesParentChildPredecessorHierarchyNode* node, getParentNodeList()) { parentNodeStrings<getEquivalentRoleNodeString(); } childNodeStrings.clear(); foreach (CRolePropertiesParentChildPredecessorHierarchyNode* node, getChildNodeList()) { childNodeStrings<getEquivalentRoleNodeString(); } precNodeStrings.clear(); foreach (CRolePropertiesParentChildPredecessorHierarchyNode* node, getPredecessorNodeList()) { precNodeStrings<getEquivalentRoleNodeString(); } } #endif #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS template void CRolePropertiesParentChildPredecessorHierarchyNode::generateNodeElementStrings() { nodeStrings.clear(); nodeStrings = getEquivalentRoleStringList(true); } #endif }; // end namespace Taxonomy }; // end namespace Reasoner }; // end namespace Konclude #endif // KONCLUDE_REASONER_TAXONOMY_CROLEPROPERTIESPARENTCHILDPREDECESSORHIERARCHYNODE_CPP