forked from Darth-Neo/ArchiConcepts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
al_GraphConcepts.py
57 lines (35 loc) · 1.14 KB
/
al_GraphConcepts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python
#
# Natural Language Processing of Archimate Information
#
__author__ = u'morrj140'
__VERSION__ = u'0.3'
import os
from Logger import *
logger = setupLogging(__name__)
logger.setLevel(INFO)
from nl_lib.Concepts import Concepts
from nl_lib.ConceptGraph import PatternGraph, GraphVizGraph, NetworkXGraph
from al_lib.Constants import *
from al_lib.ArchiLib import ArchiLib
def graphConcepts(conceptFile):
start_time = ArchiLib.startTimer()
concepts = Concepts.loadConcepts(conceptFile)
# concepts.logConcepts()
# graph = PatternGraph()
graph = GraphVizGraph()
# graph = NetworkXGraph(conceptFile[:-2]+u".png")
graph.addGraphNodes(concepts)
graph.addGraphEdges(concepts)
if isinstance(graph, NetworkXGraph):
graph.saveJSON(concepts)
if isinstance(graph, GraphVizGraph):
graph.exportGraph()
if isinstance(graph, PatternGraph):
graph.exportGraph()
ArchiLib.stopTimer(start_time)
if __name__ == u"__main__":
logger.info(u"%s" % os.getcwd())
# os.chdir(u"." + os.sep + u"run")
conceptFile = os.getcwd() + os.sep + u"archi.p"
graphConcepts(conceptFile)