| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 5 | <title>Variables</title> |
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> |
| 7 | <link rel="home" href="index.html" title="Rasqal RDF Query Library Manual"> |
| 8 | <link rel="up" href="reference-manual.html" title="Part I. Reference Manual"> |
| 9 | <link rel="prev" href="rasqal-section-triples-source.html" title="Triples Source"> |
| 10 | <link rel="next" href="rasqal-section-variables-table.html" title="Variables Table"> |
| 11 | <meta name="generator" content="GTK-Doc V1.18 (XML mode)"> |
| 12 | <link rel="stylesheet" href="style.css" type="text/css"> |
| 13 | </head> |
| 14 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| 15 | <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> |
| 16 | <tr valign="middle"> |
| 17 | <td><a accesskey="p" href="rasqal-section-triples-source.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> |
| 18 | <td><a accesskey="u" href="reference-manual.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> |
| 19 | <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> |
| 20 | <th width="100%" align="center">Rasqal RDF Query Library Manual</th> |
| 21 | <td><a accesskey="n" href="rasqal-section-variables-table.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> |
| 22 | </tr> |
| 23 | <tr><td colspan="5" class="shortcuts"> |
| 24 | <a href="#rasqal-section-variable.synopsis" class="shortcut">Top</a> |
| 25 | | |
| 26 | <a href="#rasqal-section-variable.description" class="shortcut">Description</a> |
| 27 | </td></tr> |
| 28 | </table> |
| 29 | <div class="refentry"> |
| 30 | <a name="rasqal-section-variable"></a><div class="titlepage"></div> |
| 31 | <div class="refnamediv"><table width="100%"><tr> |
| 32 | <td valign="top"> |
| 33 | <h2><span class="refentrytitle"><a name="rasqal-section-variable.top_of_page"></a>Variables</span></h2> |
| 34 | <p>Variables — Variable with names and literal value.</p> |
| 35 | </td> |
| 36 | <td valign="top" align="right"></td> |
| 37 | </tr></table></div> |
| 38 | <div class="refsynopsisdiv"> |
| 39 | <a name="rasqal-section-variable.synopsis"></a><h2>Synopsis</h2> |
| 40 | <pre class="synopsis"> <a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable">rasqal_variable</a>; |
| 41 | <a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="returnvalue">rasqal_variable</span></a> * <a class="link" href="rasqal-section-variable.html#rasqal-new-variable-from-variable" title="rasqal_new_variable_from_variable ()">rasqal_new_variable_from_variable</a> (<em class="parameter"><code><a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> *v</code></em>); |
| 42 | <span class="returnvalue">void</span> <a class="link" href="rasqal-section-variable.html#rasqal-free-variable" title="rasqal_free_variable ()">rasqal_free_variable</a> (<em class="parameter"><code><a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> *v</code></em>); |
| 43 | <span class="returnvalue">int</span> <a class="link" href="rasqal-section-variable.html#rasqal-variable-print" title="rasqal_variable_print ()">rasqal_variable_print</a> (<em class="parameter"><code><a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> *v</code></em>, |
| 44 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>); |
| 45 | <span class="returnvalue">void</span> <a class="link" href="rasqal-section-variable.html#rasqal-variable-set-value" title="rasqal_variable_set_value ()">rasqal_variable_set_value</a> (<em class="parameter"><code><a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> *v</code></em>, |
| 46 | <em class="parameter"><code><a class="link" href="rasqal-section-literal.html#rasqal-literal" title="rasqal_literal"><span class="type">rasqal_literal</span></a> *l</code></em>); |
| 47 | enum <a class="link" href="rasqal-section-variable.html#rasqal-variable-type" title="enum rasqal_variable_type">rasqal_variable_type</a>; |
| 48 | </pre> |
| 49 | </div> |
| 50 | <div class="refsect1"> |
| 51 | <a name="rasqal-section-variable.description"></a><h2>Description</h2> |
| 52 | <p> |
| 53 | A class to hold a variable with optional name and a |
| 54 | <a class="link" href="rasqal-section-literal.html#rasqal-literal" title="rasqal_literal"><span class="type">rasqal_literal</span></a> value. The name is not required for SPARQL |
| 55 | anonymous variables. |
| 56 | </p> |
| 57 | </div> |
| 58 | <div class="refsect1"> |
| 59 | <a name="rasqal-section-variable.details"></a><h2>Details</h2> |
| 60 | <div class="refsect2"> |
| 61 | <a name="rasqal-variable"></a><h3>rasqal_variable</h3> |
| 62 | <pre class="programlisting">typedef struct { |
| 63 | rasqal_variables_table* vars_table; |
| 64 | const char * name; |
| 65 | rasqal_literal* value; |
| 66 | int offset; |
| 67 | rasqal_variable_type type; |
| 68 | struct rasqal_expression_s* expression; |
| 69 | void *user_data; |
| 70 | int usage; |
| 71 | } rasqal_variable; |
| 72 | </pre> |
| 73 | <p> |
| 74 | Binding between a variable name and a value. |
| 75 | </p> |
| 76 | <p> |
| 77 | Includes internal field <em class="parameter"><code>offset</code></em> for recording the offset into the |
| 78 | (internal) rasqal_query variables array. |
| 79 | </p> |
| 80 | <div class="variablelist"><table border="0"> |
| 81 | <col align="left" valign="top"> |
| 82 | <tbody> |
| 83 | <tr> |
| 84 | <td><p><span class="term"><a class="link" href="rasqal-section-variables-table.html#rasqal-variables-table" title="rasqal_variables_table"><span class="type">rasqal_variables_table</span></a> *<em class="structfield"><code><a name="rasqal-variable.vars-table"></a>vars_table</code></em>;</span></p></td> |
| 85 | <td>variables table that owns this variable</td> |
| 86 | </tr> |
| 87 | <tr> |
| 88 | <td><p><span class="term">const <span class="type">char</span> *<em class="structfield"><code><a name="rasqal-variable.name"></a>name</code></em>;</span></p></td> |
| 89 | <td>Variable name.</td> |
| 90 | </tr> |
| 91 | <tr> |
| 92 | <td><p><span class="term"><a class="link" href="rasqal-section-literal.html#rasqal-literal" title="rasqal_literal"><span class="type">rasqal_literal</span></a> *<em class="structfield"><code><a name="rasqal-variable.value"></a>value</code></em>;</span></p></td> |
| 93 | <td>Variable value or NULL if unbound.</td> |
| 94 | </tr> |
| 95 | <tr> |
| 96 | <td><p><span class="term"><span class="type">int</span> <em class="structfield"><code><a name="rasqal-variable.offset"></a>offset</code></em>;</span></p></td> |
| 97 | <td>Internal.</td> |
| 98 | </tr> |
| 99 | <tr> |
| 100 | <td><p><span class="term"><a class="link" href="rasqal-section-variable.html#rasqal-variable-type" title="enum rasqal_variable_type"><span class="type">rasqal_variable_type</span></a> <em class="structfield"><code><a name="rasqal-variable.type"></a>type</code></em>;</span></p></td> |
| 101 | <td>Variable type.</td> |
| 102 | </tr> |
| 103 | <tr> |
| 104 | <td><p><span class="term">struct <span class="type">rasqal_expression_s</span> *<em class="structfield"><code><a name="rasqal-variable.expression"></a>expression</code></em>;</span></p></td> |
| 105 | <td>Expression when the variable is a computed SELECT expression</td> |
| 106 | </tr> |
| 107 | <tr> |
| 108 | <td><p><span class="term"><span class="type">void</span> *<em class="structfield"><code><a name="rasqal-variable.user-data"></a>user_data</code></em>;</span></p></td> |
| 109 | <td>Pointer to user data associated with a variable. This is not used by rasqal.</td> |
| 110 | </tr> |
| 111 | <tr> |
| 112 | <td><p><span class="term"><span class="type">int</span> <em class="structfield"><code><a name="rasqal-variable.usage"></a>usage</code></em>;</span></p></td> |
| 113 | <td>reference count</td> |
| 114 | </tr> |
| 115 | </tbody> |
| 116 | </table></div> |
| 117 | </div> |
| 118 | <hr> |
| 119 | <div class="refsect2"> |
| 120 | <a name="rasqal-new-variable-from-variable"></a><h3>rasqal_new_variable_from_variable ()</h3> |
| 121 | <pre class="programlisting"><a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="returnvalue">rasqal_variable</span></a> * rasqal_new_variable_from_variable (<em class="parameter"><code><a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> *v</code></em>);</pre> |
| 122 | <p> |
| 123 | Copy Constructor - Create a new Rasqal variable from an existing one |
| 124 | </p> |
| 125 | <p> |
| 126 | This adds a new reference to the variable, it does not do a deep copy |
| 127 | </p> |
| 128 | <div class="variablelist"><table border="0"> |
| 129 | <col align="left" valign="top"> |
| 130 | <tbody> |
| 131 | <tr> |
| 132 | <td><p><span class="term"><em class="parameter"><code>v</code></em> :</span></p></td> |
| 133 | <td> |
| 134 | <a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> to copy</td> |
| 135 | </tr> |
| 136 | <tr> |
| 137 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 138 | <td>a new <a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> or NULL on failure.</td> |
| 139 | </tr> |
| 140 | </tbody> |
| 141 | </table></div> |
| 142 | </div> |
| 143 | <hr> |
| 144 | <div class="refsect2"> |
| 145 | <a name="rasqal-free-variable"></a><h3>rasqal_free_variable ()</h3> |
| 146 | <pre class="programlisting"><span class="returnvalue">void</span> rasqal_free_variable (<em class="parameter"><code><a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> *v</code></em>);</pre> |
| 147 | <p> |
| 148 | Destructor - Destroy a Rasqal variable object. |
| 149 | </p> |
| 150 | <div class="variablelist"><table border="0"> |
| 151 | <col align="left" valign="top"> |
| 152 | <tbody><tr> |
| 153 | <td><p><span class="term"><em class="parameter"><code>v</code></em> :</span></p></td> |
| 154 | <td> |
| 155 | <a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> object</td> |
| 156 | </tr></tbody> |
| 157 | </table></div> |
| 158 | </div> |
| 159 | <hr> |
| 160 | <div class="refsect2"> |
| 161 | <a name="rasqal-variable-print"></a><h3>rasqal_variable_print ()</h3> |
| 162 | <pre class="programlisting"><span class="returnvalue">int</span> rasqal_variable_print (<em class="parameter"><code><a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> *v</code></em>, |
| 163 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>);</pre> |
| 164 | <p> |
| 165 | Print a Rasqal variable in a debug format. |
| 166 | </p> |
| 167 | <p> |
| 168 | The print debug format may change in any release. |
| 169 | </p> |
| 170 | <div class="variablelist"><table border="0"> |
| 171 | <col align="left" valign="top"> |
| 172 | <tbody> |
| 173 | <tr> |
| 174 | <td><p><span class="term"><em class="parameter"><code>v</code></em> :</span></p></td> |
| 175 | <td>the <a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> object</td> |
| 176 | </tr> |
| 177 | <tr> |
| 178 | <td><p><span class="term"><em class="parameter"><code>fh</code></em> :</span></p></td> |
| 179 | <td>the FILE* handle to print to</td> |
| 180 | </tr> |
| 181 | <tr> |
| 182 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 183 | <td>non-0 on failure</td> |
| 184 | </tr> |
| 185 | </tbody> |
| 186 | </table></div> |
| 187 | </div> |
| 188 | <hr> |
| 189 | <div class="refsect2"> |
| 190 | <a name="rasqal-variable-set-value"></a><h3>rasqal_variable_set_value ()</h3> |
| 191 | <pre class="programlisting"><span class="returnvalue">void</span> rasqal_variable_set_value (<em class="parameter"><code><a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> *v</code></em>, |
| 192 | <em class="parameter"><code><a class="link" href="rasqal-section-literal.html#rasqal-literal" title="rasqal_literal"><span class="type">rasqal_literal</span></a> *l</code></em>);</pre> |
| 193 | <p> |
| 194 | Set the value of a Rasqal variable. |
| 195 | </p> |
| 196 | <p> |
| 197 | The variable value is an input parameter and is copied in, not shared. |
| 198 | If the variable value is NULL, any existing value is deleted. |
| 199 | </p> |
| 200 | <div class="variablelist"><table border="0"> |
| 201 | <col align="left" valign="top"> |
| 202 | <tbody> |
| 203 | <tr> |
| 204 | <td><p><span class="term"><em class="parameter"><code>v</code></em> :</span></p></td> |
| 205 | <td>the <a class="link" href="rasqal-section-variable.html#rasqal-variable" title="rasqal_variable"><span class="type">rasqal_variable</span></a> object</td> |
| 206 | </tr> |
| 207 | <tr> |
| 208 | <td><p><span class="term"><em class="parameter"><code>l</code></em> :</span></p></td> |
| 209 | <td>the <a class="link" href="rasqal-section-literal.html#rasqal-literal" title="rasqal_literal"><span class="type">rasqal_literal</span></a> value to set (or NULL)</td> |
| 210 | </tr> |
| 211 | </tbody> |
| 212 | </table></div> |
| 213 | </div> |
| 214 | <hr> |
| 215 | <div class="refsect2"> |
| 216 | <a name="rasqal-variable-type"></a><h3>enum rasqal_variable_type</h3> |
| 217 | <pre class="programlisting">typedef enum { |
| 218 | RASQAL_VARIABLE_TYPE_UNKNOWN = 0, |
| 219 | RASQAL_VARIABLE_TYPE_NORMAL = 1, |
| 220 | RASQAL_VARIABLE_TYPE_ANONYMOUS = 2 |
| 221 | } rasqal_variable_type; |
| 222 | </pre> |
| 223 | <p> |
| 224 | Rasqal variable types. |
| 225 | </p> |
| 226 | <p> |
| 227 | ANONYMOUS can be used in queries but cannot be returned in a |
| 228 | result. |
| 229 | </p> |
| 230 | <div class="variablelist"><table border="0"> |
| 231 | <col align="left" valign="top"> |
| 232 | <tbody> |
| 233 | <tr> |
| 234 | <td><p><a name="RASQAL-VARIABLE-TYPE-UNKNOWN:CAPS"></a><span class="term"><code class="literal">RASQAL_VARIABLE_TYPE_UNKNOWN</code></span></p></td> |
| 235 | <td>Internal. |
| 236 | </td> |
| 237 | </tr> |
| 238 | <tr> |
| 239 | <td><p><a name="RASQAL-VARIABLE-TYPE-NORMAL:CAPS"></a><span class="term"><code class="literal">RASQAL_VARIABLE_TYPE_NORMAL</code></span></p></td> |
| 240 | <td>The regular variable type. |
| 241 | </td> |
| 242 | </tr> |
| 243 | <tr> |
| 244 | <td><p><a name="RASQAL-VARIABLE-TYPE-ANONYMOUS:CAPS"></a><span class="term"><code class="literal">RASQAL_VARIABLE_TYPE_ANONYMOUS</code></span></p></td> |
| 245 | <td>Anonymous variable type. |
| 246 | </td> |
| 247 | </tr> |
| 248 | </tbody> |
| 249 | </table></div> |
| 250 | </div> |
| 251 | </div> |
| 252 | </div> |
| 253 | <div class="footer"> |
| 254 | <hr> |
| 255 | Generated by GTK-Doc V1.18</div> |
| 256 | </body> |
| 257 | </html> |