Cogui - Datalog±  v2.0

Contents


DLGP language
Input file format
Import from Datalog±
Some examples
Vocabulary conversion
Export to Datalog±
The factory view
Write Datalog±
Read Datalog±

DLGP language


DLGP (for Datalog Plus) is a textual exchange format at once human-friendly, concise and easy to parse. This format can be seen as an extension of the commonly used format for plain Datalog. Datalog± may define four kinds of knowledge elements:


Some examples of different elements are available here.

Input file format


As usually in Datalog, variables begin with an upper-case letter and constants with a lower-case letter. We distinguish between regular constants(called constants hereafter) and literals, which are values belonging to some datatype. Literals are given as double-quoted strings or numeric values(integers and floats). Predicates are either simple strings (i.e., composed of letters, digits and underscore _), the equality symbol = (with infix notation) or double-quoted strings (in this case, the newline, backslash and double-quote characters that occur in the string are replaced by \n, \\ et \" when necessary). This is why, unlike the labels from predicates names, labels from constant names are constrained. By convention, the prefix cst_ can be added to a constant name and will then be removed when translated into a CG individual label. This allows you to define labels with an upper-case first letter (ex: cst_Zeus is translated by an individual label with Zeus). Printable ascii codes can also be used enclosed in underscores (ex: cst_Greek_32_pantheon will be translated by Greek pantheon).
The file name has the extension .dlgp or .dlp. Character encoding is assumed to be UTF-8.
Complete syntax is described in this paper: An extended Datalog syntax for existential rules and Datalog±


Import from Datalog±


Cogui is able to import Datalog± documents.
Datalog imports can be placed inside a new project or can populate an existing project.The most common way is to import rules to define a vocabulary and then add one or more data files based on this vocabulary . But it is also possible to import several vocabularies and combine them in a same project.
Cogui must have an initial maximal concept type to work correctly.

Select the maximal concept type to import in an existing project.


Give the name of the maximal concept type to import in a new project.

Some examples

Datalog± expressions Cogui conversion
[a_fact]fatherOf(zeus,apollo),
god(zeus), god(apollo).

Every kinds of knowledge elements can be named with simple strings (upper or lower case but without space or other special character).
fatherOf(cst_Zeus,cst_Apollo),
god(cst_Zeus), god(cst_Apollo).

Zeus can not be used as a constant name in DLPG language. By convention, the prefix cst_ is used.
belongsTo(cst_Zeus,cst_Greek_32_pantheon).
Use _32_ to represent a space in the Datalog constant name.
?:-fatherOf(X,apollo).
Is there someone father of Apollo ?
distance(athens,marathon,42.195),
town(athens),town(marathon).

A ternary predicate with a literal value(float).
distance(athens,marathon,"42km195"),
town(athens),town(marathon).

A ternary predicate with a literal value(string).
distance(athens,marathon,42)
,town(athens),town(marathon).

A ternary predicate with a literal value(int).
siblingOf(Y,X):-siblingOf(X,Y).
A rule to define a symmetric relation.
parentOf(X,Z):-parentOf(X,Y),parentOf(Y,Z).
A rule to define a transitive relation.
god(Y),human(Z),
parentOf(Y,X),parentOf(Z,X):-demigod(X).

A rule with new variables in conclusion (head of the rule).
Unlike safe clauses in classic Datalog, Datalog± accepts new variables int the rule heads.
X=Y:-equals(X,Y).
A rule with equality as a conclusion.
Head (conclusion) part of the rule can contains one or more equality relations between frontier concepts. They are represented as coreference links on the cogui model.

Vocabulary conversion

If the "support completion allowed" check-box button is checked (for new project or, optionality for an existing project) then Cogui will convert a part of the datalog imports into the vocabulary definition.

The importation options to define the Vocabulary.

Unary predicates are converted into concept types on the cogui model.


Some examples below:
Datalog± expressions Cogui conversion on the Vocabulary
"Human"(X):-"Man"(X).
From this rule, Cogui deduces a specialisation relation between the concept types
!:-"Man"(X),"Woman"(X).
This negative constraint is transformed into a banned type.
parentOf(X,Y):-fatherOf(X,Y).
From this rule, Cogui deduces a specialisation relation between the relation types.
"Man"(X):-fatherOf(X,Y).
The signature of fatherOf is modified by this rule.

Export to Datalog±

Cogui is able to export projects to Datalog± formats. All knowledge elements are converted (except scripts). Concept types are transformed into unary predicate. Relation signatures are converted into equivalent rules. Banned types are converted into negative constraints.
Individual labels are translated into Datalog constant name. When necessary the strings are modified and prefixed by cst_.
There is no multilingual mechanism in Datalog, so predicates are built with the labels of the currently selected language.


The Datalog± export dialog

The factory view

Its brevity makes language datalog± an effective tool for the construction of new objects in the knowledge base, while the graphical representation is preferable to read (visualize) or update these objects. The "Factory" view is intended to allow concomitant use of both representations. It can immediately translate a text datalog± in its graphic equivalent and reciprocally translate any object of the knowledge base in its datalog± tranlation. Note that the factory view features concern facts, rules, queries and constraints but not the vocabulary. Classic import/export must be used for this purpose.

Datalog and graphical representations are complementary. With Factory view you can switch back and forth between the two.

From datalog± to Cogui objects

The factory view consists in ....

From Cogui objects to datalog±

Cogui facts, rules, queries and constraints can be easily translated in...


The factory view