def test_guess_search_doc_type(self): self.assertEqual( bibframe.guess_search_doc_type(self.graph, self.work_uri), 'Work') self.assertEqual( bibframe.guess_search_doc_type(self.graph, self.instance_uri), 'Instance') held_item = rdflib.URIRef('http://catalog.test/90123') self.graph.add((held_item, rdflib.RDF.type, bibframe.BF.HeldItem)) self.assertEqual(bibframe.guess_search_doc_type(self.graph, held_item), 'HeldItem')
def test_guess_search_doc_type(self): self.assertEqual( bibframe.guess_search_doc_type( self.graph, self.work_uri ), 'Work' ) self.assertEqual( bibframe.guess_search_doc_type( self.graph, self.instance_uri ), 'Instance' ) held_item = rdflib.URIRef('http://catalog.test/90123') self.graph.add((held_item, rdflib.RDF.type, bibframe.BF.HeldItem)) self.assertEqual( bibframe.guess_search_doc_type( self.graph, held_item ), 'HeldItem' )
def test_init_subject(self): fedora_uri = self.ingester.init_subject(self.work63) self.assertIsNotNone(fedora_uri) # Test Fedora 4 Container and RDF Content fedora_g63 = rdflib.Graph().parse(fedora_uri) authorizedAccessPoints = [ str(object_) for object_ in fedora_g63.objects( subject=rdflib.URIRef(fedora_uri), predicate=bibframe.BF.authorizedAccessPoint) ] container_types = [ str(object_) for object_ in fedora_g63.objects( subject=rdflib.URIRef(fedora_uri), predicate=bibframe.RDF.type ) ] self.assertListEqual( sorted(authorizedAccessPoints), ["Howden, Martin. Russell Crowe :the biography", "howdenmartinrussellcrowethebiographyengworktext"]) self.assertTrue('http://bibframe.org/vocab/Work' in container_types) self.assertTrue('http://bibframe.org/vocab/Text' in container_types) # Test Elastic search result uuid = fedora_g63.value(subject=rdflib.URIRef(fedora_uri), predicate=bibframe.FCREPO.uuid) self.assertIsNotNone(uuid) es_result = self.ingester.elastic_search.get_source( id=uuid, index='bibframe' ) self.assertIsNotNone(es_result) self.test_artifacts.append({ "uuid": uuid, "fcrepo_url": fedora_uri, "doc_type": bibframe.guess_search_doc_type( fedora_g63, rdflib.URIRef(fedora_uri))})
def test_init_subject(self): fedora_uri = self.ingester.init_subject(self.work63) self.assertIsNotNone(fedora_uri) # Test Fedora 4 Container and RDF Content fedora_g63 = rdflib.Graph().parse(fedora_uri) authorizedAccessPoints = [ str(object_) for object_ in fedora_g63.objects( subject=rdflib.URIRef(fedora_uri), predicate=bibframe.BF.authorizedAccessPoint) ] container_types = [ str(object_) for object_ in fedora_g63.objects( subject=rdflib.URIRef(fedora_uri), predicate=bibframe.RDF.type) ] self.assertListEqual(sorted(authorizedAccessPoints), [ "Howden, Martin. Russell Crowe :the biography", "howdenmartinrussellcrowethebiographyengworktext" ]) self.assertTrue('http://bibframe.org/vocab/Work' in container_types) self.assertTrue('http://bibframe.org/vocab/Text' in container_types) # Test Elastic search result uuid = fedora_g63.value(subject=rdflib.URIRef(fedora_uri), predicate=bibframe.FCREPO.uuid) self.assertIsNotNone(uuid) es_result = self.ingester.elastic_search.get_source(id=uuid, index='bibframe') self.assertIsNotNone(es_result) self.test_artifacts.append({ "uuid": uuid, "fcrepo_url": fedora_uri, "doc_type": bibframe.guess_search_doc_type(fedora_g63, rdflib.URIRef(fedora_uri)) })