<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Skinner's Blog : DGML</title><link>http://blogs.msdn.com/camerons/archive/tags/DGML/default.aspx</link><description>Tags: DGML</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Lovett is Blogging!</title><link>http://blogs.msdn.com/camerons/archive/2009/10/19/lovett-is-blogging.aspx</link><pubDate>Mon, 19 Oct 2009 22:44:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9909500</guid><dc:creator>camerons</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/camerons/comments/9909500.aspx</comments><wfw:commentRss>http://blogs.msdn.com/camerons/commentrss.aspx?PostID=9909500</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://www.lovettsoftware.com"&gt;Chris Lovett&lt;/a&gt;, an architect on my team who has a glorious and long history with Microsoft, has finally joined the blogosphere! His expertise is all things .NET, but in particular he knows the code behind the new DGML graphs and dependency diagrams that are new in Visual Studio 2010 Ultimate.&lt;/p&gt;  &lt;p&gt;His first two posts are fabulous, both of which include &lt;strong&gt;videos&lt;/strong&gt; of Chris walking through some of the power of the DGML graphing technology. Be sure to check out his “teaser” post &lt;a href="http://www.lovettsoftware.com/blogengine.net/post/2009/09/24/Directed-Graph-Documents.aspx"&gt;here&lt;/a&gt;, and a more in-depth post on our &lt;a href="http://www.lovettsoftware.com/blogengine.net/post/2009/09/26/Standard-Dependency-Graphs.aspx"&gt;Standard Dependency Graphs&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Be sure to subscribe to his blog, as I know he’ll be putting up quite a bit more content in the weeks ahead. &lt;/p&gt;  &lt;p&gt;You’ll be glad you did! :)&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9909500" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/camerons/archive/tags/tsbt-arch/default.aspx">tsbt-arch</category><category domain="http://blogs.msdn.com/camerons/archive/tags/DGML/default.aspx">DGML</category><category domain="http://blogs.msdn.com/camerons/archive/tags/Standard+Graphs/default.aspx">Standard Graphs</category><category domain="http://blogs.msdn.com/camerons/archive/tags/VS2010+Beta2/default.aspx">VS2010 Beta2</category><category domain="http://blogs.msdn.com/camerons/archive/tags/Visual+Studio+2010+Ultimate/default.aspx">Visual Studio 2010 Ultimate</category><category domain="http://blogs.msdn.com/camerons/archive/tags/VSTS+Designing/default.aspx">VSTS Designing</category></item><item><title>DGML, Containers, and VSTS 2010 Architecture Rendering</title><link>http://blogs.msdn.com/camerons/archive/2009/02/23/dgml-containers-and-vsts-2010-architecture-rendering.aspx</link><pubDate>Mon, 23 Feb 2009 05:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9440853</guid><dc:creator>camerons</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/camerons/comments/9440853.aspx</comments><wfw:commentRss>http://blogs.msdn.com/camerons/commentrss.aspx?PostID=9440853</wfw:commentRss><description>&lt;p&gt;I &lt;a href="http://blogs.msdn.com/camerons/archive/2009/01/26/directed-graph-markup-language-dgml.aspx"&gt;previously&lt;/a&gt; pointed out how easy it was to manipulate and then render a .dgml file in the upcoming VSTS 2010 Architecture product. I want to continue that discussion by showing how easy it is to indicate to the product that you need to see nodes contained inside another, and a few other niceties along the way.&lt;/p&gt; &lt;table border="1" cellspacing="0" cellpadding="2" width="*" bgcolor="azure"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="top" width="592"&gt;&lt;strong&gt;NOTE:&lt;br&gt;&lt;/strong&gt;&lt;br&gt;I do need to make one thing clear before we move forward. The difference between the core DGML and the additional capabilities you will find in the Architecture product is significant. The core DGML markup is limited to very few elements: DirectedGraph, Nodes, Node, Links, Link, Categories, and Category. Any additional markup beyond those basic elements is specific to the VSTS Architecture product. &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;So we had previously started with a graph that looked like this:&lt;/p&gt; &lt;p&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/DGMLContainersandVSTS2010ArchitectureRen_91F0/image_3.png" width="585" height="351"&gt; &lt;/p&gt; &lt;p&gt;In order to tell the VSTS 2010 Architecture product's DGML rendering engine to draw a container around the "From" node, you first start by adding another &lt;strong&gt;Link&lt;/strong&gt; element that has the &lt;strong&gt;Source&lt;/strong&gt; attribute named "My Container" ( value doesn't matter ), and the &lt;strong&gt;Target&lt;/strong&gt; attribute's value set to "From" ( this value does matter ). When you add that to your graph, you'll see this:&lt;/p&gt; &lt;p&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/DGMLContainersandVSTS2010ArchitectureRen_91F0/image_6.png" width="649" height="374"&gt; &lt;/p&gt; &lt;p&gt;Not exactly containing the "From" node at this point, but we're not done. We need to add two more things to the markup. &lt;/p&gt; &lt;p&gt;The first step is to add a &lt;strong&gt;Category&lt;/strong&gt; element to the &lt;strong&gt;Link &lt;/strong&gt;element we just added, with a value of "Contains". Markup should now look like this:&lt;/p&gt; &lt;p&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/DGMLContainersandVSTS2010ArchitectureRen_91F0/image_9.png" width="550" height="104"&gt; &lt;/p&gt; &lt;p&gt;The second step is to add a &lt;strong&gt;Nodes&lt;/strong&gt; element with a single &lt;strong&gt;Node &lt;/strong&gt;element contained inside, like so:&lt;/p&gt; &lt;p&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/DGMLContainersandVSTS2010ArchitectureRen_91F0/image_12.png" width="554" height="159"&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;The resulting graph looks like this:&lt;/p&gt; &lt;p&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/DGMLContainersandVSTS2010ArchitectureRen_91F0/image_15.png" width="485" height="161"&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Let me point out a number of things, and bring them to your attention. In the image below, I've selected the contained "From" node:&lt;/p&gt; &lt;p&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/DGMLContainersandVSTS2010ArchitectureRen_91F0/image_20.png" width="612" height="502"&gt; &lt;/p&gt; &lt;ol&gt; &lt;li&gt;This is a number that indicates how many nodes are actually contained in the container.  &lt;li&gt;The &lt;strong&gt;Id &lt;/strong&gt;of the container. The &lt;strong&gt;Id&lt;/strong&gt; must match the &lt;strong&gt;Source&lt;/strong&gt; attribute value of the &lt;strong&gt;Link&lt;/strong&gt; element that has the "Contains" &lt;strong&gt;Category&lt;/strong&gt; attribute applied to it. You can further include a &lt;strong&gt;Label&lt;/strong&gt; attribute to the &lt;strong&gt;Node&lt;/strong&gt; element in order to use a different value for the container's title than the &lt;strong&gt;Id&lt;/strong&gt; value. VSTS 2010 Architecture defaults to the &lt;strong&gt;Id&lt;/strong&gt; value when the &lt;strong&gt;Label&lt;/strong&gt; attribute is not present.  &lt;li&gt;A chevron that can be clicked resulting in a collapsed or expanded container. The container in this example is clearly expanded, allowing you to see the contents of the container in the graph. The expanded state is captured in the dgml file via the value of the &lt;strong&gt;Group&lt;/strong&gt; attribute on the &lt;strong&gt;Node&lt;/strong&gt; element set to "Expanded". Setting that value to "Collapsed" collapses the container, hiding its contents. Here's a shot that shows the results of setting that value to "Collapsed" as well as using the &lt;strong&gt;Label&lt;/strong&gt; attribute on the &lt;strong&gt;Node&lt;/strong&gt; element:&lt;br&gt;&lt;a href="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/DGMLContainersandVSTS2010ArchitectureRen_91F0/image_22.png"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/DGMLContainersandVSTS2010ArchitectureRen_91F0/image_thumb_7.png" width="609" height="461"&gt;&lt;/a&gt;  &lt;li&gt;This is showing that I have selected the "From" node.  &lt;li&gt;Because I have selected the "From" node, the link between the "From" node and "To" node shows up. If you aren't selecting "From" or the "To" nodes, that link disappears.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;That's it! I should also add that you can have as many levels of containment as you'd like. Hope that helps!&lt;/p&gt; &lt;p&gt;Cameron&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9440853" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/camerons/archive/tags/tsbt-arch/default.aspx">tsbt-arch</category><category domain="http://blogs.msdn.com/camerons/archive/tags/Architecture+Edition/default.aspx">Architecture Edition</category><category domain="http://blogs.msdn.com/camerons/archive/tags/DGML/default.aspx">DGML</category></item><item><title>Directed Graph Markup Language ( DGML )</title><link>http://blogs.msdn.com/camerons/archive/2009/01/26/directed-graph-markup-language-dgml.aspx</link><pubDate>Tue, 27 Jan 2009 00:03:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9376251</guid><dc:creator>camerons</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/camerons/comments/9376251.aspx</comments><wfw:commentRss>http://blogs.msdn.com/camerons/commentrss.aspx?PostID=9376251</wfw:commentRss><description>&lt;p&gt;In this &lt;a href="http://blogs.msdn.com/camerons/archive/2008/12/16/introduction-to-directed-graph-markup-language-dgml.aspx"&gt;previous post&lt;/a&gt; I introduced you to the new format, and then this &lt;a href="http://blogs.msdn.com/camerons/archive/2008/12/18/standard-graphs.aspx"&gt;follow on post&lt;/a&gt; showed some of the examples of how the format is used to back some common graphs you can expect in the product.&lt;/p&gt;  &lt;p&gt;In this post, I'm going to talk about a couple ways of controlling how links are rendered in the VSTS 2010 Architecture product.&lt;/p&gt;  &lt;h2&gt;&lt;u&gt;The Graph Element&lt;/u&gt;&lt;/h2&gt;  &lt;p&gt;At the root of every DGML document is the &lt;strong&gt;DirectedGraph&lt;/strong&gt; element. The default namespace for this document, attributed to this element, is &lt;a href="http://schemas.microsoft.com/vs/2009/dgml"&gt;http://schemas.microsoft.com/vs/2009/dgml&lt;/a&gt;. There are a number of xml attributes that is supported for this element that you will be able to quickly discover through the intellisense functionality off the file, but I want to call out the &lt;strong&gt;Background&lt;/strong&gt; attribute in particular.&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;Background&lt;/strong&gt; attribute allows you to set the color of the background of the graph surface itself, either by name of ARGB hex values as documented &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.media.colors.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;For example, this snippet of DGML:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="90" alt="image" src="http://www.cwskinner.members.winisp.net/BlogImages/DirectedGraphMarkupLanguageDGML_835B/image.png" width="682" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Results in this graph:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="229" alt="image" src="http://www.cwskinner.members.winisp.net/BlogImages/DirectedGraphMarkupLanguageDGML_835B/image_3.png" width="461" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Amazing, but good to know nonetheless. :)&lt;/p&gt;  &lt;h2&gt;&lt;u&gt;The Link Element&lt;/u&gt;&lt;/h2&gt;  &lt;p&gt;A DGML graph is fundamentally all about nodes and the links between those nodes. You'll notice in the markup above the &lt;strong&gt;Links&lt;/strong&gt; element containing one &lt;strong&gt;Link&lt;/strong&gt; element. You'll also notice that the rendering engine that reads this particular DGML is smart enough to understand that a link cannot exist without nodes to connect, so automatically creates a &amp;quot;From&amp;quot; node and a &amp;quot;To&amp;quot; node based on the values found in the &lt;strong&gt;Source&lt;/strong&gt; and &lt;strong&gt;Target&lt;/strong&gt; attributes on the &lt;strong&gt;Link &lt;/strong&gt;element.&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;Link&lt;/strong&gt; element has a number of interesting attributes that are directly supported. I'll call out a few here. &lt;/p&gt;  &lt;p&gt;In order to change the background color of a link arrowhead, set the &lt;strong&gt;Backround&lt;/strong&gt; attribute to &amp;quot;Red&amp;quot;. You'll get something like this:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="254" alt="image" src="http://www.cwskinner.members.winisp.net/BlogImages/DirectedGraphMarkupLanguageDGML_835B/image_4.png" width="638" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;In order to change the color of the entire link, set the &lt;strong&gt;Stroke&lt;/strong&gt; attribute to your desired color. If you only specify &lt;strong&gt;Stroke &lt;/strong&gt;and not &lt;strong&gt;Background&lt;/strong&gt;, the arrowhead fill color will also be changed to the &lt;strong&gt;Stroke &lt;/strong&gt;color value.&lt;/p&gt;  &lt;p&gt;You can also change the thickness of the link itself by assigning a value to the &lt;strong&gt;StrokeThickness&lt;/strong&gt; attribute, like so:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="225" alt="image" src="http://www.cwskinner.members.winisp.net/BlogImages/DirectedGraphMarkupLanguageDGML_835B/image_5.png" width="586" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;You can also make the link a dashed line by playing with values in the &lt;strong&gt;StrokeDashArray&lt;/strong&gt; attribute. The comma delimited values are converted to doubles, and are taken in relation to the &lt;strong&gt;StrokeThickness&lt;/strong&gt; value, which is &lt;strong&gt;1&lt;/strong&gt; by default. For example, setting &lt;strong&gt;StrokeDashArray&lt;/strong&gt; to &lt;strong&gt;5 &lt;/strong&gt;with a default thickness of 1 results in something like this:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="233" alt="image" src="http://www.cwskinner.members.winisp.net/BlogImages/DirectedGraphMarkupLanguageDGML_835B/image_6.png" width="591" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;You can make the dashed line much more involved by adding more values to the dash array, as specified &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.shapes.shape.strokedasharray.aspx"&gt;here&lt;/a&gt;. Here's an example:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="221" alt="image" src="http://www.cwskinner.members.winisp.net/BlogImages/DirectedGraphMarkupLanguageDGML_835B/image_7.png" width="610" border="0" /&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;&lt;u&gt;Summary&lt;/u&gt;&lt;/h2&gt;  &lt;p&gt;Just a quick taste on how to control link rendering. We'll start to build up more knowledge as we go. In a future post, I want to show the &lt;strong&gt;Node&lt;/strong&gt; element, and specifically get into how grouping / nesting is supported. Stay tuned!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9376251" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/camerons/archive/tags/tsbt-arch/default.aspx">tsbt-arch</category><category domain="http://blogs.msdn.com/camerons/archive/tags/Architecture+Edition/default.aspx">Architecture Edition</category><category domain="http://blogs.msdn.com/camerons/archive/tags/DGML/default.aspx">DGML</category></item><item><title>Visualize Java Code</title><link>http://blogs.msdn.com/camerons/archive/2009/01/20/visualize-java-code.aspx</link><pubDate>Tue, 20 Jan 2009 08:09:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9342893</guid><dc:creator>camerons</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/camerons/comments/9342893.aspx</comments><wfw:commentRss>http://blogs.msdn.com/camerons/commentrss.aspx?PostID=9342893</wfw:commentRss><description>&lt;p&gt;In this &lt;a href="http://blogs.msdn.com/camerons/archive/2008/12/16/introduction-to-directed-graph-markup-language-dgml.aspx"&gt;last post&lt;/a&gt; I introduced you to some *very* basic understanding of how DGML works. Now I want to take that knowledge out for a test drive. :)&lt;/p&gt; &lt;p&gt;What I've decided to do is a couple of things. I've decided I'm going to show how to visualize Java code using &lt;a href="http://www.antlr.org"&gt;Antlr&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/vstudio/default.aspx"&gt;Visual Studio 2008&lt;/a&gt; and output a DGML file that the VSTS 2010 Architecture product found in the &lt;a href="http://blogs.msdn.com/briankel/archive/2008/10/27/helpful-links-for-the-visual-studio-2010-ctp.aspx"&gt;latest CTP&lt;/a&gt; can render.&lt;/p&gt; &lt;p&gt;Why am I doing this? Because I think it will be an excellent example ( you'll be the judge of that ) of how easy it will be to visualize all kinds of data, not just .NET languages. Java code, Work Items, MSBuild dependencies, on and on. Literally, this list is potentially enormous, gated only by imagination and effort ( aren't all good things this way? ).&lt;/p&gt; &lt;p&gt;In some future posts, I'll show how you can continue to tweak the DGML to do some things that you can't do in the current CTP, but can with current bits ( such as node grouping, advanced selection, etc. ).&lt;/p&gt; &lt;h3&gt;&lt;/h3&gt; &lt;h4&gt;&lt;u&gt;Prerequisites&lt;/u&gt;&lt;/h4&gt; &lt;p&gt;If you want to follow along on this little journey, you need to get the following things:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Visual Studio 2008  &lt;li&gt;Latest JDK from Sun. Lots of options here but I ultimately went &lt;a href="https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jdk-6u11-oth-JPR@CDS-CDS_Developer"&gt;here&lt;/a&gt; and followed the steps.  &lt;li&gt;Antlr 3.1.1 ( see below for instructions )  &lt;li&gt;&lt;a href="http://blogs.msdn.com/briankel/archive/2008/10/27/helpful-links-for-the-visual-studio-2010-ctp.aspx"&gt;VSTS 2010 CTP&lt;/a&gt; ( follow link for instructions )  &lt;li&gt;&lt;a href="http://cwskinner.members.winisp.net/SampleCode/Java2DGML.zip"&gt;The Visual Studio 2008 solution&lt;/a&gt; that I used to create this post &lt;/li&gt;&lt;/ol&gt; &lt;h4&gt;&lt;u&gt;Establish "Base of Operations"&lt;/u&gt;&lt;/h4&gt; &lt;p&gt;I'm going to be very descriptive of what I'm doing 'cause the complication is not going to be in the implementation, but more in the "configuration of the parts".&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Create a directory where work will be done. This will be our "Base of Operations". From here on out, I'll refer to this directory as &lt;strong&gt;%BOO%&lt;/strong&gt;.  &lt;li&gt;&lt;a href="http://www.antlr.org/download/antlr-3.1.1.tar.gz"&gt;Download Antlr 3.1.1&lt;/a&gt;  &lt;ol&gt; &lt;li&gt;If this link becomes stale, go to &lt;a href="http://www.antlr.org"&gt;http://www.antlr.org&lt;/a&gt; and download the latest source distribution which includes the runtime jars that you'll need. &lt;/li&gt;&lt;/ol&gt; &lt;li&gt;Extract the contents of the download to the %BOO% directory. When done, you should have the following contents in the &lt;strong&gt;%BOO%\antlr-3.1.1 &lt;/strong&gt;directory: &lt;br&gt;&lt;a href="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/VisualizeJavaCode_9C70/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="186" alt="image" src="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/VisualizeJavaCode_9C70/image_thumb_1.png" width="517" border="0"&gt;&lt;/a&gt;  &lt;li&gt;Ensure Java is installed correctly  &lt;ol&gt; &lt;li&gt;Open up a command prompt, CD to your %BOO% directory.  &lt;li&gt;Type the following: &lt;strong&gt;java -?&lt;/strong&gt;  &lt;li&gt;If you don't see a typical "Usage" statement, then you probably have something installed wrong. For me, I had to make sure that the java bin directory was in my path, so I added that to my system environment variables. &lt;/li&gt;&lt;/ol&gt; &lt;li&gt;Create a BOO.bat file that contains the following contents, and save to &lt;strong&gt;%BOO%&lt;/strong&gt;: &lt;br&gt;&lt;br&gt;&lt;font face="Courier New" size="2"&gt;set &lt;font color="#0000ff"&gt;BOO&lt;/font&gt;=&lt;font color="#ff0000"&gt;%CD% &lt;br&gt;&lt;/font&gt;set &lt;font color="#0000ff"&gt;ANTLR_LIB&lt;/font&gt;=%BOO%\antlr-3.1.1\lib &lt;br&gt;set &lt;font color="#0000ff"&gt;classpath&lt;/font&gt;=.;%ANTLR_LIB%\antlr-3.1.1.jar;%ANTLR_LIB%\antlr-3.1.1-runtime.jar;%ANTLR_LIB%\stringtemplate-3.2.jar;%ANTLR_LIB%\antlr-2.7.7.jar &lt;br&gt;&lt;/font&gt; &lt;li&gt;Ensure Antlr is now ready to go.  &lt;ol&gt; &lt;li&gt;At the command prompt, type &lt;strong&gt;BOO.bat&lt;/strong&gt; and hit enter  &lt;li&gt;Now type &lt;strong&gt;java org.antlr.Tool&lt;/strong&gt; and hit enter  &lt;li&gt;You should see this: &lt;br&gt;&lt;br&gt;&lt;a href="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/VisualizeJavaCode_9C70/image_6.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="269" alt="image" src="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/VisualizeJavaCode_9C70/image_thumb_2.png" width="640" border="0"&gt;&lt;/a&gt; &lt;br&gt;If you don't, double check your BOO.bat file and make sure you don't have any typos. &lt;/li&gt;&lt;/ol&gt; &lt;li&gt;Feel free to download the original Java.g file also available on the Antlr site. I've included the one I have modified in the solution I've made available in the "Prerequisites section":  &lt;ol&gt; &lt;li&gt;Click &lt;a href="http://www.antlr.org/grammar/1152141644268/Java.g"&gt;here&lt;/a&gt;.  &lt;li&gt;If it looks like a page just full of text, right click and say view source, then "Save As..." &lt;strong&gt;java.g&lt;/strong&gt; into your %BOO% directory. &lt;/li&gt;&lt;/ol&gt; &lt;li&gt;Unzip the &lt;a href="http://cwskinner.members.winisp.net/SampleCode/Java2DGML.zip"&gt;solution&lt;/a&gt; I created into your &lt;strong&gt;%BOO%&lt;/strong&gt; directory.  &lt;li&gt;You'll need to replace the references to antlr.runtime, Antlr3.Runtime, Antlr3.Utility, and StringTemplate to those now in your &lt;strong&gt;%BOO% &lt;/strong&gt;directory:  &lt;ol&gt; &lt;li&gt;Add Antlr C# runtime references to the project.  &lt;ol&gt; &lt;li&gt;First we have to extract the runtime files found in the &lt;strong&gt;%BOO%\antlr-3.1.1\runtime\CSharp\dist\DOT-NET-runtime-3.1.1.zip&lt;/strong&gt;.  &lt;ol&gt; &lt;li&gt;Extract the contents of that zip to &lt;strong&gt;%BOO%\antlr-3.1.1\runtime\CSharp\Libraries&lt;/strong&gt;  &lt;li&gt;Once extracted, you should have a &lt;strong&gt;bin&lt;/strong&gt; directory. &lt;/li&gt;&lt;/ol&gt; &lt;li&gt;Right click on the &lt;strong&gt;References&lt;/strong&gt; node in the project  &lt;li&gt;Click on the &lt;strong&gt;Browse&lt;/strong&gt; tab.  &lt;li&gt;Navigate to &lt;strong&gt;%BOO%\antlr-3.1.1\runtime\CSharp\Libraries\bin\net-2.0&lt;/strong&gt;  &lt;li&gt;Add all the dlls found in that directory as references. There should be four dlls in there, as mentioned above ( If you do everything I've just mentioned just right, this step shouldn't be necessary, as the solution I provided should be relative )&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt; &lt;li&gt;OK, we're ready to build.  &lt;ol&gt; &lt;li&gt;Rebuild the solution. &lt;/li&gt;&lt;/ol&gt; &lt;li&gt;If all went well, you now have a parser that's ready to parse Java 1.5 code! &lt;/li&gt;&lt;/ol&gt; &lt;h4&gt;&lt;u&gt;Results&lt;/u&gt;&lt;/h4&gt; &lt;p&gt;The executable created after building the solution is &lt;strong&gt;Java2DGML.exe.&lt;/strong&gt; If you drop to the command line, CD into the debug directory where the exe is found, run the following command: &lt;/p&gt; &lt;p&gt;&lt;strong&gt;Java2DGML.exe &lt;font color="#0080ff"&gt;/f&lt;/font&gt; %BOO%\antlr-3.1.1\src\org\antlr\Tool.java &lt;font color="#ff0000"&gt;&amp;gt; Tool.dgml&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;then open Tool.dgml in the VSTS 2010 CTP, here's what you'll see&lt;strong&gt;:&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/VisualizeJavaCode_9C70/image_18.png" target="_blank"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="480" alt="image" src="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/VisualizeJavaCode_9C70/image_thumb_7.png" width="165" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Here's the &lt;a href="http://cwskinner.members.winisp.net/SampleCode/Tool.xps"&gt;XPS file of that image&lt;/a&gt; as well.&lt;/p&gt; &lt;p&gt;The exe is by no means a robust piece of software. It currently understands how to gather information for simple Java classes ( i.e., not templated ), fields, and methods. No interfaces, enums, etc., but after this post, you should have all the info you need to take this example a bit farther.&lt;/p&gt; &lt;p&gt;Now let me explain the source a little bit...&lt;/p&gt; &lt;h4&gt;&lt;u&gt;Taxonomy of the Solution&lt;/u&gt;&lt;/h4&gt; &lt;p&gt;Here is a shot of the Solution Explorer with the &lt;strong&gt;Java2DGML&lt;/strong&gt; solution loaded:&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/VisualizeJavaCode_9C70/image_26.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="332" alt="image" src="http://blogs.msdn.com/blogfiles/camerons/WindowsLiveWriter/VisualizeJavaCode_9C70/image_thumb_11.png" width="310" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3&gt;&lt;u&gt;Generated Files&lt;/u&gt;&lt;/h3&gt; &lt;p&gt;Java.Tokens, JavaLexer.cs, and JavaParser.cs are all generated files. You can regenerate those files by executing the following command in you command window where you executed &lt;strong&gt;BOO.bat, &lt;/strong&gt;in the &lt;strong&gt;%BOO%\Java2DGML\Java2DGML &lt;/strong&gt;directory&lt;strong&gt;:&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;java org.antlr.Tool Java.g&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;u&gt;Java.g&lt;/u&gt;&lt;/p&gt; &lt;p&gt;The &lt;strong&gt;Java.g&lt;/strong&gt; file is where the grammar for parsing Java 1.5 is defined. This grammar file instructs the &lt;strong&gt;org.antlr.Tool&lt;/strong&gt; object how to generate a parser in C# capable of parsing Java 1.5 code. More on this later.&lt;/p&gt; &lt;p&gt;&lt;u&gt;DGMLContext.cs&lt;/u&gt;&lt;/p&gt; &lt;p&gt;A simple utility class used to gather information during the parse that is later used to generate the appropriate DGML. For every Java class, one DGMLContext object will be created to capture the relevant details.&lt;/p&gt; &lt;p&gt;&lt;u&gt;DGMLFile.st&lt;/u&gt;&lt;/p&gt; &lt;p&gt;Antlr has a great mechanism built in called the StringTemplate framework. Check out this &lt;a href="http://www.stringtemplate.org"&gt;link&lt;/a&gt; for more details. This file is an example of a StringTemplate for DGML files. More on this later.&lt;/p&gt; &lt;p&gt;&lt;u&gt;JavaParserImpl.cs&lt;/u&gt;&lt;/p&gt; &lt;p&gt;Antlr allows the C# developer to tell Antlr to create a partial class for its parser implementation so that additional behavior can be added and used in the grammar file more easily. I've taken advantage of that in this file.&lt;/p&gt; &lt;p&gt;&lt;u&gt;Program.cs&lt;/u&gt;&lt;/p&gt; &lt;p&gt;This is the main program, where all the pieces come together. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;font color="#000000"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;strong&gt;&lt;font color="#000000"&gt;&lt;u&gt;Summary&lt;/u&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;font color="#000000"&gt;This post is really meant to whet your appetite on some of the possibilities coming in the 2010 version of the Architecture product around visualization. Admittedly, I'm clearly just scratching the surface of this particular example ( Java source visualization ), but that's ok. From time to time, I may come back to this example and flesh out a little more in order to exemplify some deeper features.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;font color="#000000"&gt;In the meantime, I think in my next post I'll start to show some more of the features inherent in DGML, beyond just the simple nodes and links I've shown to date. &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;font color="#000000"&gt;Stay Tuned!&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9342893" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/camerons/archive/tags/tsbt-arch/default.aspx">tsbt-arch</category><category domain="http://blogs.msdn.com/camerons/archive/tags/Architecture+Edition/default.aspx">Architecture Edition</category><category domain="http://blogs.msdn.com/camerons/archive/tags/DGML/default.aspx">DGML</category></item><item><title>Introduction to Directed Graph Markup Language ( DGML )</title><link>http://blogs.msdn.com/camerons/archive/2008/12/16/introduction-to-directed-graph-markup-language-dgml.aspx</link><pubDate>Tue, 16 Dec 2008 23:59:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9228382</guid><dc:creator>camerons</dc:creator><slash:comments>14</slash:comments><comments>http://blogs.msdn.com/camerons/comments/9228382.aspx</comments><wfw:commentRss>http://blogs.msdn.com/camerons/commentrss.aspx?PostID=9228382</wfw:commentRss><description>&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;font color="#000000"&gt;DGML, or &amp;quot;Directed Graph Markup Language&amp;quot; is what we are using in VSTS 2010 Architecture to render graphs like the one below:          &lt;br /&gt;&lt;a href="http://www.cwskinner.members.winisp.net/BlogImages/IntroductiontoDirectedGraphMarkupLanguag_B68E/image_thumb31.png" target="_blank"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="324" alt="image_thumb3[1]" src="http://www.cwskinner.members.winisp.net/BlogImages/IntroductiontoDirectedGraphMarkupLanguag_B68E/image_thumb31_thumb.png" width="640" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;font color="#000000"&gt;The power of DGML is in its simplicity. Let me show you what I mean.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;font color="#000000"&gt;If you launch the &lt;a href="http://blogs.msdn.com/briankel/archive/2008/10/27/helpful-links-for-the-visual-studio-2010-ctp.aspx"&gt;VSTS 2010 CTP&lt;/a&gt;, open a project, click &lt;strong&gt;View-&amp;gt;Architecture Explorer&lt;/strong&gt;, then click the button shown below...           &lt;br /&gt;&amp;#160;&lt;a href="http://www.cwskinner.members.winisp.net/BlogImages/IntroductiontoDirectedGraphMarkupLanguag_B68E/image_thumb8.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="209" alt="image_thumb8" src="http://www.cwskinner.members.winisp.net/BlogImages/IntroductiontoDirectedGraphMarkupLanguag_B68E/image_thumb8_thumb.png" width="609" border="0" /&gt;&lt;/a&gt; &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;font color="#000000"&gt;...you'll get a new dgml editor in the document well. You can then right click inside that document and select &amp;quot;View Code&amp;quot;. Right click on the tab of the resulting editor and select &amp;quot;New Horizontal Tab Group&amp;quot;. You'll have something similar to this:&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.cwskinner.members.winisp.net/BlogImages/IntroductiontoDirectedGraphMarkupLanguag_B68E/image_thumb14.png" target="_blank"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="468" alt="image_thumb14" src="http://www.cwskinner.members.winisp.net/BlogImages/IntroductiontoDirectedGraphMarkupLanguag_B68E/image_thumb14_thumb.png" width="640" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;font color="#000000"&gt;&lt;font color="#333333"&gt;If you add a &lt;strong&gt;Link&lt;/strong&gt; element as a child element to the &lt;strong&gt;Links&lt;/strong&gt; node, with a &lt;strong&gt;Source &lt;/strong&gt;and &lt;strong&gt;Target&lt;/strong&gt; attribute, you'll get something similar to this:&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;font color="#000000"&gt;&lt;a href="http://www.cwskinner.members.winisp.net/BlogImages/IntroductiontoDirectedGraphMarkupLanguag_B68E/image_thumb17.png" target="_blank"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="467" alt="image_thumb17" src="http://www.cwskinner.members.winisp.net/BlogImages/IntroductiontoDirectedGraphMarkupLanguag_B68E/image_thumb17_thumb.png" width="640" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;font color="#000000"&gt;To add a few more elements, try this:&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.cwskinner.members.winisp.net/BlogImages/IntroductiontoDirectedGraphMarkupLanguag_B68E/image_thumb20.png" target="_blank"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="469" alt="image_thumb20" src="http://www.cwskinner.members.winisp.net/BlogImages/IntroductiontoDirectedGraphMarkupLanguag_B68E/image_thumb20_thumb.png" width="640" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You'll notice the &lt;strong&gt;Nodes&lt;/strong&gt; element isn't even needed to render the graph above. That is really all you need to know to visualize all kinds of data. Rest assured there is a lot more goodness to discuss about this technology, but the simplicity of it is one of the most exciting aspects as far as I'm concerned!&lt;/p&gt;  &lt;p&gt;In my next post, I'm actually going to show you how, armed with just this little nugget of DGML information, you can visualize some Java code. Stay tuned!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9228382" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/camerons/archive/tags/tsbt-arch/default.aspx">tsbt-arch</category><category domain="http://blogs.msdn.com/camerons/archive/tags/Architecture+Edition/default.aspx">Architecture Edition</category><category domain="http://blogs.msdn.com/camerons/archive/tags/VSTS+2010+Fall+CTP/default.aspx">VSTS 2010 Fall CTP</category><category domain="http://blogs.msdn.com/camerons/archive/tags/DGML/default.aspx">DGML</category><category domain="http://blogs.msdn.com/camerons/archive/tags/Architecture+Explorer/default.aspx">Architecture Explorer</category></item></channel></rss>