Mercurial > code > home > repos > light9
comparison bin/curvecalc @ 473:9ed6c40b3d6a
new subterms get a good uri and label
Ignore-this: 403562516ef35e4a3b6d3fe2bbd401b2
author | drewp@bigasterisk.com |
---|---|
date | Fri, 12 Jun 2009 08:53:36 +0000 |
parents | fb888a771b42 |
children | 0e3743492eae |
comparison
equal
deleted
inserted
replaced
472:2442b086e4bb | 473:9ed6c40b3d6a |
---|---|
18 except ImportError: | 18 except ImportError: |
19 import louie as dispatcher | 19 import louie as dispatcher |
20 from twisted.internet import reactor,tksupport | 20 from twisted.internet import reactor,tksupport |
21 import twisted | 21 import twisted |
22 from twisted.web.xmlrpc import Proxy | 22 from twisted.web.xmlrpc import Proxy |
23 from rdflib import Literal, URIRef, RDF | 23 from rdflib import Literal, URIRef, RDF, RDFS |
24 from rdflib.Graph import Graph | 24 from rdflib.Graph import Graph |
25 import rdflib | 25 import rdflib |
26 import logging | 26 import logging |
27 log = logging.getLogger() | 27 log = logging.getLogger() |
28 logging.basicConfig(format="%(asctime)s %(levelname)-5s %(name)s %(filename)s:%(lineno)d: %(message)s") | 28 logging.basicConfig(format="%(asctime)s %(levelname)-5s %(name)s %(filename)s:%(lineno)d: %(message)s") |
326 def sub_commands_tk(master, curveset, subterms, root, ssv, graph): | 326 def sub_commands_tk(master, curveset, subterms, root, ssv, graph): |
327 f=tk.Frame(master,relief='raised',bd=1) | 327 f=tk.Frame(master,relief='raised',bd=1) |
328 newname = tk.StringVar() | 328 newname = tk.StringVar() |
329 | 329 |
330 def add_cmd(evt): | 330 def add_cmd(evt): |
331 add_one_subterm(graph, L9['sub/%s' % newname.get()], | 331 uri = L9['sub/%s' % newname.get()] |
332 graph.add((uri, RDF.type, L9.Subterm)) | |
333 graph.add((uri, RDFS.label, Literal(newname.get()))) | |
334 add_one_subterm(graph, uri, | |
332 curveset, subterms, root, ssv, None) | 335 curveset, subterms, root, ssv, None) |
333 if evt.state & 4: # control key modifier | 336 if evt.state & 4: # control key modifier |
334 curveset.new_curve(newname.get()) | 337 curveset.new_curve(newname.get()) |
335 newname.set('') | 338 newname.set('') |
336 | 339 |
359 graph = Graph() | 362 graph = Graph() |
360 for subterm in subterms: | 363 for subterm in subterms: |
361 uri = URIRef(song + "/subterm/" + subterm.submaster.name) | 364 uri = URIRef(song + "/subterm/" + subterm.submaster.name) |
362 graph.add((song, L9['subterm'], uri)) | 365 graph.add((song, L9['subterm'], uri)) |
363 graph.add((uri, RDF.type, L9['Subterm'])) | 366 graph.add((uri, RDF.type, L9['Subterm'])) |
367 graph.add((uri, RDFS.label, Literal(subterm.submaster.name))) | |
364 graph.add((uri, L9['sub'], L9['sub/%s' % subterm.submaster.name])) | 368 graph.add((uri, L9['sub'], L9['sub/%s' % subterm.submaster.name])) |
365 graph.add((uri, L9['expression'], Literal(subterm.subexpr.expr))) | 369 graph.add((uri, L9['expression'], Literal(subterm.subexpr.expr))) |
366 return graph | 370 return graph |
367 | 371 |
368 def add_subterms_for_song(graph, song, curveset, subterms, root, ssv): | 372 def add_subterms_for_song(graph, song, curveset, subterms, root, ssv): |