|
@@ -1,6 +1,7 @@
|
|
|
include "primitives.alh"
|
|
|
include "modelling.alh"
|
|
|
include "object_operations.alh"
|
|
|
+include "conformance_scd.alh"
|
|
|
|
|
|
Boolean function main(model : Element):
|
|
|
Element rules
|
|
@@ -13,11 +14,11 @@ Boolean function main(model : Element):
|
|
|
rule = set_pop(rules)
|
|
|
content = print_rule(model, rule)
|
|
|
|
|
|
- file = instantiate_node(model, "Files/file")
|
|
|
+ file = instantiate_node(model, "Files/file", "")
|
|
|
instantiate_attribute(model, file, "name", rule + ".dot")
|
|
|
instantiate_attribute(model, file, "content", content)
|
|
|
|
|
|
- log("File " + rule + ".dot")
|
|
|
+ log("File " + cast_string(list_read(string_split(rule, "/"), 1)) + ".dot")
|
|
|
log(content)
|
|
|
|
|
|
return True!
|
|
@@ -53,7 +54,7 @@ String function print_rule(model : Element, rule : String):
|
|
|
String node
|
|
|
while (set_len(nodes) > 0):
|
|
|
node = set_pop(nodes)
|
|
|
- text = text + "\t" + node + "["
|
|
|
+ text = text + "\t" + string_replace(node, "/", "_") + "["
|
|
|
|
|
|
// Try to add value
|
|
|
if (element_neq(read_attribute(model, node, "value"), read_root())):
|
|
@@ -78,34 +79,39 @@ String function print_rule(model : Element, rule : String):
|
|
|
// Print out all the edges in the rule
|
|
|
String edge
|
|
|
String style
|
|
|
+ String source
|
|
|
+ String destination
|
|
|
while (set_len(edges) > 0):
|
|
|
edge = set_pop(edges)
|
|
|
|
|
|
- type = read_type(model, node)
|
|
|
+ type = read_type(model, edge)
|
|
|
if (type == "Rules/MatchEdge"):
|
|
|
- style = "colour=\"black\""
|
|
|
+ style = "color=\"black\""
|
|
|
elif (type == "Rules/CreateEdge"):
|
|
|
- style = "colour=\"green\", penwidth=4"
|
|
|
+ style = "color=\"green\", penwidth=4"
|
|
|
elif (type == "Rules/DeleteEdge"):
|
|
|
- style = "colour=\"blue\", style=\"dashed\""
|
|
|
+ style = "color=\"blue\", style=\"dashed\""
|
|
|
elif (type == "Rules/NACEdge"):
|
|
|
- style = "colour=\"red\", style=\"dotted\""
|
|
|
+ style = "color=\"red\", style=\"dotted\""
|
|
|
+ else:
|
|
|
+ log("Unknown style for type: " + type)
|
|
|
|
|
|
// Try to add value
|
|
|
+ source = string_replace(readAssociationSource(model, edge), "/", "_")
|
|
|
+ destination = string_replace(readAssociationDestination(model, edge), "/", "_")
|
|
|
+
|
|
|
if (element_neq(read_attribute(model, edge, "value"), read_root())):
|
|
|
// Has a value, so add a label
|
|
|
- text = text + "\t" + readAssociationSource(model, edge) + " -> " + readAssociationDestination(model, edge) + "["
|
|
|
- text = text + style + ", label=\"" + cast_string(read_attribute(model, node, "value")) + "\"]\n"
|
|
|
+ text = text + "\t" + source + " -> " + destination + "["
|
|
|
+ text = text + style + ", label=\"" + cast_string(read_attribute(model, edge, "value")) + "\"]\n"
|
|
|
elif (set_len(allOutgoingAssociationInstances(model, edge, "")) > 0):
|
|
|
- // Has no value, and we have outgoing edges ourself, so we should have a node handle
|
|
|
+ // Has no value, and we have outgoing edges ourself, so we should have an edge handle
|
|
|
text = text + "\t" + edge + "[width=0]\n"
|
|
|
- text = text + "\t" + readAssociationSource(model, edge) + " -> " + edge + "[" + style + ", arrowhead=\"none\"]"
|
|
|
- text = text + "\t" + edge + " -> " + readAssociationDestination(model, edge) + "[" + style + "]\n"
|
|
|
+ text = text + "\t" + source + " -> " + edge + "[" + style + ", arrowhead=\"none\"]"
|
|
|
+ text = text + "\t" + edge + " -> " + destination + "[" + style + "]\n"
|
|
|
else:
|
|
|
// Has no value, meaning that we are referring to an intermediate edge...
|
|
|
- text = text + "\t" + readAssociationSource(model, edge) + " -> " + readAssociationDestination(model, edge) + "[" + style + "]\n"
|
|
|
-
|
|
|
- text = text + "]\n"
|
|
|
+ text = text + "\t" + source + " -> " + destination + "[" + style + "]\n"
|
|
|
|
|
|
// Close everything
|
|
|
text = text + "}"
|