Difference between revisions of "Template:Edge"
(Created page with "<noinclude> This template, for use on edge kind pages, takes in a short description of this edge, and a list of the kinds of connections this edge can form (the predecessor n...") |
|||
Line 34: | Line 34: | ||
First, generate the necessary table: | First, generate the necessary table: | ||
− | Notes: the hairiest thing going on here is replacing asterisks with heavy asterisks | + | Notes: the hairiest thing going on here is replacing asterisks with heavy asterisks, which we do for two reasons: they're centered better (meaning we don't get the awkward look of *->*, with the stars too high), and they |
--></noinclude>{{Metaclass | --></noinclude>{{Metaclass | ||
Line 43: | Line 43: | ||
! Predecessor !! Multiplicity !! Successor | ! Predecessor !! Multiplicity !! Successor | ||
|- | |- | ||
− | |{{#arraymap:{{{connects|Node Kind,Node Kind,1,*;Node Kind,Node Kind,*,1}}}| ; | PredSuccMult | [[{{#explode:PredSuccMult|,|0}}]] {{!}}{{!}} {{ | + | |{{#arraymap:{{{connects|Node Kind,Node Kind,1,*;Node Kind,Node Kind,*,1}}}| ; | PredSuccMult | [[{{#explode:PredSuccMult|,|0}}]] {{!}}{{!}} {{#ifeq:*|{{#explode:PredSuccMult|,|2}}|✱|{{#explode:PredSuccMult|,|2}}}}➞{{#ifeq:*|{{#explode:PredSuccMult|,|3}}|✱|{{#explode:PredSuccMult|,|3}}}} {{!}}{{!}} [[{{#explode:PredSuccMult|,|1}}]] | \n{{!}}-\n{{!}}}} |
− | |} | + | |} |
+ | <noinclude><!-- | ||
Property-only additions: | Property-only additions: | ||
Knowing only the edge type, we want to be able to discover all connection types, with both | Knowing only the edge type, we want to be able to discover all connection types, with both | ||
--></noinclude> | --></noinclude> |
Revision as of 16:22, 24 March 2014
This template, for use on edge kind pages, takes in a short description of this edge, and a list of the kinds of connections this edge can form (the predecessor node kind, successor node kind, and multiplicities at each end), and stores that information in properties so it can be retrieved by knowing either the edge kind, the predecessor kind, or the successor kind, using a single query.
It also produces a table summarizing this information.
For example, this is the template call that would be used on a page "Edge" to indicate that "Edge" is an edge kind, that connects either a "Foo" node kind to a "Bar" node kind, or to a "Baz" node kind, with each "Bar" node being associated with exactly one "Foo" node, and each "Baz" node optionally being associated with exactly one "Foo" node:
{{Edge | description = Connects a Foo to a Bar or a Baz | connects = Foo,Bar,1,*;Foo,Baz,0..1,* }}
The visible output of this will be a metaclass table describing the edge, plus a table summarizing the connections:
Metaclass | Edge |
---|---|
Description | Connects a Foo to a Bar or a Baz |
Predecessor | Multiplicity | Successor |
---|---|---|
Foo | 1➞✱ | Bar |
Foo | 0..1➞✱ | Baz |
In addition, the following properties will be created:
Metaclass | Edge |
---|---|
Description | {{{description}}} |
Predecessor | Multiplicity | Successor |
---|---|---|
Node Kind | 1➞✱ | Node Kind |
Node Kind | ✱➞1 | Node Kind |