Exemplo n.º 1
0
 def rdf_view(self):
     self.request.response.setStatus(200)
     self.request.response.setHeader(
         'Content-Type', "application/rdf+xml")
     self.request.response.setHeader(
         'Content-Disposition', "filename={}.rdf".format(self.vocabname))
     g = RegVocabGrapher(self.context, self.request).scheme(self.vocabkey)
     return g.serialize(format='pretty-xml')
Exemplo n.º 2
0
 def turtle_view(self):
     self.request.response.setStatus(200)
     self.request.response.setHeader(
         'Content-Type', "text/turtle; charset=utf-8")
     self.request.response.setHeader(
         'Content-Disposition', "filename={}.ttl".format(self.vocabname))
     g = RegVocabGrapher(self.context, self.request).scheme(self.vocabkey)
     return g.serialize(format='turtle')
Exemplo n.º 3
0
        g = PersonsGrapher(site, app).authors(site)
        sys.stdout.write("""# Pleiades RDF Dump
# Contents: Pleiades Authors
# Date: %s
# License: http://creativecommons.org/licenses/by/3.0/us/
# Credits: https://pleiades.stoa.org/credits
# Triple count: %d

""" % (DateTime(), len(g)))
        sys.stdout.write(g.serialize(format='turtle'))
        sys.exit(1)

    elif opts.vocabulary:

        if opts.vocabulary in ('time-periods', 'place-types'):
            g = RegVocabGrapher(site, app).scheme(opts.vocabulary)
        else:
            vocab = site['vocabularies'][opts.vocabulary]
            g = VocabGrapher(site, app).scheme(vocab)
        sys.stdout.write("""# Pleiades RDF Dump
# Contents: Pleiades Vocabulary '%s'
# Date: %s
# License: http://creativecommons.org/licenses/by/3.0/us/
# Credits: https://pleiades.stoa.org/credits
# Triple count: %d

""" % (opts.vocabulary, DateTime(), len(g)))
        sys.stdout.write(g.serialize(format='turtle'))
        sys.exit(1)

    elif opts.places and not opts.range:
Exemplo n.º 4
0
        g = PersonsGrapher(site, app).authors(site)
        sys.stdout.write("""# Pleiades RDF Dump
# Contents: Pleiades Authors
# Date: %s
# License: http://creativecommons.org/licenses/by/3.0/us/
# Credits: https://pleiades.stoa.org/credits
# Triple count: %d

""" % (DateTime(), len(g)))
        sys.stdout.write(g.serialize(format='turtle'))
        sys.exit(1)

    elif opts.vocabulary:

        if opts.vocabulary in ("time-periods", "place-types"):
            g = RegVocabGrapher(site, app.REQUEST)
            g = g.scheme(opts.vocabulary)
        else:
            vocab = site['vocabularies'][opts.vocabulary]
            g = VocabGrapher(site, app).scheme(vocab)
        sys.stdout.write("""# Pleiades RDF Dump
# Contents: Pleiades Vocabulary '%s'
# Date: %s
# License: http://creativecommons.org/licenses/by/3.0/us/
# Credits: https://pleiades.stoa.org/credits
# Triple count: %d

""" % (opts.vocabulary, DateTime(), len(g)))
        sys.stdout.write(g.serialize(format='turtle'))
        sys.exit(1)