Пример #1
0
Файл: db.py Проект: drewp/photo
def getGraph():
    return SyncGraph('sesame', networking.graphRepoRoot()+'/photo', initNs=initNs)
Пример #2
0
Файл: db.py Проект: drewp/photo
def getGraph():
    return SyncGraph("sesame", networking.graphRepoRoot() + "/photo", initNs=initNs)
Пример #3
0
"""
webpy+genshi tool for browsing the hierarchy of pics (especially to
find the newest ones) and making them publicly viewable. End of
mission statement.
"""
import web, sys
from web.contrib.template import render_genshi
from rdflib import Variable, URIRef
from remotesparql import RemoteSparql
from public import isPublic, makePublic
import networking
from ns import PHO, FOAF, EXIF, RDFS, RDF, SITE

render = render_genshi('.', auto_reload=True)

graph = RemoteSparql(networking.graphRepoRoot(), "photo",
                     initNs=dict(foaf=FOAF,
                                 rdfs=RDFS.RDFSNS,
                                 rdf=RDF.RDFNS,
                                 exif=EXIF,
                                 pho=PHO))

class index(object):
    def GET(self):
        i = web.input()
        topDir = URIRef(i.get('dir', '') or SITE)

        return render.browse2_index(
            subdirs=graph.queryd("""
              SELECT DISTINCT ?subdir ?type WHERE {
                ?subdir pho:inDirectory ?topDir .