Up to Index Back to Names - Next to Menus


Keywords

As we have seen, the Metalog language can express sentences of various forms. The way Metalog understands sentences is given by the keywords, that are special reserved words, with a particular meaning understood by Metalog. So far, we have seen various keywords into action (for instance, "from", "and", "then". What follows is a complete list of all the Metalog keywords, with a very brief explanation and example for each of them.

Keyword Description
and Either a logical and (conjunction), or the presence of an ordered or unordered collection (technically, an RDF container Bag or Seq)

Example: JOHN and MARY ARE "tall".
Example: JOHN IS "tall" and MARY IS "short".

or Either a logical or (disjunction), or the presence of a list of alternatives (technically, an RDF container Alt)

Example: if either JOHN or MARY IS "rich" then their SON IS likely to be "rich" too.

then
imply
implies
The logical implication.

Example: if JOHN IS "tall" then MARY IS "tall".

comment A comment follows, to be ignored.

Example: comment: this is the list of employees.

represents Creates a representation (abbreviation/annotation).

Example: JOHN represents "John_Smith".

from Builds names in context (technically, URI-References).

Example: "John" from "http://people.example.net" IS "tall".

not The logical negation.

Example: JOHN IS not "tall".
Warning: support of negation in Metalog v2.0b is incomplete, so it is advised not to use this feature in the current version.

import Imports other Metalog code from the specified address.


Example: import "http://code.example.net/facts".

order Combined with an "and" keyword, indicates the presence of an ordered sequence (technically, an RDF Seq container).


Example: JOHN and MARY in this order are the FINALISTS of the TOURNAMENT.

add
plus
Addition (+) of numbers.

Example: JOHN HAS "2274" plus "752" dollars in his bank account.

sub
minus
Subtraction (-) of numbers.

Example: JOHN HAS "2274" plus "752" dollars in his bank account.

times
mult
Multiplication (*) of numbers.

Example: JOHN HAS "2274" times "3" dollars in his bank account.

div
divided
Division (/) of numbers.

Example: JOHN HAS "2274" divided "2" dollars in his bank account.

greater The "greater than" test (>) for numbers.

Example: "50000" is way greater than "200".

less The "less than" test (<) for numbers.

Example: "200" is way less than "50000".

different The inequality test for numbers.

Example: "201" is different than "200".

equal
equals
The equality test for numbers. 
If used in conjunction with the "greater" keyword, it indicates the "greater or equal than" (>=) test for numbers.
Analogously, if used in conjunction with the "less" keyword, it indicates the "less or equal than" (<=) test for numbers.

Example: AGE equals 46.
Example: "220" is greater or equal than "200" and "72" is less or equal than "72".

An important thing to remember is that any word which is not a Metalog keyword, or a variable, is discarded by Metalog. Or, better, every word that is in lower case. So, you can use such extra words at your will, to make sentences as readable as you can. As an example, consider again the two representations

JOHN represents the person "John Smith" from the company "http://www.example.com/staff".
IS represents the verb "is" from the collection "http://www.relationships.com/verbs".

A perfectly equivalent way of writing the above assertions could have been the essential

JOHN represents "John Smith" from "http://www.example.com/staff".
IS represents "is" from "http://www.relationships.com/verbs".

although, the first two representations are quite more readable.