Up to Index Back to Using Metalog - Next to Names

The Metalog Language

Metalog programs (or, "discourses") have various representations, but the one you have seen so far stays highest in the pyramid, as it is the one which is closest to humans. As you have seen, the main format that Metalog uses to communicate seems very similar to natural language. In fact, the main Metalog language uses a so-called PNL interface. PNL stands for Pseudo Natural Language, and means that it is indeed similar to natural language, but a very simplified one. Natural language is very complex, and it is very difficult for machines to actually fully understand it, because of its ambiguities. Metalog's PNL interface is instead totally unambiguous, and it does so by limiting a lot the way sentences can be written. This means that you can't just write sentences, and hope that Metalog will understand them: instead, you have to write things so that Metalog can understand them. Think of Metalog as a very young kid, that can only understand a very simple grammar.

So, in order to write Metalog you have to understand what its basic grammar rules. On the other hand, you shouldn't need anything in order to understand a Metalog program: a good Metalog program is one that is written in such a way that everybody can read it, and understand it (and so, instead of talking about a Metalog "program" you can also properly talk of a Metalog "discourse"...). So, a PNL interface has limitations in what you can write, but gives you quite a bonus on the other side of the spectrum: if used properly, all the people will be able to read and understand Metalog discourses, without any need for prior expertize.

As we have seen from the previous example, Metalog programs are composed by sentences. The three most important kinds of sentences are the "representations" (the green part), the "assertions" (sentences where you state something), and the queries.

We first start from the assertions, then go on with the representations, and finally go on with the queries.


So, now on to the structure of the assertions (the "blu lines"). As said, these are just the main sentences in a Metalog file, the ones where we state something.

The basic brick of these sentences follow a very simple pattern. When we were child, life was easy, and the language they tought us at school was easy too: sentences were simple, as they were made just from three basic parts: a subject, a verb, and an object. The basic Metalog sentences are exactly of this kind too; remember in the previous example, the assertion we had was:

JOHN IS "tall like a tower".

Here, JOHN is the subject of the sentence, IS is the verb, and "tall like a tower" is the object of the sentence.

Note that, like said earlier, a dot ends the sentence.

Assertions can be more sophisticated than that. For example, "and" and "or" can be used (although, with some limitations), with the usual meaning of conjunction and disjunction. For example, we could write a thing like

JOHN and MARY ARE "tall like a tower".

Metalog assertions can also express deduction rules. For example, if we know that

MARY is "as tall as" JOHN.

then we could write that

if JOHN is "tall like a tower" then MARY IS "tall like a tower".

The full list of operations supported by Metalog is given later in the Keywords section.


As we have seen in the first example, representations are a useful mean to associate some word (like JOHN) to its corresponding representation (the person "John_Smith" from the company "http://www.example.com/staff".) This means that whenever, in the following, the word JOHN is used, it is precisely like if we had written its whole representation instead.

Not every word can be associated with a representation. Only words that are ALL WRITTEN IN UPPER CASE can. This is the reason why our first example had JOHN and not instead John or john. Words that are all written in upper case are also called variables, which means that they do not have a meaning per se, but instead their meaning have to be explicitly specified. In the above case, the meaning of JOHN has been assigned to the person "John_Smith" from the company "http://www.example.com/staff".

After a variable, the word "represents" is used to denote a representation. Then, what follows is the associated meaning. As every sentence, also a representation sentence is terminated with a dot at the end.


Queries are those sentences where we are not stating something, but we are instead looking for answers.

A query has precisely the same form as an assertion; the only difference is that it ends with a question mark ("?") rathen than a dot.

Metalog will then try to answer, checking whether the question is true or not. By doing so, it can try to give you more detailed answers other than a simple"yes/no".

For instance, consider the first question we have seen in our initial example:

do you know whether JOHN IS SOMETHING?

This is like a normal assertion (apart from the final question mark). However, note that while we know the meaning of JOHN and of IS (as we have a representation for both of them), we do not know the meaning of SOMETHING, as this is a variable wich doesn't have a representation. Therefore, when we ask this query to be answered, Metalog tries to find some meaning for SOMETHING for which the whole sentence makes sense. As seen, if it succeedes then it tells us how, that is to say, it gives us the appropriate meanings that make the assertion true.

It is useful to remind that a frequent source of errors is to forget to specify a meaning for a variable. For example, remember when we were talking about assertions and use of "and". We have mentioned that someone could write something like

JOHN and MARY ARE "tall like a tower".

However, just adding this sentence to our initial Metalog example doesn't work well, because the meaning of MARY has not been defined (there is not a representation for her, unlike JOHN). So, don't be fooled by the fact a sentence reads well: if its meaning is not properly specified, Metalog's PNL interface will not understand it properly.