Beispiel #1
0
        static string GetLabel(Taxonomy.Concept concept, string labelRole)
        {
            Taxonomy.LabelCollection labels;

            // Try to find a English label with the given labelRole
            if (labelRole != null)
            {
                labels = concept.GetLabels(labelRole, null, "en");
                if (labels.Count > 0)
                {
                    return(labels.First().Text);
                }
            }

            // Try to find a standard English label
            labels = concept.GetLabels("http://www.xbrl.org/2003/role/label", null, "en");
            if (labels.Count > 0)
            {
                return(labels.First().Text);
            }

            // Fallback to any other label that is assigned to the concept
            labels = concept.Labels;
            if (labels.Count > 0)
            {
                return(labels.First().Text);
            }

            // If there are no labels, display the concept QName
            return(concept.QName.ToString());
        }
Beispiel #2
0
 static void DisplayTreeNode(Taxonomy.CalculationRelationshipNetwork network, Taxonomy.Concept concept, decimal?weight = null, int level = 1)
 {
     if (weight == null)
     {
         System.Console.WriteLine(String.Format("{0}{1}", new String(' ', level * 3), GetLabel(concept)));
     }
     else
     {
         System.Console.WriteLine(String.Format("{0}{1} * {2}", new String(' ', level * 3), weight, GetLabel(concept)));
     }
     foreach (var rel in network.GetRelationshipsFrom(concept))
     {
         // Display the tree nodes recursively (DFS)
         DisplayTreeNode(network, rel.Target, rel.Weight, level + 1);
     }
 }
Beispiel #3
0
        static string GetLabel(Taxonomy.Concept concept)
        {
            // Try to find a standard English label
            var labels = concept.GetLabels("http://www.xbrl.org/2003/role/label", null, "en");

            if (labels.Count > 0)
            {
                return(labels.First().Text);
            }

            // Fallback to any other label that is assigned to the concept
            labels = concept.Labels;
            if (labels.Count > 0)
            {
                return(labels.First().Text);
            }

            // If there are no labels, display the concept QName
            return(concept.QName.ToString());
        }
Beispiel #4
0
 static void DisplayTreeNode(Taxonomy.PresentationRelationshipNetwork network, Taxonomy.Concept concept, string preferredLabelRole = null, int level = 1)
 {
     System.Console.WriteLine(String.Format("{0}{1}", new String(' ', level * 3), GetLabel(concept, preferredLabelRole)));
     foreach (var rel in network.GetRelationshipsFrom(concept))
     {
         // Display the tree nodes recursively (DFS)
         DisplayTreeNode(network, rel.Target, rel.PreferredLabel, level + 1);
     }
 }