Mercurial > code > home > repos > light9
changeset 891:27d2f148b630
port listSongs to use syncedgraph
Ignore-this: 803c4897445582c9329a9f70b846a195
author | drewp@bigasterisk.com |
---|---|
date | Sat, 08 Jun 2013 21:22:24 +0000 |
parents | a9e34719cf86 |
children | 95e311bffbd9 |
files | bin/listsongs |
diffstat | 1 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/listsongs Sat Jun 08 21:16:27 2013 +0000 +++ b/bin/listsongs Sat Jun 08 21:22:24 2013 +0000 @@ -8,12 +8,19 @@ compdef _songs curvecalc """ -import run_local -from light9 import showconfig -from light9.namespaces import L9 +from run_local import log +from twisted.internet import reactor from rdflib import RDF -graph = showconfig.getGraph() +from light9.namespaces import L9 +from light9.rdfdb.syncedgraph import SyncedGraph + +graph = SyncedGraph("listsongs") -for song in graph.subjects(RDF.type, L9['Song']): - print song - +@graph.initiallySynced.addCallback +def printSongs(result): + with graph.currentState() as current: + for song in current.subjects(RDF.type, L9['Song']): + print song + reactor.stop() + +reactor.run()