To/From Datalog±
DLGP (for Datalog Plus) is a textual exchange format at once human-friendly, concise and easy to parse. CoGui provides an editor for this language with syntax highlighting and a navigator.
Switch to graphical and DLGP representation with the factory view is a good way to become familiar with the language. See section The factory view .
DLGP files can also be imported. See section Import from Datalog±
Finally, you can also export the whole project. See section Export to Datalog±
The format can be seen as an extension of the commonly used format for plain Datalog. Datalog± may define four kinds of knowledge elements:
- Facts
- Existential rules
- Negative constraints
- Conjunctives queries
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).
The file name has the extension .dlgp or .dlp. Character encoding is assumed to be UTF-8.
Complete syntax is described in this paper: DLGP: An extended Datalog Syntax for Existential Rules and Datalog±Version 2.0
Some examples of different elements are available here.
Some examples
Datalog± expressions |
Cogui conversion |
[a_fact]fatherOf(zeus,apollo), |
|
fatherOf(<Zeus>,<Apollo>), |
|
belongsTo(<Zeus>,<Greek+pantheon>). |
|
?:-fatherOf(X,apollo). |
|
distance(athens,marathon,42.195), |
|
distance(athens,marathon,"42km195"), |
|
distance(athens,marathon,42) |
|
siblingOf(Y,X):-siblingOf(X,Y). |
|
parentOf(X,Z):-parentOf(X,Y),parentOf(Y,Z). |
|
god(Y),human(Z), |
|
X=Y:-equals(X,Y). |
|
Created with the Personal Edition of HelpNDoc: Easy CHM and documentation editor