-
As most of you may know by now, earlier this year I left Mindjet to join Microsoft. Mindjet is a Microsoft Gold Certified partner who makes the mind mapping software MindManager. Since I have been at Microsoft, I've been "drinking from the fire hose" and learning about many cool technologies; my challenge is to explain their relevance to my customers.
LINQ (Language Integrated Query) is a new feature in C# 3.0 and integrated into Visual Studio 2008, which will be released in February 2008. It allows for a very concise natural-language querying of data sets that is integrated with the Visual Studio 2008 Intellisense.
Throughout the time that I was at Mindjet, we had requests for how the topics in Mindjet MindManager maps could be used as data sources for other applications. I started the Mindjet Labs to show people how to do this. Since the MindManager Map is stored as XML data inside the .mmap file (a zip archive), it is fairly easy to get at the data. This is very similar to the rationale behind the Office Open XML File Formats that are in Office 2007. The hard part comes in understanding the XML (it's a bit verbose). After four years of working with it, when I see the MindManager XML I can visualize the map, similar to how Mouse in the film The Matrix could see the lady in the red dress through falling characters on a screen. Because the XSD schemas for each MindManager map are stored in the zip archive as well as the content, you have an exact description of the MindManager XML format within each .mmap file. Using these schemas and the XSD.exe tool that comes with the .Net SDK, you can create C# or VB.Net classes that can be used to deserialize the MindManager XML using XMLSerializer in the .Net Framework.
XmlSerializer serializer = new XmlSerializer(typeof(Mindjet.MindManager.Map));
Mindjet.MindManager.Map map = serializer.Deserialize(zipStream) as Map;
Once I deserialize the Map, to make that Map work with LINQ, I need to get a collection of Topics in the map as an enumerable object: IEnumerable<Topic>. I put the deserializing and code to return the collection of Topics into .Net assembly so anyone can use it; source code and binary are attached to this post.
The Query
In a MindManager Map, you can assign task priorities top any topic (the colored circles) and that information is stored in the XML data for each topic:
A sample query on this data might be to report how many of each priority topic is in the map. In the simple map above, there are 3 priority1, 1 priority 2, and 3 priority 3 topics. Using LINQ you would query the map like this:
class LINQtoMindManager
{
public void QueryDemo()
{
MindManagerMap map = new MindManagerMap("test.mmap");
var query = from topic in map.AllTopics
where topic.Task != null && topic.Task.TaskPrioritySpecified
group topic by topic.Task.TaskPriority into g
select new { Priority = g.Key, Count = g.Count()};
foreach (var result in query)
{
Console.WriteLine(result.Priority + ": " + result.Count);
}
}
}
That will then write the following results for the map pictured above:
urnmindjetPrio1: 3
urnmindjetPrio2: 1
urnmindjetPrio3: 3
What makes it easy is that LINQ can iterate or query over any collection that supports IEnumerable<> or IQueryable<>. Feel free to download the source code for this MindManager Library and use it in your project!
-
If you look at the XML generated by the OneNote 2007 API, you will notice that the text outline sections are all escaped with CDATA[] elements. This, in my opinion is bad form. I am working on transforming the OneNote XML to Silverlight XAML using XSLT and having that portion of the XML escaped makes it more difficult to parse and transform. My guess is that it's like this because much of the HTML is copied from web browsers and HTML is not always well-formed XML (XHTML is). Coming from MindManager that always used well-formed XHTML for note in the XML, I would like much more usable XML from OneNote 2007.
Instead of this:
<
one:OE creationTime="2006-01-25T02:41:25.000Z" lastModifiedTime="2006-03-02T22:01:00.000Z" objectID="{B64DE6F4-60DB-0E93-07D6-DBBDCDBF80A3}{77}{B0}" alignment="left"> <
one:T> <![CDATA[
In addition to features covered in the <a href="onenote:Getting%20Started%20with%20OneNote.one">Getting started</a> section, OneNote has additional tools that can help you in several activities. <span
style='font-weight:bold'>Click these links</span> to explore. Use the <span
style='font-weight:bold'>Back arrow button</span> on the toolbar to return to this page:
]]> </
one:T> </
one:OE> Use this:
<
one:OE creationTime="2006-01-25T02:41:25.000Z" lastModifiedTime="2006-03-02T22:01:00.000Z" objectID="{B64DE6F4-60DB-0E93-07D6-DBBDCDBF80A3}{77}{B0}" alignment="left"> <
one:T> In addition to features covered in the
<a href
="onenote:Getting%20Started%20with%20OneNote.one">Getting started</a> section, OneNote has additional tools that can help you in several activities. <span style
='font-weight:bold'>Click these links</span> to explore. Use the <span style
='font-weight:bold'>Back arrow button</span> on the toolbar to return to this page: </
one:T> </
one:OE> Here are two questions:
- Is the HTML in OneNote 2007's CDATA sections well-formed XML?
- Does anyone have any cool tricks to convert non-well-formed HTML to well-formed XHTML?
-
I have been working with XML for most of my career, from developing a CAD application to my roles at Mindjet to my new role at Microsoft talking about Silverlight. In this career, I have given numerous talks about the relevance of XML and to be susinct, I have it boiled down to this:
XML is about Partnerships.
Whether that partnership are one-to-one or one-to-many, in my opinion, XML is the right technology to use when you want systems to interoperate with eachother. One type of XML is called XSLT, which is a transformational XML language that defines how one XML set of data transforms to another, so given this XML fragment of Mindjet MindManager XML:
<ap:Topic xmlns:ap="...">
<ap:Text PlainText="Silverlight Rules"/>
</ap:Topic>
this XSLT fragment:
<xsl:template match="ap:Topic" xmlns:xslt="..." xmlns:ap="...">
<TextBlock Text="{ap:/Text/@PlainText}" xmlns="..."/>
</xsl:template>
Produces this Silverlight XAML:
<TextBlock Text="Silverlight Rules" xmlns="..."/>
The significance of this is that you can write an XSL transform from almost any XML language to another: THIS IS BIG! That means that if you have content in one XML format, you can transform it to another. A few years ago, I did a simple demo (that only works on Internet Explorer) on my personal website that used XSLT to make a browser for sketches that I did over the years (click on the about link on top to see how it was done). When I was at Mindjet, I created numerous demos on the Mindjet Labs that used XML and XSLT to get data into and out of MindManager. As you can see, I love working with XSLT!
When I first heard about XAML and Silverlight last year, I started getting very excited about the possibilites that it could enable especially with transforming data from MindManager's XML to XAML. One of the XML languages that I started working with at Mindjet was the RibbonX XML for Office 2007 Ribbon UI for Word 2007. Before I joined Microsoft, I started thinking about how I could transform RibbonX XML to Silverlight's XML (XAML) to present a website's user interface. This was a fun exercise for me and I really learned Silverlight's XAML. What I created from that was http://xmldocs.net. I am now seeing others that are using Silverlight to render all types of XML data, like XPS files. This is why I believe that Silverlight's XML data model is significant. Now, the next thing that I want to look at Popfly.
Links:
What XML do you want to see in Silverlight? To get some ideas, look at all of the web services on Programmable Web (most web services are XML-based).
-
From it's inception in September 2005 to September 2006, I managed the content for the Mindjet Labs using MindManager. I created a JavaScript and an XSL transformation that turned the XML of the map into the HTML pages that made up the Mindjet Labs Read More...
-
On the Mindjet Labs MindManager Jobs Forum , Dennis Günnewig posted a query about building an Open Document Format (ODF) export plug-in for MindManager. A few other people have been asking me about ODF and someone on the MindManagerDev Yahoo group Read More...
-
You've got to watch this video on YouTube. It has nothing about MindManager in it (surprise), but it does give you a good idea of the power of XML, one of the technical underpinnings of MindManager. View Video Format: ??? Duration: 4:31 Read More...
-
Sometimes our customs come to us with feature ideas that should have been in the product from the start. Let me give you one example: One of the most exciting features of Mindjet MindManager Pro 6 are the Custom Properties. This is meant as a developer Read More...