Site icon bVisual

Creating Visio Validation Rules for Graph Database template

Having developed Node and Edge/ Dynamic connector masters shapes for creating Node and Edge table entries for a SQL Server 2017, I decided that I should write some validation rules. The validation feature has been in Visio since the 2010 edition, but is underused, even though I wrote a book about them … see  Microsoft Visio 2013 Business Process Diagramming and Validation . I think that only six rules are necessary to validate that a page with Node and Edge shapes is well constructed before attempting to update the tables in SQL Server, or any other GraphDatabase.

A sample rule for Graph DB in Visio
1 / 6

In the above screenshots, I have presented an issue for each rule. The panel on the right Follow the link earlier to read more.
Most of these rules are possible because I ensured that the Node shapes have the category “GraphNode“, and the Edge shapes have the category “GraphEdge“. This allows for testing of the relevant shapes using the HASCATEGORY() function. Some rules are for checking that shapes are correctly connected – basically a Node shape must be connected to another Node shape (or itself) with an Edge shape. The other rules are checking that required Shape Data row values have been entered.
That’s it, so why are Visio validation rules not being used more?
Here are the rules in full:

ID1
NameUUngluedConnector
CategoryConnectivity
DescriptionEdge connector shape is not glued to a Node shape at each end.
RuleTargetShape
RuleFilterHASCATEGORY(“GraphEdge”)
RuleTestAGGCOUNT(FILTERSET(GLUEDSHAPES(3),
“HASCATEGORY(“”GraphNode””)”))=2
ID2
NameUTooFewConns
CategoryConnectivity
DescriptionEach Node shape should have at least one Edge shape connection.
RuleTargetShape
RuleFilterHASCATEGORY(“GraphNode”)
RuleTestNOT(AGGCOUNT(FILTERSET(GLUEDSHAPES(1),
“HASCATEGORY(“”GraphEdge””)”))+
AGGCOUNT(FILTERSET(GLUEDSHAPES(2),
“HASCATEGORY(“”GraphEdge””)”))) = 0
ID3
NameUNoNodeValue
CategoryData
DescriptionEach Node shape should have a Node value
RuleTargetShape
RuleFilterHASCATEGORY(“GraphNode”)
RuleTestAND(NOT(STRSAME(Prop.Node, “”)),
NOT(STRSAME(Prop.Node, “<node>”)))
ID4
NameUNoEdgeValue
CategoryData
DescriptionEach Edge shape should have an Edge value
RuleTargetShape
RuleFilterHASCATEGORY(“GraphEdge”)
RuleTestAND(NOT(STRSAME(Prop.Edge, “”)),
NOT(STRSAME(Prop.Edge, “<edge>”)))
ID5
NameUNoNameValue
CategoryData
DescriptionEach Node shape should have a Name value
RuleTargetShape
RuleFilterHASCATEGORY(“GraphNode”)
RuleTestAND(NOT(STRSAME(Prop.Name, “”)),
NOT(STRSAME(Prop.Name, “<name>”)))
ID6
NameUBadNodeConnect
CategoryConnectivity
DescriptionNode shapes must only be glued to Edge shapes
RuleTargetShape
RuleFilterHASCATEGORY(“GraphNode”)
RuleTestAGGCOUNT(FILTERSET(GLUEDSHAPES(1),
“NOT(HASCATEGORY(“”GraphEdge””))”))+
AGGCOUNT(FILTERSET(GLUEDSHAPES(2),
“NOT(HASCATEGORY(“”GraphEdge””))”)) = 0

Useful links:
Introduction to Validation Rules in Visio Premium 2010
The Diagram Validation API
Dissecting the Process Flowchart Validation Rules
Writing rules to validate diagrams in Visio 2010 – A worked example
Other articles in this series:
Using #Visio and #PowerBI with #GraphDatabase in #SQLServer
Using #Visio and #PowerBI with #GraphDatabase in #SQLServer – Part 2
Using #JSON text in #Visio shapes

Exit mobile version