Ejemplo n.º 1
0
def page_rdf(request, lccn, date, edition, sequence):
    page = get_page(lccn, date, edition, sequence)
    graph = page_to_graph(page)
    response = HttpResponse(graph.serialize(base=_rdf_base(request),
                                            include_base=True),
                            content_type='application/rdf+xml')
    return response
Ejemplo n.º 2
0
 def test_page(self):
     p = Page.objects.get(id=1)
     g = rdf.page_to_graph(p)
     u = URIRef('/lccn/sn83030214/1898-01-01/ed-1/seq-1#page')
     parts = list(g.objects(u, ORE['aggregates']))
     self.assertEqual(len(parts), 5)
     self.assertTrue(URIRef('/lccn/sn83030214/1898-01-01/ed-1/seq-1.pdf')
                     in parts)
     self.assertEqual(g.value(u, ORE.isDescribedBy),
                      URIRef('/lccn/sn83030214/1898-01-01/ed-1/seq-1.rdf'))