ASPECT Language
ASPECT is declarative sub-language of ASP that can be used to define the graphical representation of an answer set. ASPECT (standard) syntax consists of 21 special atomic formulas that define rendering of geometric primitives such as points, lines, polygons, ellipses, etc. The positioning of each element is determined by Cartesian coordinates.
The syntax of the ASPECT language is inspired by the popular PGF/TikZ language developed for drawing vector graphics in the markup language LaTeX.
A concise variant of the ASPECT language has been developed specifically for graph visualization (these are called graph atoms). This variant allows the user to define graphical elements (e.g., nodes and edges) without the need to worry about specifying coordinates, which are instead handled and optimized by the TikZ package. This variant consist of 6 atoms.
Attention
The following two sets of ASPECT atoms (standard atoms and graph atoms) are incompatible so they cannot be used in the same ASP program at the same time.
Standard Drawing Atoms
Graphic
element
|
ASPECT
atoms
|
|
|---|---|---|
node |
aspect_drawnode(x1,y1,text,[attributes],[frame])aspect_imagenode(x1,y1,image,[attributes],[frame]) |
x1 x-coordinatey1 y-coordinatetext set the node labelimage path of imageattributes (opt.) attributes listframe (opt.) frame number |
text: quoted or unquoted text. If text contains whitespaces or special characters, quotation marks are mandatory.image: the file path to the image.attributes: (optional) a single attribute, or a tuple(att1, att2, …). See ASPECT attributes for details.frame: (optional) integer number representing the frame of the animation in which the graphical element should be inserted.
line |
aspect_line(x1,y1,x2,y2,[attributes],[frame])x1 start point x-coordinatey1 start point y-coordinatex2 end point x-coordinatey2 end point y-coordinateattributes (opt.) attributes listframe (opt.) frame number |
|
arc |
aspect_arc(x1,y1,a1,a2,r1,[attributes],[frame])x1 x-coordinate of the centery1 y-coordinate of the centera1 start anglea2 end angler1 radiusattributes (opt.) attributes listframe (opt.) frame number |
|
straight
arrow
|
aspect_arrow(x1,y1,x2,y2,[attributes],[frame])x1 tail x-coordinatey1 tail y-coordinatex2 tip x-coordinatey2 tip y-coordinateattributes (opt.) attributes listframe (opt.) frame number |
|
square /
rectangle
|
aspect_rectangle(x1,y1,x2,y2,[attributes],[frame])x1 first corner x-coordinatey1 first corner y-coordinatex2 second corner x-coordy2 second corner y-coordattributes (opt.) attributes listframe (opt.) frame number |
|
triangle
|
aspect_triangle(x1,y1,x2,y2,x3,y3,[attributes],[frame])x1 first vertex x-coordinatey1 first vertex y-coordinatex2 second vertex x-coordy2 second vertex y-coordx3 third vertex x-coordy3 third vertex y-coordattributes (opt.) attributes listframe (opt.) frame number |
|
circle
|
aspect_circle(x1,y1,r1,[attributes],[frame])x1 center x-coordinatey1 center y-coordinater1 radiusattributes (opt.) attributes listframe (opt.) frame number |
|
ellipse
|
aspect_ellipse(x1,y1,r1,r2,[attributes],[frame])x1 center x-coordinatey1 center y-coordinater1 x radiusr2 y radiusattributes (opt.) attributes listframe (opt.) frame number |
Graph Drawing Atoms
Attention
The two sets of ASPECT atoms (standard atoms and graph atoms) are incompatible so they cannot be used in the same ASP program at the same time.
Graphic
element
|
ASPECT
atoms
|
Parameters
description
|
|---|---|---|
node |
aspect_graphdrawnode(A,[shape],[frame])aspect_graphcolornode(A,fill,[shape],[frame]) |
shape: allows to choose thecircleshape for the node. By default nodes are represented by squares.
Hint
aspect_graphdrawnode(1)a square-shaped node.aspect_graphdrawnode(2, circle)a circular-shaped node.
edge |
aspect_graphdrawline(A,B,[frame])aspect_graphquoteline(A,B,text,[frame]) |
A name first endpointB name second endpointtext sets edge label |
arrow |
aspect_graphdrawarrow(A,B,[frame])aspect_graphquotearrow(A,B,text,[frame]) |
A name arrow tailB name arrow tiptext sets edge label |
text: quoted or unquoted text. If text contains whitespaces or special characters, quotation marks are mandatory.






