def test_intersection(self): larger_graph = get_empty_graph() larger_graph.add((URIRef(":Icaro"), RDF.type, URIRef(":Mortal"))) larger_graph.add((URIRef(":Mortal"), RDF.type, OWL.Class)) larger_graph.add((URIRef(":Human"), RDF.type, OWL.Class)) subset_graph = get_empty_graph() subset_graph.add((URIRef(":Icaro"), RDF.type, URIRef(":Mortal"))) result = intersection(subset_graph, larger_graph) expected = set(subset_graph) self.assertEqual(result, expected)
def _infer(self): """ Method that constructs a ``diderot.inference.Inference`` object and trigger the inference. """ inference = Inference() inference.add_facts(self.facts) inferred_facts = inference.get_inferred_facts() self.unexpected_inferred_facts = intersection(self.unexpected_facts, inferred_facts) if self.unexpected_inferred_facts: self.assertion_value = False self._build_assertion_error_message() else: self.assertion_value = True