Ejemplo n.º 1
0
    def testFoundWithSafe(self):
        for original_node, target_node, triples in self.triple_sets:
            normalization = NotationNormalization(datatypes=(self.test_datatype,),
                                              safe_predicates=(SKOS.broader,))
            normalization.endpoint = mock.Mock()
            normalization.endpoint.query.return_value = ((self.test_notation, target_node),)

            graph = self.run_normalization(normalization, triples)

            self.assertIn((target_node, SKOS.broader, self.other_node), graph)
            self.assertIn((self.other_node, SKOS.prefLabel, rdflib.Literal("Title")), graph)
Ejemplo n.º 2
0
    def testNotFound(self):
        for original_node, target_node, triples in self.triple_sets:
            normalization = NotationNormalization(datatypes=(self.test_datatype,))
            normalization.endpoint = mock.Mock()
            normalization.endpoint.query.return_value = ()

            graph = self.run_normalization(normalization, triples)

            self.assertIn((self.parent_node, SKOS.narrower, original_node), graph)
            self.assertIn((original_node, SKOS.narrower, self.child_node), graph)
            self.assertIn((original_node, HUMFREY.noIndex, rdflib.Literal(True)), graph)
            self.assertNotIn((original_node, SKOS.notation, self.test_notation), graph)
            self.assertIn((original_node, SKOS.broader, self.other_node), graph)
            self.assertIn((self.other_node, SKOS.prefLabel, rdflib.Literal("Title")), graph)
Ejemplo n.º 3
0
    def testFoundWithSafe(self):
        for original_node, target_node, triples in self.triple_sets:
            normalization = NotationNormalization(
                datatypes=(self.test_datatype, ),
                safe_predicates=(SKOS.broader, ))
            normalization.endpoint = mock.Mock()
            normalization.endpoint.query.return_value = ((self.test_notation,
                                                          target_node), )

            graph = self.run_normalization(normalization, triples)

            self.assertIn((target_node, SKOS.broader, self.other_node), graph)
            self.assertIn(
                (self.other_node, SKOS.prefLabel, rdflib.Literal("Title")),
                graph)
Ejemplo n.º 4
0
    def testFound(self):
        for original_node, target_node, triples in self.triple_sets:
            normalization = NotationNormalization(
                datatypes=(self.test_datatype, ))
            normalization.endpoint = mock.Mock()
            normalization.endpoint.query.return_value = ((self.test_notation,
                                                          target_node), )

            graph = self.run_normalization(normalization, triples)

            self.assertIn((self.parent_node, SKOS.narrower, target_node),
                          graph)
            for node in (original_node, target_node):
                self.assertNotIn((node, SKOS.narrower, self.child_node), graph)
                self.assertNotIn((node, HUMFREY.noIndex, rdflib.Literal(True)),
                                 graph)
                self.assertNotIn((node, SKOS.notation, self.test_notation),
                                 graph)
                self.assertNotIn((node, SKOS.broader, self.other_node), graph)
            self.assertIn(
                (self.other_node, SKOS.prefLabel, rdflib.Literal("Title")),
                graph)