Ejemplo n.º 1
0
 def test_dump_one_id_to_rdf_and_reload(self):
     graph_dump1 = utils.rdf_c_dumper(self.tree_provider, 1)
     provider = RDFProvider(
         {
             'id': 'Number1',
             'dataset': {
                 'uri': 'http://id.trees.org/dataset'
             }
         }, graph_dump1)
     graph_dump2 = utils.rdf_c_dumper(provider, 1)
     graph_full_dump2 = utils.rdf_dumper(provider)
     assert len(graph_dump1) == len(graph_dump2)
     assert len(graph_full_dump2) > len(graph_dump2)
 def test_dump_one_id_to_rdf_and_reload(self):
     graph_dump1 = utils.rdf_c_dumper(self.tree_provider, 1)
     provider = RDFProvider(
         {
             'id': 'Number1',
             'dataset': {
                 'uri': 'http://id.trees.org/dataset'
             }
         },
         graph_dump1
     )
     graph_dump2 = utils.rdf_c_dumper(provider, 1)
     graph_full_dump2 = utils.rdf_dumper(provider)
     assert len(graph_dump1) ==  len(graph_dump2)
     assert len(graph_full_dump2) > len(graph_dump2)
Ejemplo n.º 3
0
 def rdf_individual_export_turtle(self):
     graph = utils.rdf_c_dumper(self.provider, self.c_id)
     response = Response(content_type='text/turtle')
     response.body = graph.serialize(format='turtle')
     response.content_disposition = 'attachment; filename="%s.ttl"' % (str(
         self.c_id), )
     return response
Ejemplo n.º 4
0
 def rdf_individual_export(self):
     graph = utils.rdf_c_dumper(self.provider, self.c_id)
     response = Response(content_type='application/rdf+xml')
     response.body = graph.serialize(format='xml')
     response.content_disposition = 'attachment; filename="%s.rdf"' % (str(
         self.c_id), )
     return response
Ejemplo n.º 5
0
 def test_dump_chestnut_to_rdf(self):
     graph_dump = utils.rdf_c_dumper(self.tree_provider, 2)
     citations = graph_dump.objects(predicate=DCTERMS.bibliographicCitation)
     for c in citations:
         assert Literal(
             '<strong>Monthy Python.</strong> Episode Three: How to recognise different types of trees from quite a long way away.',
             datatype=RDF.HTML) == c
 def test_dump_chestnut_to_rdf(self):
     graph_dump = utils.rdf_c_dumper(self.tree_provider, 2)
     citations = graph_dump.objects(predicate=DCTERMS.bibliographicCitation)
     for c in citations:
         assert Literal(
             '<strong>Monthy Python.</strong> Episode Three: How to recognise different types of trees from quite a long way away.', 
             datatype=RDF.HTML
         ) == c
 def test_dump_larch_to_rdf(self):
     graph_dump = utils.rdf_c_dumper(self.tree_provider, 1)
     cs = URIRef('http://id.trees.org')
     assert (cs, RDF.type, SKOS.ConceptScheme) in graph_dump
     assert (cs, SKOS.definition, Literal('<p xml:lang="en">Trees as used by Monthy Python.</p>', datatype=RDF.HTML)) in graph_dump
     assert (cs, SKOS.prefLabel, Literal('Pythonic trees.', lang='en')) in graph_dump
     xml = graph_dump.serialize(format='xml', encoding="UTF-8")
     if isinstance(xml, bytes):
         xml = xml.decode("UTF-8")
     self.assertEquals("<?xml", xml[:5])
Ejemplo n.º 8
0
 def test_dump_larch_to_rdf(self):
     graph_dump = utils.rdf_c_dumper(self.tree_provider, 1)
     cs = URIRef('http://id.trees.org')
     assert (cs, RDF.type, SKOS.ConceptScheme) in graph_dump
     assert (cs, SKOS.definition,
             Literal('<p xml:lang="en">Trees as used by Monthy Python.</p>',
                     datatype=RDF.HTML)) in graph_dump
     assert (cs, SKOS.prefLabel, Literal('Pythonic trees.',
                                         lang='en')) in graph_dump
     xml = graph_dump.serialize(format='xml', encoding="UTF-8")
     if isinstance(xml, bytes):
         xml = xml.decode("UTF-8")
     self.assertEquals("<?xml", xml[:5])
Ejemplo n.º 9
0
 def rdf_individual_export_turtle(self):
     graph = utils.rdf_c_dumper(self.provider, self.c_id)
     response = Response(content_type='text/turtle')
     response.body = graph.serialize(format='turtle')
     response.content_disposition = 'attachment; filename="%s.ttl"' % (str(self.c_id),)
     return response
Ejemplo n.º 10
0
 def rdf_individual_export(self):
     graph = utils.rdf_c_dumper(self.provider, self.c_id)
     response = Response(content_type='application/rdf+xml')
     response.body = graph.serialize(format='xml')
     response.content_disposition = 'attachment; filename="%s.rdf"' % (str(self.c_id),)
     return response