Interface to daVinci
Author(s): Francisco Bueno.This library allows connecting a Ciao Prolog application with daVinci V2.X.
The communication is based on a two-way channel: after daVinci is started, messages are sent in to it and read in from it on demand by different Prolog predicates. Messages are sent via writing the term as text; messages are received by reading text and returning an atom. Commands sent and answers received are treated as terms from the Prolog side, since for daVinci they are text but have term syntax; the only difficulty lies in strings, for which special Prolog syntax is provided.
See accompanying file library(davinci(commands)) for examples on the use of this library.
daVinci is developed by U. of Bremen, Germany.
Usage and interface
- Library usage:
:- use_module(library(davinci)). - Exports:
- Imports:
- System library modules:
aggregates, prompt, format, read, graphs/ugraphs, write, system. - Packages:
prelude, nonpure, assertions.
- System library modules:
Documentation on exports
Usage:davinci_get(Term)
Get a message from daVinci. Term is a term corresponding to daVinci's message.
Usage:davinci_get_all(List)
Get all pending messages. List is a list of terms as in davinci_get/1.
- The following properties should hold upon exit:
(basic_props:list/1)List is a list.
Usage:davinci_put(Term)
Send a command to daVinci.
- The following properties should hold at call time:
(davinci:davinci_command/1)davinci:davinci_command(Term)
Usage:davinci_ugraph(Graph)
Send a graph to daVinci.
- The following properties should hold at call time:
(davinci:ugraph/1)davinci:ugraph(Graph)
Usage:davinci_lgraph(Graph)
Send a labeled graph to daVinci.
- The following properties should hold at call time:
(davinci:lgraph/1)davinci:lgraph(Graph)
Documentation on internals
Graph is a term which denotes an ugraph as in library(ugraphs). Vertices of the form node/2 are interpreted in a special way: node(Term,List) is interpreted as a vertex Term with attributes List. List is a list of terms conforming the syntax of davinci_put/1 and corresponding to daVinci's graph nodes attributes. If your vertex has functor node/2 and you don't want it to be interpreted this way, use it twice, i.e., node(node(T1,T2),[]) is given to daVinci as vertex node(T1,T2). A vertex is used both as label and name of daVinci's graph node. daVinci's graph edges have label V1-V2 where V1 is the source and V2 the sink of the edge. There is no support for multiple edges between the same two vertices.
Graph is a term which denotes a wgraph as in library(wgraphs), except that the weights are labels, i.e., they do not need to be integers. Vertices of the form node/2 are interpreted in a special way. Edge labels are converted into special intermediate vertices. Duplicated labels are solved by adding dummy atoms ”. There is no support for multiple edges between the same two vertices.