diff --git a/default.csv b/default.csv index 2a0586d..760d4a1 100644 --- a/default.csv +++ b/default.csv @@ -4,17 +4,31 @@ Dynamic Modeller was created by Joseph Padfield object|actor Dynamic Modeller is based on https://mermaid-js.github.io/mermaid Dynamic Modeller designed to "Allow users to create modelling flow-diagrams from simple lists of triples" Dynamic Modeller works with Triples +Dynamic Modeller can use Subgraphs // Comments can be added simply by starting a line with // or ## +//subgraph Example Subgraph Title +Subgraphs are Grouped sections of a graph +Subgraphs has comment "Subgraph are started by adding a special comment before the relevant triples - //Subgraph GROUP TITLE " +Subgraphs has comment "Subgraph are ended by adding a special comment after the relevant triples - //end" +Subgraphs can be nested as Sub-Subgraphs +//subgraph Example Sub-Subgraph Title +Sub-Subgraphs has comment "Care needs to be taken to make sure which Subgraph nodes appear in, but it is possible to created nested sub-subgraphs simply by starting a new subgraph inside another one." +//end +//end Triples are Tab separated Triples have some "Basic automatic formatting, but it is possible to force some further options using additional instructions after the third value in a given triple" Triples format examples https://research.ng-london.org.uk/modelling/?example=example_formats Dynamic Modeller can also "Start with data formatted as JSON, which is then automatically converted to Triples, please check the triples and report any errors in the conversion" // Blank node can be added as shown -Dynamic Modeller carries out _BN object|event_bn -_BN has type Production -_BN produces Flow-diagrams +_BN has type Production event_bn| +_BN are allocated "An automatic number each time the 'has type' property is used, so multiple _BN can be added to the list of triples and they will processed. All other properties will be allocated to the current _BN until a new 'has type' property is called." +Dynamic Modeller carries out _BN +_BN produces Flow-diagrams |thing Flow-diagrams can be saved by "Copying the triples and saving them as a text file." Flow-diagrams can be saved by "Bookmarking or copying the URL under the Bookmark Link options, under the Links menu, after an update." Flow-diagrams can be saved by Saving an image |event Saving an image has comment "Following the link under the Get Image link, under the Links menu, and using the options provided." Saving an image is achieved using the https://mermaid-js.github.io/mermaid-live-editor +_BN has type Author actor_bn| +_BN has comment "New Blank Nodes, or any other entities can refer back to a previous Blank Node by adding a suffix to indicate how many Blank Nodes back one wants to refer to, i.e. the previous blank node would be referenced as '_BN-1' and the one before that would be '_BN-2' and so on." +_BN assigned _BN-1 diff --git a/index.php b/index.php index ccb5700..2e2dfbf 100644 --- a/index.php +++ b/index.php @@ -475,8 +475,14 @@ function getRaw($data) if(preg_match("/^[\/][\/][ ]Model[:][\s]*([a-zA-Z0-9 ]+)[\s]*[\/][\/](.+)$/", $line, $m)) {$output[$tag]["comment"] = $m[2];} - else if(preg_match("/^[\/][\/][ ]*[gG]raph[ ]*([LT][BR])(.*)$/", $line, $m)) - {$orientation = $m[1];} + else if((preg_match("/^[\/][\/][ ]*[gG]raph[ ]*([LT][BR])(.*)$/", $line, $m)) or + (preg_match("/^[\/][\/][ ]*[gG]raph[ ]*([LT][BR])(.*)$/", $trip[0], $m))) + {$orientation = $m[1]; + $trip = array($line);} + else if(preg_match("/^[\/][\/][ ]*[sS][uU][bB][gG][Rr][Aa][Pp][Hh[ ]*(.*)$/", $line, $m)) + {$trip = array("subgraph", $m[1], "");} + else if(preg_match("/^[\/][\/][ ]*[eE][nN][dD][ ]*(.*)$/", $line, $m)) + {$trip = array("end", "", "");} // ignore lines that are commented out else if(preg_match("/^[\/#][\/#].*$/", $line, $m)) {$trip = array($line);} @@ -599,6 +605,10 @@ function Mermaid_formatData ($selected) foreach ($selected["triples"] as $k => $t) { + if (in_array($t[0], array("subgraph", "end"))) + {$defs .= "\n$t[0] $t[1]\n";} + else + { // Format the displayed text, either wrapping or removing numbers // used to indicate separate instances of the same text/name if (count_chars($t[2]) > 60) @@ -609,7 +619,10 @@ function Mermaid_formatData ($selected) // If entities have been numbered to force them to be unique // hide the number from being displayed foreach ($au as $pk => $pr) - {if(preg_match("/^(${pr})[-][0-9]+$/", $use, $m)) + {if(preg_match("/^(.+)[#][-][0-9]+$/", $use, $m)) + {$use = $m[1]; + break 1;} + else if(preg_match("/^(${pr})[-][0-9]+$/", $use, $m)) {$use = $m[1]; break 1;}} @@ -664,6 +677,7 @@ function Mermaid_formatData ($selected) $defs .= $things[$t[0]]." -- ".$t[1]. " -->".$things[$t[2]]. "[\"".$use."\"]\n"; + } } $defs = "graph $orientation\n".