Esempio n. 1
0
 def test_rdf_literal_object(self):
     predicate = RDFPredicate('http://purl.org/dc/elements/1.1/creator')
     sorted_list = sorted(list(self.graph.objects(predicate=URIRef('http://purl.org/dc/elements/1.1/subject'))))
     test_obj = sorted_list[-1]
     rdf_object = RDFObject(rdf_object=test_obj, graph=self.graph, predicate=predicate, bindings=self.bindings)
     assert not rdf_object.is_uri
     assert not rdf_object.is_bnode
     assert rdf_object.is_literal
     assert rdf_object.value == 'twins'
     assert not rdf_object.has_resource
     assert rdf_object.language == 'en'
     assert rdf_object.to_index_entry() == {
         '@type': 'Literal',
         'lang': 'en',
         'value': 'twins',
         'raw': 'twins',
     }
     assert not rdf_object.resource_is_concept
Esempio n. 2
0
 def test_rdf_uri_ref_object(self):
     predicate = RDFPredicate('http://purl.org/dc/elements/1.1/creator')
     sorted_list = sorted(list(self.graph.objects(predicate=URIRef('http://purl.org/dc/elements/1.1/subject'))))
     test_obj = sorted_list[0]
     rdf_object = RDFObject(rdf_object=test_obj, graph=self.graph, predicate=predicate, bindings=self.bindings)
     assert rdf_object.is_uri
     assert not rdf_object.is_bnode
     assert not rdf_object.is_literal
     assert rdf_object.id == 'http://data.beeldengeluid.nl/gtaa/155912'
     assert str(rdf_object.value) == 'Steger, E.A.M.A.'
     assert rdf_object.value == Literal('Steger, E.A.M.A.', lang='nl')
     assert rdf_object.has_resource
     assert rdf_object.language == 'nl'
     assert rdf_object.object_type == 'URIRef'
     assert rdf_object.to_index_entry() == {
         '@type': 'URIRef',
         'value': 'Steger, E.A.M.A.',
         'raw': 'Steger, E.A.M.A.',
         'id': 'http://data.beeldengeluid.nl/gtaa/155912',
         'lang': 'nl',
         'inline': {
             'rdf_type': [{'@type': 'URIRef',
                           'id': 'http://www.w3.org/2004/02/skos/core#Concept',
                           'raw': 'skos:Concept',
                           'value': 'skos:Concept'}],
             'skos_definition': [{'@type': 'Literal',
                                 'raw': 'A person',
                                 'value': 'A person'}],
             'skos_prefLabel': [{'@type': 'Literal',
                                 'lang': 'nl',
                                 'raw': 'Steger, E.A.M.A.',
                                 'value': 'Steger, E.A.M.A.'}]
         }
     }
     assert rdf_object.resource_is_concept
     assert rdf_object.resource_has_skos_definition
     # second time the same should be True
     assert rdf_object.resource_is_concept
     assert rdf_object.resource_has_skos_definition