This module provides predicates to load .dia files containing
UML diagrams and make queries against it and/or save the data
contained in the form of prolog-source files.
Example
load_diagram('Diagram.dia'). % Load the diagram
import_facts. % Tell prolog to work directly on the
% data - see import_facts/1.
class_name(X, 'Class'). % A Query
Example using a module:
load_diagram('Diagram.dia'). % Load the diagram
assert_facts(diagram, [export]). % Assert all facts into module
% 'diagram' and mark them as exports.
diagram:association(A). % A Query to the asserted data.
import_facts(diagram). % Delegate queries to the diagram-module
class_operation(Class, Op) % Queries can now be made without prefix
Example writing to a file
load_diagrams(['diagram1.dia','diagram2.dia']). % Load two diagrams
write_facts('d.pl'). % Write all facts to d.pl
write_facts('mod.pl',[module, export]). % Like above but
% generates a module and exports
% the facts
- author
- - Heiko Lewin
- license
- - GPL
- To be done
- -
- A package_contains predicate
- Constraints on relationships
- Compressed diagrams
- NOTES
- This works with official dia-releases (at least with 0.97.2 as
avaiable from http://live.gnome.org/Dia ) but contains some query
predicates official dia-releases have no diagram elements (yet) that
correspond to them (branch-names, association-stereotypes and the
containment-relation ). These are defined here as those are more or
less part of the UML-standard and likely to be in one of the next
dia-releases.
- Though exporting any rules or facts for querying
diagram data directly may seem clumsy this way clauses holding the
diagram data can be merged into the user-module from different source
modules and be worked with there without name-clashes.
- This does not really follow the UML- or XMI-standards in how
diagram data is represented but is close to the layout of dia-files.
- This currently only works with SWI-Prolog without further
extensions when it comes down to free software. GNU-Prolog is
missing a xml-parser and the code_type/2 relation. This has not
been tested with commerical Prolog-systems.
- predicates_list(-List)
- load_diagrams(+ListOfFiles:list)
- load_diagram(+FileSpec)
- close_diagram(+FileSpec)
- close_diagrams(+ListOfFiles)
- close_all_diagrams
- clauses(-List)
- write_facts(+FileSpec, +Options)
- write_facts(+FileSpec)
- write_facts
- erase_facts(+ModuleIdentifier)
- assert_facts(+ModuleIdentifier, Options)
- assert_facts(Module)
- assert_facts
- import_facts(Module)
- import_facts
- copy_facts(+ListOfModules, +DestinationModule)
- import_diagram(+FileSpec)