Author(s): Francisco Bueno.
Version: 1.5#22 (1999/12/17, 16:59:51 MET)
Version of last change: 1.5#21 (1999/12/17, 16:28:20 MET)
This library allows connecting a Ciao Prolog application with daVinci V2.X (daVinci is developed by U. of Bremen, Germany).
For the time being, communication is based on a one-way channel: messages are sent to a daVinci process started on demand (i.e., for each Prolog goal a new daVinci process is started). Messages are sent via writing the term as text, but 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.
Here are two simple examples of use:
davinci_ugraph(['A'-['B','C'],'B'-['D'],'C'-['E'],'D'-[],'E'-['D'],'F'-['B']]).
makes daVinci show a graph corresponding to the Prolog term representation of an unlabeled graph.
davinci_lgraph(['A'-['B'-[from,a,to,b],'C'-ac],'B'-['D'-bd],'C'-['E'-ce], 'D'-[],'E'-['D'-ed],'F'-['B'-fb]]).
makes daVinci show a graph corresponding to the Prolog term representation of a labeled graph. This will create the same graph as above, but showing labels in the edges.
davinci
)davinci
)Start up a daVinci process.
Exit daVinci process.
Usage: davinci_ugraph(+Graph)
Graph
to daVinci.
+Graph
is an ugraph with special escape functors for daVinci.
(davinci:specialugraph/1
)
Usage: davinci_lgraph(+Graph)
Graph
to daVinci.
+Graph
is an lgraph with special escape functors for daVinci.
(davinci:speciallgraph/1
)
Usage: formatting(+Term,+Out)
Term
to Out
as a daVinci command.
+Term
is a term representing a daVinci command.
(davinci:commandterm/1
)
+Out
is an open stream.
(streams_basic:stream/1
)
Usage: ugraph2term(+Graph,-(Term))
Graph
to daVinci's representation.
Graph
is an ugraph with special escape functors for daVinci.
(davinci:specialugraph/1
)
davinci
)
commandterm(Term)
Syntactically, Term
is a just a term. Semantically, it has to correspond to a command understood by daVinci; otherwise daVinci reports back an error. Two functors within the subterms of Term
are interpreted in a special way: string/1
and text/1
. string(Term)
is given to daVinci as "Term"
; text(List)
is given as "Term1 Term2 ...Term "
for each Term in List
. If your term has functors string/1
and text/1
that you don't want to be interpreted this way, use them twice, i.e., string(string(Term))
is given to daVinci as string(Term')
, where Term'
is the interpretation of Term
.
Usage: commandterm(Term)
Term
is a term representing a daVinci command.
specialugraph(Graph)
Graph
is a term which denotes an ugraph as in library(ugraphs)
. Vertices of the form node(Term,List)
are interpreted as a vertex Term
with attributes List
. List
is a list of terms conforming the syntax of commandterm
, corresponding to daVinci's graph node 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.
Usage: specialugraph(Graph)
Graph
is an ugraph with special escape functors for daVinci.
speciallgraph(Graph)
Graph
is an lgraph as in library(lgraphs)
, except that the weights are labels, i.e., they do not need to be integers. Vertices with functor node/2
are interpreted in a special way, as in specialugraph/1
. Edge labels are converted into special intermediate vertices for daVinci; duplicated labels are solved by adding dummy atoms of the form "
. There is no support for multiple edges between the same two vertices.
Usage: speciallgraph(Graph)
Graph
is an lgraph with special escape functors for daVinci.
davinci
)davinci/0
and davinci_quit/0
do nothing: daVinci is started on demand and has to be exited from its own window.
davinciXXXXXX
file in the directory. Remember to erase them.
Go to the first, previous, next, last section, table of contents.