Disclaimer and License

Opinions expressed here by Tim Tripcony are his own and not representative of his employer.

Creative Commons License
Tip of the Iceberg is licensed under a Creative Commons Attribution 3.0 Unported License.
Based on a work at timtripcony.com.

Unless otherwise explicitly specified, all code samples and downloads are copyright Tim Tripcony and licensed under Apache License 2.0.

Search

What the Quote?

"I write the code that makes the young girls cry."

Alex Belt

"You're like a lint brush."

Laura Tripcony

"In order to understand recursion, one must first understand recursion."

Author Unknown

« Wherefore art thou, blogroll? | Main| Apple Apple »

Mind Map of Database Design

Category domino
If you haven't yet seen the mind map Chris created to describe the Notes URL protocol, check it out. I've played with mind maps, but it hadn't occurred to me to use them for training purposes, and in retrospect it makes sense.

One of the uses I've been hoping to expand Decepticon to support is to transform the entire design of a database into a mind map to provide a visual representation of application complexity. Trouble is, that's probably gonna require some serious XSLT. But a few minutes of tinkering with just some core LotusScript produced this. It maps (most of) the design element categories of my mail file. I left out image resources, because there are hundreds in the mail template, and that's apparently just too much data for poor old NotesDOMParser to serialize.

UPDATE: By request, here's the code of the agent that produces the XML which feeds the FreeMind applet:

'Declarations
Dim dbMail As NotesDatabase
Dim nodeDocument As NotesDOMDocumentNode
Dim nodeDbTitle As NotesDOMElementNode

Public Sub AnalyzeElementCategory (Byval p_strCategory As String)
    Dim ncElements As NotesNoteCollection
    Dim docElement As NotesDocument
    Dim nodeCategory As NotesDOMElementNode
    Dim nodeElement As NotesDOMElementNode
    Dim strNoteID As String
    
    Set ncElements = dbMail.CreateNoteCollection(False)    
    Select Case p_strCategory
    Case "Agents"
        Let ncElements.SelectAgents = True
    Case "Folders"
        Let ncElements.SelectFolders = True
    Case "Forms"
        Let ncElements.SelectForms = True
    Case "Framesets"
        Let ncElements.SelectFramesets = True
    Case "Outlines"
        Let ncElements.SelectOutlines = True
    Case "Pages"
        Let ncElements.SelectPages = True
    Case "Script Libraries"
        Let ncElements.SelectScriptLibraries = True
    Case "Shared Fields"
        Let ncElements.SelectSharedFields = True
    Case "Shared Files"
        Let ncElements.SelectMiscFormatElements = True
    Case "Shared Images"
        Let ncElements.SelectImageResources = True
    Case "Subforms"
        Let ncElements.SelectSubforms = True
    Case "Views"
        Let ncElements.SelectViews = True    
    End Select
    
    Call ncElements.BuildCollection()
    If (ncElements.Count > 0) Then
        Set nodeCategory = nodeDocument.CreateElementNode("node")
        Call nodeCategory.SetAttribute("text", p_strCategory & { (} & ncElements.Count & {)})    
        Call nodeCategory.SetAttribute("folded","true")
        Let strNoteID = ncElements.GetFirstNoteId()
        Do While (Len(strNoteID) > 0)
            Set docElement = dbMail.GetDocumentByID(strNoteID)
            Set nodeElement = nodeDocument.CreateElementNode("node")
            Call nodeElement.SetAttribute("text",Replace(docElement.GetItemValue("$TITLE")(0),{'},{'}))
            Call nodeCategory.AppendChild(nodeElement)
            Let strNoteID = ncElements.GetNextNoteId(strNoteID)
        Loop
        Call nodeDbTitle.AppendChild(nodeCategory)
    End If
End Sub

Sub Initialize
    Dim sesCurrent As New NotesSession    
    Dim dompDesign As NotesDOMParser    
    Dim nodeMap As NotesDOMElementNode
    Dim nodeRoot As NotesDOMElementNode
    Dim strmInput As NotesStream
    Dim strmOutput As NotesStream
    On Error Goto errorHandler
    
    Set dbMail = sesCurrent.GetDatabase("","mail\ttripcon.nsf") 'lazy hardcoding...
    Set strmInput = sesCurrent.CreateStream()
    Call strmInput.WriteText("<map />") 'Becomes root node for the output XML
    Set strmOutput = sesCurrent.CreateStream()
    Set dompDesign = sesCurrent.CreateDOMParser(strmInput,strmOutput)
    Call dompDesign.Process()
    Set nodeDocument = dompDesign.Document
    Set nodeRoot = nodeDocument.DocumentElement
    Set nodeDbTitle = nodeDocument.CreateElementNode ("node")
    Call nodeDbTitle.SetAttribute("text",dbMail.Title)
    Call nodeRoot.AppendChild(nodeDbTitle)
    Call AnalyzeElementCategory("Agents")
    Call AnalyzeElementCategory("Folders")
    Call AnalyzeElementCategory("Forms")
    Call AnalyzeElementCategory("Framesets")
    Call AnalyzeElementCategory("Outlines")
    Call AnalyzeElementCategory("Pages")
    Call AnalyzeElementCategory("Script Libraries")
    Call AnalyzeElementCategory("Shared Fields")
    Call AnalyzeElementCategory("Shared Files")
    Call AnalyzeElementCategory("Subforms")
    Call AnalyzeElementCategory("Views")
    Call dompDesign.Serialize()
    
    Print {Content-type: text/plain}
    Let strmOutput.Position = 0
    Print strmOutput.ReadText()
    Exit Sub
errorHandler:
    Print {Error in line } & Erl() & {: } & Error$
    Exit Sub
End Sub

Enjoy...

Comments

Gravatar Image1 - can you post the script Tim? I would like to expand it a bit

Gravatar Image2 - Holy cow...you guys @ Lotus911 are geniuses! That's really cool, Tim! Although I've thought about it, I've never created a mind map for a database design because...well because I'm lazy and didn't want to type it all out. If you are able to do this with code, it could prove to be very valuable.

I find working with mind maps on technology topics helps me get a better understanding of the big picture and visualize connections between elements and concepts that I might not otherwise have seen. Very nice work! I look forward to learning more about Decepticon.

Gravatar Image3 - Sounds like a pretty sweet idea. Using your example link above seems to be throwing a Java error in the applet. ArrayIndexOutOfBounds....

Gravatar Image4 - This is a great idea. Mind Manager 8 includes ODBC support and I've pondered the idea of using NotesSQL to be able to render notes design elements into a mind map. As part of the documentation I usually provide when I re-do an existing application, it usually includes a mind map to show the design, how things are related (kinda messy though) and what things changed. I haven't had any time to play with it yet, but maybe someday I will Emoticon

Gravatar Image5 - Emoticon Emoticon Emoticon Emoticon Emoticon Emoticon

Gravatar Image6 - This is great news. Best of luck for the future and keep up the good work.Emoticon Emoticon Emoticon Emoticon Emoticon Emoticon Emoticon

Gravatar Image7 - Excellent post! I always enjoy a solid technical post (and code) It saved me a good week+ - Keep up the good work!

Gravatar Image8 - When I clicked the link for the mindmap it crashed my Firefox browser. When I restarted Firefox I could reach the link and the mindmap was impressive. Visualisations are always useful.

Gravatar Image9 - You have got a really useful blog I have been here reading for about an hour. I am a newbie and your success is very much an inspiration for me.

Gravatar Image10 - This is a really good read for me. Must admit that you are one of the best bloggers I have ever read. Thanks for posting this informative article.

Gravatar Image11 - Mind Manager 8 includes ODBC support and I've pondered the idea of using NotesSQL to be able to render notes design elements into a mind map. As part of the documentation I usually provide when I re-do an existing application, it usually includes a mind map to show the design [url={ Link } ]Emoticon Emoticon

Gravatar Image12 - Thanks for the information... appreciated... been reading for awhile, and just wanted to let you know I continue to enjoy your writing.

Gravatar Image13 - All these ideas are quite easy to understand and I wonder why I've never thought thus. It's excellent that your blog is full of worthy information for your readers.

Gravatar Image14 - Actually once a database designer is aware of the data which is to be stored within the database, they must then determine where dependency is within the data

Gravatar Image15 - What a nice article ;)

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)