-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRDFtoGraphs.py
29 lines (18 loc) · 905 Bytes
/
RDFtoGraphs.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
#!/usr/bin/python2.7
import tdag
from tdag import rdfGraph, Namespace, RDF, tdag, conflate, process_template, prettyName
from tdag import simUI_d, get_distances, to_nex, draw_graphs, full_grid, process_templates, draw_components
rdfTemplates = rdfGraph()
instanceNS = Namespace("http://purl.org/linguistics/jcgood/template#")
rdfTemplates.load("./template.rdf")
# Get template IDs from RDF
templatesGenerator = rdfTemplates.subjects(RDF.type, instanceNS['desmeme'])
templates = []
for template in templatesGenerator:
templates.append(template)
gTemplates = process_templates(templates, rdfTemplates)
# NOTE: CAN NO LONGER GO DIRECTLY TO PNG or PDF; MUST MANUALLY PROCESS .dot FOR NOW
graphfolder = "/Users/jcgood/Dropbox/TemplatesBook/Graphs/"
draw_graphs(gTemplates, graphfolder)
graphfolder = "/Users/jcgood/Dropbox/TemplatesBook/ComponentGraphs/"
draw_components(gTemplates, graphfolder)