Esempio n. 1
0
 def test_resource_to_index_doc(self):
     test_uri = 'http://www.openbeelden.nl/files/01/65/165083.WEEKNUMMER552-HRE0000CF2E.mpg'
     resource = RDFResource(
         subject_uri=test_uri,
         graph=self.graph,
         bindings=self.bindings
     )
     assert resource.subject_uri == URIRef(test_uri)
     index_doc = resource.to_index_entry()
     assert len(index_doc.keys()) > 0
     assert index_doc.get('dcterms_extent')[0]['value'] == 'PT1M36S'
     assert index_doc.get('dcterms_extent')[0]["@type"] == "Literal"
     assert len(index_doc.get('rdf_type')) > 0
     assert index_doc.get('rdf_type') == [
         {'@type': 'URIRef',
          'id': 'http://www.europeana.eu/schemas/edm/ProvidedCHO',
          'value': 'edm:ProvidedCHO',
          'raw': 'edm:ProvidedCHO',
          }
     ]
Esempio n. 2
0
 def test_initial_create(self):
     test_uri = 'http://www.openbeelden.nl/files/01/65/165083.WEEKNUMMER552-HRE0000CF2E.mpg'
     resource = RDFResource(
         subject_uri=test_uri,
         graph=self.graph,
         bindings=self.bindings
     )
     assert resource.subject_uri == URIRef(test_uri)
     assert str(resource.get_type().uri) == 'http://www.europeana.eu/schemas/edm/ProvidedCHO'
     assert len(resource.get_predicates()) == 16
     assert len(resource.get_items()) == 16
     assert len(resource.get_objects()) == 30
     assert not resource.has_geo()
Esempio n. 3
0
    def test_for_enrichment_skos_entry(self):
        entries = list(self.graph.subject_objects(predicate=DC.subject))
        assert entries is not None
        assert len(entries) == 6
        enrichment_link = 'http://data.beeldengeluid.nl/gtaa/enrichment_link'
        rdf_resource = RDFResource(
            subject_uri=enrichment_link,
            graph=self.graph,
            bindings=self.bindings
        )
        # unlinked entry
        enrichment, linked = rdf_resource.is_enrichment()
        assert linked is not None
        assert isinstance(linked, bool)
        assert not linked

        linked_enrichment_link = "http://data.beeldengeluid.nl/gtaa/155912_enriched"
        rdf_resource = RDFResource(
            subject_uri=linked_enrichment_link,
            graph=self.graph,
            bindings=self.bindings
        )
        assert rdf_resource.is_enrichment() is not None
        # should be linked
        enrichment, islinked = rdf_resource.is_enrichment()
        assert enrichment
        assert islinked

        linked_enrichment_link = "http://data.beeldengeluid.nl/gtaa/155912"
        rdf_resource = RDFResource(
            subject_uri=linked_enrichment_link,
            graph=self.graph,
            bindings=self.bindings
        )
        # not enrichment not linked
        assert rdf_resource.is_enrichment() is not None
        enrichment, islinked = rdf_resource.is_enrichment()
        assert not islinked
        assert not enrichment

        #
        rdf_object = RDFObject(
            URIRef('%s' % enrichment_link),
            graph=self.graph,
            predicate=DC.subject,
            bindings=self.bindings
        )
        assert not rdf_object.is_uri
        assert rdf_object.id != enrichment_link
        assert not rdf_object.has_resource
        assert rdf_object.is_literal
        assert rdf_object.id is None
        assert rdf_object.value == "test enriched"
        assert rdf_object._is_normalised
        assert not rdf_object._is_inlined

        rdf_object = RDFObject(
            URIRef('%s' % "http://data.beeldengeluid.nl/gtaa/155912_enriched"),
            graph=self.graph,
            predicate=DC.subject,
            bindings=self.bindings
        )
        assert rdf_object.is_uri
        # assert not rdf_object.has_resource
        assert rdf_object.id is not None
        assert rdf_object.id == "http://data.beeldengeluid.nl/gtaa/155912"
        assert str(rdf_object.value) == "Steger, E.A.M.A."
        assert rdf_object._is_inlined
        assert not rdf_object._is_normalised