// event handler pro validaci myší vytvořených linků jakožto povolených vztahů z UPMM
        private void diagram_LinkDrawn(object sender, DiagramEventArgs e)
        {
            Link link = (e.Part as Link);
            ActivityDiagramLinkData linkData = link.Data as ActivityDiagramLinkData;
            ActivityDiagramNodeData fromData = link.FromData as ActivityDiagramNodeData;
            ActivityDiagramNodeData toData   = link.ToData as ActivityDiagramNodeData;

            ChooseLinkCategory(fromData, toData, linkData);
            switch (linkData.Category)
            {
            case "Control Flow":
                CheckLink(fromData, toData, linkData);
                break;

            case "Object Flow":
                CheckLink(fromData, toData, linkData);
                break;

            case "Anchor":
                CheckLink(fromData, toData, linkData);
                break;

            default:
                (diagram.LinksSource as ObservableCollection <ActivityDiagramLinkData>).Remove(linkData);
                break;
            }
        }
 // metoda pro výběr typu hrany - anchor, object flow nebo control flow
 private void ChooseLinkCategory(ActivityDiagramNodeData fromData, ActivityDiagramNodeData toData, ActivityDiagramLinkData linkData)
 {
     if ((fromData.Category == Constants.UML_AD_OBJECT || toData.Category == Constants.UML_AD_OBJECT) && (fromData.Category != Constants.UML_AD_NOTE && toData.Category != Constants.UML_AD_NOTE))
     {
         linkData.Category = Constants.UML_AD_OBJECT_FLOW;
     }
     else if (fromData.Category == Constants.UML_AD_NOTE || toData.Category == Constants.UML_AD_NOTE)
     {
         linkData.Category = Constants.UML_AD_ANCHOR;
     }
     else
     {
         linkData.Category = Constants.UML_AD_CONTROL_FLOW;
     }
 }
        // metoda pro validaci hran jakožto povolených vztahů z UPMM - volá mapovací pravidla z UML4UPMM
        private void CheckLink(ActivityDiagramNodeData fromData, ActivityDiagramNodeData toData, ActivityDiagramLinkData linkData)
        {
            //pokud je na některé straně hrany jeden z uzlů těchto typů, tak se hrana automaticky povoluje, jedná se o podporu toku, která není mapovaná z UPMM
            if (fromData.Category == Constants.UML_AD_INITIAL_ACTIVITY || toData.Category == Constants.UML_AD_FINAL_ACTIVITY ||
                fromData.Category == Constants.UML_AD_DECISION || toData.Category == Constants.UML_AD_DECISION ||
                fromData.Category == Constants.UML_AD_DECISION_MERGE || toData.Category == Constants.UML_AD_DECISION_MERGE ||
                fromData.Category == Constants.UML_AD_FORK || toData.Category == Constants.UML_AD_FORK ||
                fromData.Category == Constants.UML_AD_JOIN || toData.Category == Constants.UML_AD_JOIN)
            {
                linkData.Color = Constants.VALID_COLOR;
                if (linkData.Guide == null || linkData.Guide == "")
                {
                    linkData.Guide = "[Guide]";
                }
                if ((diagram.LinksSource as ObservableCollection <ActivityDiagramLinkData>).Where(x => x.From == linkData.From && x.To == linkData.To).Count() == 0)
                {
                    (diagram.LinksSource as ObservableCollection <ActivityDiagramLinkData>).Add(linkData);
                }
            }
            // jinak zkontroluj vztah z UPMM
            else
            {
                // metoda CheeckADRelationShip může vracet dvě možnosti
                // 1. null - to znamená, že je ZAPNUTÁ validace a hrana není datově obsažena v profilu
                // 2. ekvivalentní namapovaný vztah z UPMM a barvu pro hranu podle toho, jestli je hrana v profilu nebo není
                string color        = Constants.VALID_COLOR;
                string relationship = uml4upmm.CheckADRelationship(fromData.IRI, toData.IRI, ActivityDiagramPage.IsValidatingWithModel, out color);

                // možnost 1
                if (relationship == null)
                {
                    (diagram.LinksSource as ObservableCollection <ActivityDiagramLinkData>).Remove(linkData);
                    return;
                }
                // možnost 2
                linkData.Guide = "<<" + relationship + ">>";
                linkData.Color = color;
                if ((diagram.LinksSource as ObservableCollection <ActivityDiagramLinkData>).Where(x => x.From == linkData.From && x.To == linkData.To).Count() > 1)
                {
                    (diagram.LinksSource as ObservableCollection <ActivityDiagramLinkData>).Remove(linkData);
                }
                else if ((diagram.LinksSource as ObservableCollection <ActivityDiagramLinkData>).Where(x => x.From == linkData.From && x.To == linkData.To).Count() == 0)
                {
                    (diagram.LinksSource as ObservableCollection <ActivityDiagramLinkData>).Add(linkData);
                }
            }
        }