def test_superclasses(self): ontology = Ontology(path, format) type_ = ':vehicle' res = ontology.superclasses(type_) self.assertGreater(len(res), 0) self.assertEqual(True, ':physobj' in res) self.assertEqual(True, ':object' in res)
def test_subclasses(self): ontology = Ontology(path, format) type_ = ':vehicle' res = ontology.subclasses(type_) self.assertGreater(len(res), 0) self.assertEqual(True, ':airplane' in res) self.assertEqual(True, ':truck' in res)
def test_subsume_partition(self): ontology = Ontology(path) classes = [':vehicle', ':truck', ':object', ':physobj', ':package', 'owl:NamedIndividual'] result = ontology.partition(classes) self.assertEqual(3, len(result)) expected = {':truck', ':vehicle', ':object', ':physobj'} self.assertEqual(expected, set(result[0]))
def test_entity_type(self): ontology = Ontology(path, format) entity = 'http://www.scrutable-systems.org/ontology/Logistics#obj11' res = ontology.entity_types(entity) self.assertGreater(len(res), 2) entity = ':obj11' res = ontology.entity_types(entity) self.assertGreater(len(res), 2)
def test_subsume_sort(self): ontology = Ontology(path) classes = [':vehicle', ':truck', ':object'] result = ontology.sort(classes) self.assertEqual([':truck', ':vehicle', ':object'], result)
def test_subsumption(self): ontology = Ontology(path) self.assertEqual(True, ontology.subsumes(':vehicle', ':truck')) self.assertEqual(True, ontology.subsumes(':vehicle', ':vehicle')) self.assertEqual(False, ontology.subsumes(':vehicle', ':physobj'))
def test_entities_of_type(self): ontology = Ontology(path, format) type_ = ':vehicle' res = ontology.entities_of_type(type_) self.assertGreater(len(res), 0)
def test_best_entity_type(self): ontology = Ontology(path, format) entity = ':obj11' res = ontology.best_entity_type(entity) self.assertEqual(':drum', res)
def test_entity_type_fail(self): ontology = Ontology(path, format) entity = 'sassy:obj11' res = ontology.entity_types(entity) self.assertEqual(len(res), 0)