Let start by classify the phrases you propose:
- The cat drinks milk. => action
- Sun is yellow. => descriptive/declarative, immutable
- I was at work yesterday. => descriptive, time related
1) The easiest ones are always the descriptive and immutable (in the context) phrases as "Sun is yellow.". Some usual representations:
color('Sun',yellow).
or simply:
yellow('Sun').
Sun.color=yellow
2) When the fact is time related as in "I was at work yesterday", we divide the description in a time indicator and a immutable fact:
when(yesterday,at(I,workplace)).
note how when has two parts, the time identification and the immutable fact.
Another prolog variant is:
at(I,workplace,[when(yesterday)]).
where the content in the list (brackets) means "optional related facts".
I.at = {
position = workplace;
when = yesterday
}
3) Actions as "The cat drinks milk." are a few more difficult:
drinks(cat,milk).
or
action(cat,drinks,milk).
cat.drinks=[milk]
or
cat.action = {
action=drinks
object=milk
}
Obviously, these are only the main ideas, there are as many representations as different programs, but most of them handles same kind of structures.
( note: the term "computer understandable" is ambiguous. Current computer doesn't understand anything. We say these expression are understandable in the sense that its compiler/interpreter accepts them, and describes the content of the phrase, and the program can transform them to other results).