0

I want to build a DGML with custom tags by getting data from SQL table.

The table:

UCId    UCPre                           UCPost                          UCNext
-----------------------------------------------------------------------------------------------
UC01    User must be Registerd          User is Loggined sucessfully    UC02    
UC02    User is Loggined sucessfully    User is added                   UC03    
UC03    File must be selected           File is added                   NULL    
UC04    File is added                   File is deleted                 NULL  
UC05    User is Loggined sucessfully    User is deleted                 NULL    

I want the xml with following tags in nodes I want to read UCId from UCID column and UCNext column

<?xml version="1.0" encoding="utf-8"?>
<DirectedGraph Title="TestT" xmlns="http://schemas.microsoft.com/vs/2009/dgml">
  <Nodes>
    <Node Id="UC01"  Label="UC01" />
    <Node Id="UC02"  Label="UC02" />
    <Node Id="UC03"  Label="UC03" />
  </Nodes>

I want to make links between nodes on the basis of above data in tabel as UC01 the Next state is UC02 .How can i set this by coding so that correct links are created between nodes

  <Links>
    <Link Source="UC01" Target="UC02"  Label="1"/>
    <Link Source="UC02" Target="UC03" Label="2" />
  </Links>
  <Properties>
    <Property Id="Background" Label="Background" Description="The background color" DataType="System.Windows.Media.Brush" />
    <Property Id="Bounds" DataType="System.Windows.Rect" />
    <Property Id="Label" Label="Label" Description="Displayable label of an Annotatable object" DataType="System.String" />
    <Property Id="LabelBounds" DataType="System.Windows.Rect" />
    <Property Id="Stroke" DataType="System.Windows.Media.Brush" />
    <Property Id="Title" DataType="System.String" />
    <Property Id="UseManualLocation" DataType="System.Boolean" />
  </Properties>
</DirectedGraph>

How can I do this by c# or java please help?

1 Answers1

0

Please refer to this code sample: https://gist.github.com/azukipochette/4644291

Step 1: loop through all records to create nodes.

Step 2: loop through all records again to create links (find pairs of nodes created in step 1 by label).

Den
  • 1,659
  • 3
  • 22
  • 42