def test_SetsActorAsPredicate(self): event = CDEvent(Primitives.EXPEL) event.subject = 'star' predicates = converter.convert_to_prolog(event) self.assertTrue( any(pred.startswith("actorOfEvent(star,") for pred in predicates))
def test_sets_subject_and_object_correctly(self): converter = cd_converter.CDConverter() fake_cd_event = CDEvent(Primitives.EXPEL) fake_cd_event.subject = "Star" fake_cd_event.event_object = "particle" result = converter.convert_cd_event_to_action_events(fake_cd_event) self.assertEqual(result[0].subject, "Star") self.assertEqual(result[0].event_object, "particle")
def _check_missing_info(event: CDEvent): if not event.subject: if event.primitive == Primitives.EXPEL or event.primitive == Primitives.INGEST: event.subject = prolog_service.query_prolog(event)