pyrites/haskell-experiments/notes/NaiveDatabase_classes.dot

68 lines
2.7 KiB
Plaintext
Raw Normal View History

digraph NaiveDatabase {
rankdir=TB;
node [shape=record, fontname="Helvetica", fontsize=10];
edge [fontname="Helvetica", fontsize=9];
// Main database
NaiveDatabase [label="{NaiveDatabase|relations : Map RelationId Relation\lconstants : Set Constant\l}"];
// Core data types
Relation [label="{Relation|_name : Text\l_arity : Int\l_tuples : Set [Constant]\l_rules : [RelationRule]\l}"];
RelationRule [label="{RelationRule|headVariables : [Text]\lbody : [(Relation, [RuleElement])]\l}"];
RuleElement [label="{RuleElement|RuleElementConstant Constant\l| RuleElementVariable Text\l}"];
// Constraint types (used during rule processing)
ConstraintElement [label="{ConstraintElement|ConstraintElementConstant Constant\l| ConstraintElementIndex Int\l}"];
BodyConstraint [label="{BodyConstraint|_relation : Relation\l_elements : [ConstraintElement]\l}"];
RuleContext [label="{RuleContext|__relation : Relation\l_headVariables : [RuleElement]\l_bodyConstraints : [BodyConstraint]\l_db : NaiveDatabase\l}"];
// Type aliases (shown as notes)
TypeAliases [shape=note, label="Type Aliases\l\lConstant = Term\lRelationId = Text\l"];
// Value type (standalone)
Value [label="{Value|ValueInt Int\l| ValueSymbol String\l}"];
// Exception type
NaiveDatabaseException [label="{NaiveDatabaseException|CannotParseStatementException\l| NonFactException\l| NonRuleException\l| NonQueryException\l| BadArityException\l| VariableLookupException\l| UnexpectedConstantException\l}"];
// Relationships
NaiveDatabase -> Relation [label="contains *", style=solid];
Relation -> RelationRule [label="has *", style=solid];
RelationRule -> Relation [label="references *", style=dashed];
RelationRule -> RuleElement [label="contains *", style=solid];
BodyConstraint -> Relation [label="references", style=dashed];
BodyConstraint -> ConstraintElement [label="contains *", style=solid];
RuleContext -> Relation [label="references", style=dashed];
RuleContext -> RuleElement [label="contains *", style=solid];
RuleContext -> BodyConstraint [label="contains *", style=solid];
RuleContext -> NaiveDatabase [label="references", style=dashed];
// Grouping
subgraph cluster_core {
label="Core Types";
style=rounded;
color=blue;
NaiveDatabase; Relation; RelationRule; RuleElement;
}
subgraph cluster_processing {
label="Rule Processing";
style=rounded;
color=green;
RuleContext; BodyConstraint; ConstraintElement;
}
subgraph cluster_other {
label="Other";
style=rounded;
color=gray;
Value; NaiveDatabaseException; TypeAliases;
}
}