GML-Keys.tex 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %
  3. % Predefined Keys
  4. %
  5. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  6. \chapter{Predefined Keys}
  7. This section lists predefined keys. The design of GML leaves
  8. applications any freedom to define their own keys. However, in
  9. order to maintain compatibility with other applications, standard
  10. keys should be used as much as possible. The entries in the
  11. lists below will be as follows:
  12. \begin{quote}
  13. \texttt{Key}
  14. \emph{Type}
  15. \hfill
  16. \makebox[5cm][l]{\texttt{Context}}\qquad\textbf{Save/Unsafe}
  17. \end{quote}
  18. \noindent where
  19. \begin{description}
  20. \item[\texttt{Key}] is the (name of the) GML Key.
  21. \item[\emph{Type}] is the type of the value.
  22. We use the following types:
  23. \begin{itemize}
  24. \item \texttt{Integer} is an integer value.
  25. \item \texttt{Real} is a floating point value.
  26. \item \texttt{String} is a string value.
  27. \item \texttt{List} is a list value.
  28. \emph{true}.
  29. \end{itemize}
  30. \item[\texttt{Context}] specifies a path whichmust be the
  31. prefix for the key:
  32. \begin{itemize}
  33. \item If the context is ``\texttt{.a.b.c}'' and the key is
  34. ``\texttt{x}'', then this key must be on a path
  35. ``\texttt{.a.b.c.x}''.
  36. % Hint for blondes
  37. If the type is not \emph{List}, then \texttt{x} is obviously
  38. a leaf in the object tree.
  39. \item If the context is ``\texttt{.}'', then the key may
  40. occur everywhere.
  41. \item If the context is empty, then this key is defined only
  42. if it occurs at the top level
  43. \end{itemize}
  44. \item[\textbf{Safe}, \textbf{Unsafe}] specifies whether this
  45. object should generally be regarded as safe (see Chapter
  46. \ref{c:GML:Consistency}).
  47. \end{description}
  48. \section{Global Attributes}
  49. \label{s:GML:GlobalAttributes}
  50. The following attributes can be used with all objects.
  51. \begin{GMLAttributes}
  52. \GMLAttr{id}{Integer}{.}
  53. An id is an identifier for an object.
  54. The values of id objects do not need to be unique throughout a
  55. file; this is defined by the application.
  56. \GMLAttr{label}{String}{.}
  57. Defines the label of an object. A graphical browser should use
  58. this attribute to annotate the object with a text.
  59. \GMLAttr{comment}{String}{.} Defines a comment. Note that such
  60. a comment will be read \emph{and} saved. This attribute is
  61. \textbf{safe}, so handle with care. There is no unsafe version
  62. of \texttt{comment} since this would not be helpful as comment
  63. is too general.
  64. \GMLAttr[unsafe]{Creator}{String}{.} The program which created
  65. this object. This attribute is unsafe since every program
  66. should register its own name here, or forget about it.
  67. \GMLAttr{name}{String}{.} Defines the name of an object. The
  68. name is a textual alternative to the \texttt{id} attribute.
  69. \end{GMLAttributes}
  70. \section{Top Level Attributes}
  71. \label{s:GML:TopLevelAttributes}
  72. The following attributes are only defined at the top level of a
  73. file, that is they may have no prefix.
  74. \begin{GMLAttributes}
  75. \GMLAttr{graph}{List}{} Defines a graph. In the current
  76. version of GML, the top object is almost always a graph.
  77. \GMLAttr[unsafe]{Version}{Integer}{} Describes the GML version of this
  78. file. Current value is 1. Files with an unknown version number
  79. should be rejected.
  80. \GMLAttr[unsafe]{Creator}{String}{} The name of the program which
  81. created this file.
  82. \end{GMLAttributes}
  83. The fact that these attributes are only defined at the top level
  84. does not mean that they can not be defined at other locations.
  85. For example, given a proper semantics, graphs can be defined
  86. inside graphs.
  87. %
  88. % Graphs
  89. %
  90. \section{Graphs}
  91. \label{s:GML:Graph}
  92. %
  93. % Graph Attributes
  94. %
  95. \subsection{Graph Attributes}
  96. \label{s:GML:GraphAttributes}
  97. \begin{GMLAttributes}
  98. \GMLAttr{directed}{B}{.graph} Defines whether a graph is directed
  99. (0) or undirected (1). Default is undirected.
  100. \GMLAttr{node}{L}{.graph} Defines a node. Each node should have
  101. an id attribute, which must be unique within all node.id
  102. attributes of a graph object.
  103. \GMLAttr{edge}{L}{.graph}
  104. Defines a new edge..edge.source and.edge.target reference the
  105. endnodes of an edge
  106. \end{GMLAttributes}
  107. %
  108. % Node Attributes
  109. %
  110. \subsection{Node Attributes}
  111. \label{s:GML:NodeAttributes}
  112. A node is usually identified by its id attribute, and often has a
  113. label attributes Its graphical properties are described by the
  114. graphics attribute.
  115. \begin{GMLAttributes}
  116. \GMLAttr{id}{I}{.graph.node} Defines an identification number
  117. for the node. All \texttt{id} numbers within a graph must be
  118. unique.
  119. \GMLAttr{edgeAnchor}{S}{.graph.node} Defines how the edges are
  120. attached to the node.
  121. \end{GMLAttributes}
  122. %
  123. % Graphics Attributes
  124. %
  125. \section{Graphics Attributes}
  126. \label{s:GML:GraphicsAttributes}
  127. Generally, the graphics attributes in GML are modelled after the
  128. graphics in Tk.
  129. \begin{GMLAttributes}
  130. \GMLAttr{x}{R}{.graphics} Defines the \emph{x} coordinate
  131. of the center of the bounding rectangle of the object.
  132. \GMLAttr{y}{R}{.graphics} Defines the \emph{y} coordinate
  133. of the center of the bounding rectangle of the object.
  134. \GMLAttr{z}{R}{.graphics.center} Defines the \emph{z}
  135. coordinate\NYI{} of the center of the bounding rectangle of
  136. the object.
  137. \GMLAttr{w}{R}{.graphics} Define the width of the bounding
  138. box of the node. If omitted, the width is 0.
  139. \GMLAttr{h}{R}{.graphics} Define the height of the bounding
  140. box of the node. If omitted, the height is 0.
  141. \GMLAttr{d}{R}{.graphics} Define the depth\NYI[foot] of
  142. the bounding box of the node. If omitted, the depth is 0.
  143. % Add more dimensions according to your degree of enlightment.
  144. \GMLAttr{type}{S}{.graphics} Defines the graphical object.
  145. Values for \texttt{type} are \texttt{arc}, \texttt{bitmap},
  146. \texttt{image}, \texttt{line}, \texttt{oval}, \texttt{polygon},
  147. \texttt{rectangle} and \texttt{text}.
  148. \begin{notes}
  149. \item The current implementation of Graphlet assumes that
  150. edges always have the type \texttt{line}.
  151. \item The current implementation of Graphlet assumes that
  152. labels always have the type \texttt{text}.
  153. \end{notes}
  154. \GMLAttr{image}{S}{.graphics} The value of \texttt{image} is
  155. the name of an image file which is used to draw an object. If
  156. no \texttt{w}, \texttt{h} and \texttt{d} attributes are given,
  157. the application my use the images dimensions to scale the
  158. graphics. Otherwise, the image is scaled to fit into the given
  159. dimensions.
  160. \begin{notes}
  161. \item The actual image capabilities may depend on the
  162. graphics subsystem used by the program\footnote{Graphlet can
  163. read GIF and JPEG files through Tk, but cannot scale
  164. them in the current version.}. For example, not
  165. all systems can display pictures in JPEG format, or scale
  166. them. Programs should replace the image by a dummy object if
  167. sufficient graphics capabilities are not available.
  168. \item The corresponding\texttt{image} attribute in
  169. \GraphScript{} and \GraphScript's C++ interface is slightly
  170. different as this attribute needs a Tcl/Tk \texttt{image}
  171. object instead of a filename. We are using a different
  172. approach here to be more portable.
  173. \item Images are always stored in separate files. This is
  174. because application programmer interfaces for graphics file
  175. formats almost always support reading from a file, while
  176. converting from a string in a file is usually not supported.
  177. \end{notes}
  178. \GMLAttr{bitmap}{S}{.graphics} The value of \texttt{bitmap} is
  179. the name of a bitmap file which is used to draw an object. A
  180. \texttt{bitmap} differs from an \texttt{image} in that the
  181. bitmap has only a foreground and a background color, while
  182. images may have their own arbitrary color table.
  183. \GMLAttr{point}{L}{.graphics.Line} Defines a point of the
  184. polyline that is used to draw the edge. A straight line edge
  185. does not need to specify points. If points are specified, they
  186. must include the end points of the edge.
  187. The following example shows how to use the \texttt{Line}
  188. attribute:
  189. \begin{quote}
  190. \begin{small}
  191. \begin{verbatim}
  192. graphics [
  193. Line [
  194. point [
  195. x 10.0
  196. y 10.0
  197. ]
  198. point [
  199. x 100
  200. y 20.0
  201. ]
  202. point [
  203. x 20.0
  204. y 20.0
  205. ]
  206. ]
  207. ]
  208. \end{verbatim}
  209. \end{small}
  210. \end{quote}
  211. \noindent The example specifies a line with three points. In reality,
  212. this corresponds to an edge with one bend (the first and the
  213. last \texttt{point} entries are the endpoints of the edge).
  214. \begin{notes}
  215. \item If the \texttt{Line} attribute of an edge is omitted,
  216. an application should substitute a straigt line between the
  217. endpoints of the edge.
  218. \item \texttt{Line} us \emph{unsafe} because the coordinates
  219. become invalid as soon as the endpoints are moved.
  220. \end{notes}
  221. \GMLAttr{point}{L}{.graphics.Line} Defines a point of the
  222. polyline that is used to draw the edge. A straight line edge
  223. does not need to specify points. If points are specified, they
  224. \emph{must} include the end points of the edge.
  225. \GMLAttr{point.x}{R}{.graphics.Line} Define the \emph{z}
  226. coordinate of a point.
  227. \GMLAttr{point.y}{R}{.graphics.Line} Define the \emph{z}
  228. coordinate of a point.
  229. \GMLAttr{point.z}{R}{.graphics.Line} Define the \emph{z}
  230. coordinate of a point.
  231. \GMLAttr{width}{R}{.edge.graphics} Sets the line width (in
  232. pixels). If nothing is specified, 0.0 should be assumed.
  233. \GMLAttr{stipple}{S}{.edge.graphics} Defines a stipple pattern
  234. to draw the line (if the drawing system supports that).
  235. \end{GMLAttributes}
  236. \noindent \emph{This section is subject to be extended.}
  237. \subsection{Edge Attributes}
  238. \label{s:GML:EdgeAttributes}
  239. Each edge must have attributes source and target to specify its
  240. endnodes.In an undirected graph, there is no graph theoretical
  241. distinction between source and target, but the coordinates of the
  242. drawing might impose a direction on the edge.
  243. \begin{GMLAttributes}
  244. \GMLAttr{source}{I}{.edge}
  245. In a directed graph, \texttt{source} defines the source node of
  246. an edge. In an undirected graph, source defines one of the
  247. endpoints of an edge.
  248. \GMLAttr{target}{I}{.edge}
  249. In a directed graph, \texttt{target} defines the source node of
  250. an edge. In an undirected graph, target defines one of the
  251. endpoints of an edge.
  252. \end{GMLAttributes}
  253. %%% Local Variables:
  254. %%% mode: latex
  255. %%% TeX-master: "GML.tex"
  256. %%% End: