.NET Framework Developer Center > .NET Development Forums > Microsoft SQL Server Modeling > Quadrant: Applying the Diagram View for a custom model
Ask a questionAsk a question
 

AnswerQuadrant: Applying the Diagram View for a custom model

  • Sunday, June 07, 2009 7:31 PMslyVx Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have had a deeper look at Quadrant's extensibility recently and delved into the Quadrant database to find out how Quadrant is configured from the tables.

    As a example, I wrote my own model using M and deployed it to the repository to access it with Quadrant.

    My goal was to have a simpel model similar to those seen in Microsoft.Samples.Process.Processes and author the model in the diagram view of Quadrant.

    Basically I have three entity types:  children nodes which can be connected through connections where both the nodes and the connections have a reference to one  parent node .

    These models are accordant to (some of) the models found Microsoft.Samples.Process.Processes where we have:

    - Activities as the children nodes
    - Links as the connections
    - a Process as the parent node

    I was hoping that I can access my own model with the diagram viewer in the same way as you can do it with the examples shipping with Oslo (e.g. the HR Hire Review process). Meaning that you can connect the nodes via lines/arrows, add or delete new nodes with the contextual menu and so on.

    Somehow I was hoping that Quadrant would magically understand my model when I switch to the Diagram View and deliver me the same modeling experience as for the Microsoft.Samples.Process.Processes models :)
    Unfortunately, it did not: the diagram view shows my connections as nodes instead of lines, and there's no possibility to add or delete nodes/links.

    I was kinda expecting this since I guess that Quadrant needs some additional metadata helping to present the models in a decent way.
    Therefore, I examined the database tables in order to find out which information Quadrant needs to present the models in the diagram view properly.

    I found the following tables to be a key place for the configuration of the Diagram Viewer:

    Quadrant.SchemaExtensions.GraphHintCatalogTypes   which references

    Quadrant.SchemaExtensions.GraphHints which references

    Quadrant.Query.Queries

    GraphHintCatalogTypes indicates which schemas/types have a GraphHint that tells Quadrant how to present the models in the Diagram Viewer.
    GraphHints references queries for the several elements in a Diagram Viewer (e.g. NodesQuery, EdgesQuery).
    These queries are VB LINQ statements stored in the table Quries .

    As a consequence, I tried to create my own GraphHints for my model. I did that by taking the existing queries used for Microsoft.Samples.Process.Processes and adapting them to fit my model. I had some little access, well, at least I could see that my GraphHints where actually used by Quadrant in the way that the Diagram Viewer looked different than before (though not quite want I wanted).


    Before I go deeper in the detail of my model and the GraphHints I used, I want to ask some general questions:

    Am I on the right track?
    Is it correct that each model needs its own GraphHint to be presented 'properly' in the Diagram Viewer (properly in terms that it makes sense for the user)?
    Do you need to write every LINQ query needed for the GraphHints by yourself (this is very tedious and error prone), or is there a way to generate them based on some simple parameters (like the database name of the nodes, links etc.)?
    What will the extensibility experience in Quadrant look like in future (Manipulating the raw data in the database is cumbersome).


    Thank you for reading this post so far! Please correct me if I'm wrong in anything I wrote.

    • Edited byslyVx Sunday, June 07, 2009 7:35 PM
    • Edited byslyVx Sunday, June 07, 2009 7:36 PM
    • Edited byslyVx Sunday, June 07, 2009 7:38 PM
    •  

Answers

  • Monday, June 08, 2009 5:38 PMAndrew PilleyMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Before I go deeper in the detail of my model and the GraphHints I used, I want to ask some general questions:

    Am I on the right track?
    Is it correct that each model needs its own GraphHint to be presented 'properly' in the Diagram Viewer (properly in terms that it makes sense for the user)?
    Do you need to write every LINQ query needed for the GraphHints by yourself (this is very tedious and error prone), or is there a way to generate them based on some simple parameters (like the database name of the nodes, links etc.)?
    What will the extensibility experience in Quadrant look like in future (Manipulating the raw data in the database is cumbersome).


    Thank you for reading this post so far! Please correct me if I'm wrong in anything I wrote.


    Hey SlyVx,

    You're more or less on the right track. The Quadrant Diagramming experience is still fairly rough at this time, and we're not 100% sure on what direction we'll be taking it just yet, so it's definitely subject to change.
    The graphhints you're looking at are the way to define how a model is represented as a diagram, other than the default.
    Otherwise, the entity you view as a diagram will just have its relationships viewed as children, since that's the only real assumption that Quadrant can make about the data it sees. (there are some things you definitely don't want to try to view as a diagram, simply because it'll create thousands of nodes!)
    These are essentially the same items that show up in the 'References' section in a Properties view for that entity.

    GraphHints (Node and ConnectorHints) define how the boxes and lines match up. There are other ConstructorHints, DestructorHints and other schemas that govern how items are created/deleted/etc but the experience is very rough right now, and it's probably fairly tedious as a result, and there's no way to generate them yet.


    I'll have to let someone else comment on how the extensibility of Quadrant will change in the future, but it's reasonable to assume that it will be changing.

    That said, I do know that right now, the ideal way of authoring these kinds of extensions is probably by using M instances against the Quadrant schemas. I believe we've got a few basic tutorials on that up in MSDN already (which you've probably seen, for setting display names, icons, etc). I don't believe we've documented any of the more complex schemas yet, but there may be more dicussion about it in the future on the msdn site for Oslo.

    Andrew

All Replies

  • Monday, June 08, 2009 5:38 PMAndrew PilleyMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Before I go deeper in the detail of my model and the GraphHints I used, I want to ask some general questions:

    Am I on the right track?
    Is it correct that each model needs its own GraphHint to be presented 'properly' in the Diagram Viewer (properly in terms that it makes sense for the user)?
    Do you need to write every LINQ query needed for the GraphHints by yourself (this is very tedious and error prone), or is there a way to generate them based on some simple parameters (like the database name of the nodes, links etc.)?
    What will the extensibility experience in Quadrant look like in future (Manipulating the raw data in the database is cumbersome).


    Thank you for reading this post so far! Please correct me if I'm wrong in anything I wrote.


    Hey SlyVx,

    You're more or less on the right track. The Quadrant Diagramming experience is still fairly rough at this time, and we're not 100% sure on what direction we'll be taking it just yet, so it's definitely subject to change.
    The graphhints you're looking at are the way to define how a model is represented as a diagram, other than the default.
    Otherwise, the entity you view as a diagram will just have its relationships viewed as children, since that's the only real assumption that Quadrant can make about the data it sees. (there are some things you definitely don't want to try to view as a diagram, simply because it'll create thousands of nodes!)
    These are essentially the same items that show up in the 'References' section in a Properties view for that entity.

    GraphHints (Node and ConnectorHints) define how the boxes and lines match up. There are other ConstructorHints, DestructorHints and other schemas that govern how items are created/deleted/etc but the experience is very rough right now, and it's probably fairly tedious as a result, and there's no way to generate them yet.


    I'll have to let someone else comment on how the extensibility of Quadrant will change in the future, but it's reasonable to assume that it will be changing.

    That said, I do know that right now, the ideal way of authoring these kinds of extensions is probably by using M instances against the Quadrant schemas. I believe we've got a few basic tutorials on that up in MSDN already (which you've probably seen, for setting display names, icons, etc). I don't believe we've documented any of the more complex schemas yet, but there may be more dicussion about it in the future on the msdn site for Oslo.

    Andrew
  • Sunday, June 14, 2009 5:31 PMslyVx Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Andrew,

    you're explanation about the meaning of hints in Quadrant is pretty much what I've thought about it :)
    I believe we've got a few basic tutorials on that up in MSDN already (which you've probably seen, for setting display names, icons, etc). I don't believe we've documented any of the more complex schemas yet, but there may be more dicussion about it in the future on the msdn site for Oslo.
    yes, I have seen this tutorial about adding icons, etc. It gives you a goog idea how to add a (simple) custom Hint in general.


    As for the Diagram Viewer: I understand that it's probably still too early to get some definite answers, but maybe you can sketch it out a bit for me:

    All process, workflow or whatever models which I want to visualize with the Diagram Viewer have to be actually prepared for it, by creating GraphHints with the neccessary queries etc.
    I asumme in the future there will be some kind of graphical user interface to easily determine the way my model should be presented in the Diagram Viewer, right?
    I cannot imagine that a non-technical person like a business analyst likes to get in touch with VB code and database queries :)




  • Monday, June 15, 2009 4:08 PMslyVx Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    If it's ok, I'd like to get a bit more in detail. I'm having a problem with some of those queries, namely the "NodesQuery" of the "DiagramGalleryHint".

    I would really appreciate if someone from the Oslo team could try to reproduce the problem I encounter. I've spent hours trying to find out what's going on, without success.

    I was trying to get a custom NodesQuery to work. Because it didn't work, I thought it was a good idea to play around with some of the NodesQuery that ship with Quadrant.
    As a result, I could reduce the problem to the following scenario:

    1) go to table [Quadrant.Query.Queries] and locate the row with Id=28 (which is the NodesQuery of the DiagramGalleryHint for the Microsoft.Samples.Processes.Process model)
    2) Backup the query string of this row.
    3) Replace the query with an arbitrary string, e.g. "xxx"
    4) Restart Quadrant
    5) Open any Microsoft.Samples.Processes.Process model
    6) Within the diagram view, right click to get the context menu
    7) In the context menu,  there are no nodes (UserTasks, Decisions...) anymore for selection: that's ok because we just deleted them (i.e the appropriate query)
    8) go back to [Quadrant.Query.Quries] and restore the original query string
    9) Restart Quadrant
    10) As soon as we right click in the diagram view of our model, Quadrant freezes -> that's not ok because we restored the original, correct query!

    ???

    I know this sounds stupid. I have no explanation for it. This problem occurs only with the NodesQuery and not with the EdgeQuery of the DiagramGalleryHint.

    I would be happy if someone coud confirm me that this is a bug and not because of me :)
  • Wednesday, June 17, 2009 10:32 PMAndrew PilleyMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hey SlyVx,

    Sorry I've taken so long to get back to you on this issue. I'm not seeing the behavior you describe (Quadrant hanging) with the CTP or newer builds here. The gallery disappears as I expect it to when the query is broken, and reappears once I restore the query, regardless of whether I restart Quadrant or not, I'm not sure why it's freezing for you. Does Quadrant ever unfreeze?


    However, I can't promise that we'll be able to provide any more detail on the diagramming features at this time. Diagramming, like a lot of Quadrant's features, is a feature in progress, and potentially subject to extensive change. Unfortunately, diagramming touches on some of the more complex areas of Quadrant's internal infrastructure, and documenting that raises a large amount of technical detail.

    I definitely like your idea of a GUI diagram configuration system, however, this is a very complex area, and dependent heavily on the model being viewed in the diagram. The trick would be building a configuration system that didn't limit the models you could view, or wasn't too simplistic to be useful.

    However, I'll raise it within the team as something we need to address going forward for the usability of Quadrant. Improving the complexity issues for the queries is another area I'll pass along for consideration.
  • Thursday, June 18, 2009 10:08 AMslyVx Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Alright, thank you so far!
    I'm not seeing the behavior you describe (Quadrant hanging) with the CTP or newer builds here. The gallery disappears as I expect it to when the query is broken, and reappears once I restore the query, regardless of whether I restart Quadrant or not, I'm not sure why it's freezing for you. Does Quadrant ever unfreeze?

    No, it does not unfreeze. Well, I never really waited longer than 1 minute or so, then I would just terminate the process.
    It's good to hear that it's working for you though. This means that it is not some bug/limitation. There must be something wrong with my config, though I don't know what.

    By the way, do you have to restart Quadrant necessarily in order to apply changes in the quadrant database? Because it turns out that, I have to.
    I definitely like your idea of a GUI diagram configuration system, however, this is a very complex area, and dependent heavily on the model being viewed in the diagram. The trick would be building a configuration system that didn't limit the models you could view, or wasn't too simplistic to be useful.
    I like the idea of developing your own visual DSL in Quadrant, the ability to create your custom diagram editor for your specific domain. Personally, I think it's the most important part of Quadrant; that's why I'm so ambitious about it. ;)
  • Thursday, June 18, 2009 7:44 PMAndrew PilleyMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    By the way, do you have to restart Quadrant necessarily in order to apply changes in the quadrant database? Because it turns out that, I have to.
    I definitely like your idea of a GUI diagram configuration system, however, this is a very complex area, and dependent heavily on the model being viewed in the diagram. The trick would be building a configuration system that didn't limit the models you could view, or wasn't too simplistic to be useful.
    I like the idea of developing your own visual DSL in Quadrant, the ability to create your custom diagram editor for your specific domain. Personally, I think it's the most important part of Quadrant; that's why I'm so ambitious about it. ;)
    Generally, restarting Quadrant to get it to reread configurations is only necessary if you make the change from outside of Quadrant (EG, importing M into the Quadrant configuration database). The Quadrant dataflow engine will inform anything that's using a query if it gets updated from inside Quadrant.
  • Saturday, June 20, 2009 4:27 PMslyVx Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I just want to let you know that is working now! I finally was able to create a diagram view for my custom model.

    This is what I did:

    1) Completely reinstalled Oslo to make sure I have a clean database configuration (I'm not sure if this step was necessary, but anyways...)
    2) Took a very close look at the queries and found out that there seems to be something wrong with the line feed format. I figured out that, whenever I created a new query with some editor and added it to the database by copying the query 1:1, the format would get broken. In order to fix this, I converted every query to the Linux/Unix(LF) format before I actually added it to the database.

    I'm now trying to change some visual and behavior stuff in my diagram view.
    What really annoys me is that every time I add a new node to the graph, the diagram's window height gets very very huge, and the node gets placed at the very bottom. Which means I have to scroll down to the bottom and move the new node all the way up, which takes like minutes...


    This is not happening in the diagram view configured for the process Sample Models. Where can I change this behavior?
  • Monday, June 22, 2009 11:00 PMAndrew PilleyMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I just want to let you know that is working now! I finally was able to create a diagram view for my custom model.

    This is what I did:

    1) Completely reinstalled Oslo to make sure I have a clean database configuration (I'm not sure if this step was necessary, but anyways...)
    2) Took a very close look at the queries and found out that there seems to be something wrong with the line feed format. I figured out that, whenever I created a new query with some editor and added it to the database by copying the query 1:1, the format would get broken. In order to fix this, I converted every query to the Linux/Unix(LF) format before I actually added it to the database.

    I'm now trying to change some visual and behavior stuff in my diagram view.
    What really annoys me is that every time I add a new node to the graph, the diagram's window height gets very very huge, and the node gets placed at the very bottom. Which means I have to scroll down to the bottom and move the new node all the way up, which takes like minutes...


    This is not happening in the diagram view configured for the process Sample Models. Where can I change this behavior?
    Hm. This isn't behavior I would have expected. Is this while dragging a shape out of your gallery into the current diagram? Or are you adding them item via some other view?

    My only guess is that the diagram viewer isn't expecting the item to show up, but it's strange that it's making the diagram huge. Ordinarily, if an item appears when the diagram viewer isn't expecting it, it should add itself in the bottom left corner, without making anything bigger. I'll poke a few people.

    Can you tell me what types of queries you have created, and how you're adding the shape?
  • Tuesday, June 30, 2009 9:01 AMslyVx Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,
    I'm not sure, but if I remember corretly, I had this behavior also for the process diagram view sometime (for the Microsoft.Samples.Process model)


    Is this while dragging a shape out of your gallery into the current diagram? Or are you adding them item via some other view?

    Out of the gallery, in the diagram view.


    Can you tell me what types of queries you have created, and how you're adding the shape?

    I might do this soon, if I take time :)
    • Edited byslyVx Tuesday, June 30, 2009 9:03 AM
    • Edited byslyVx Tuesday, June 30, 2009 9:03 AM
    •