Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php |
— | — | @@ -10,8 +10,8 @@ |
11 | 11 | |
12 | 12 | /** |
13 | 13 | * This group contains all parts of SMW that relate to storing and retrieving |
14 | | - * semantic data. SMW components that relate to semantic querying only have their |
15 | | - * own group. |
| 14 | + * semantic data. SMW components that relate to semantic querying only have |
| 15 | + * their own group. |
16 | 16 | * |
17 | 17 | * @defgroup SMWStore SMWStore |
18 | 18 | * @ingroup SMW |
— | — | @@ -19,8 +19,8 @@ |
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Small data container class for describing filtering conditions on the string |
23 | | - * label of some entity. States that a given string should either be prefix, postfix, |
24 | | - * or some arbitrary part of labels. |
| 23 | + * label of some entity. States that a given string should either be prefix, |
| 24 | + * postfix, or some arbitrary part of labels. |
25 | 25 | * |
26 | 26 | * @ingroup SMWStore |
27 | 27 | * |
— | — | @@ -103,16 +103,16 @@ |
104 | 104 | public $include_boundary = true; |
105 | 105 | |
106 | 106 | /** |
107 | | - * An array of string conditions that are applied if the result has a string |
108 | | - * label that can be subject to those patterns. |
| 107 | + * An array of string conditions that are applied if the result has a |
| 108 | + * string label that can be subject to those patterns. |
109 | 109 | */ |
110 | 110 | private $stringcond = array(); |
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Set a new string condition applied to labels of results (if available). |
114 | 114 | * |
115 | | - * @param $string the string to match |
116 | | - * @param $condition type of condition, one of STRCOND_PRE, STRCOND_POST, STRCOND_MID |
| 115 | + * @param $string string to match |
| 116 | + * @param $condition integer type of condition, one of STRCOND_PRE, STRCOND_POST, STRCOND_MID |
117 | 117 | */ |
118 | 118 | public function addStringCondition( $string, $condition ) { |
119 | 119 | $this->stringcond[] = new SMWStringCondition( $string, $condition ); |
— | — | @@ -147,39 +147,40 @@ |
148 | 148 | * SMWSemanticData container. There are no options: it just returns all |
149 | 149 | * available data as shown in the page's Factbox. |
150 | 150 | * $filter is an array of strings that are datatype IDs. If given, the |
151 | | - * function will only retreive values for these properties/properties of |
152 | | - * this type. |
| 151 | + * function will avoid any work that is not necessary if only |
| 152 | + * properties of these types are of interest. |
153 | 153 | * |
154 | | - * @note There is no guarantee that the store does not retrieve more data |
155 | | - * than requested when a filter is used. Filtering just ensures that |
156 | | - * only necessary requests are made, i.e. it improves performance. |
| 154 | + * @note There is no guarantee that the store does not retrieve more |
| 155 | + * data than requested when a filter is used. Filtering just ensures |
| 156 | + * that only necessary requests are made, i.e. it improves performance. |
157 | 157 | */ |
158 | 158 | public abstract function getSemanticData( SMWDIWikiPage $subject, $filter = false ); |
159 | 159 | |
160 | 160 | /** |
161 | | - * Get an array of all property values stored for the given subject and property. The result |
162 | | - * is an array of SMWDataItem objects. |
| 161 | + * Get an array of all property values stored for the given subject and |
| 162 | + * property. The result is an array of SMWDataItem objects. |
163 | 163 | * |
164 | | - * If called with $subject == NULL, all values for the given property are returned. |
| 164 | + * If called with $subject == null, all values for the given property |
| 165 | + * are returned. |
165 | 166 | */ |
166 | 167 | public abstract function getPropertyValues( $subject, SMWDIProperty $property, $requestoptions = null ); |
167 | 168 | |
168 | 169 | /** |
169 | | - * Get an array of all subjects that have the given value for the given property. The |
170 | | - * result is an array of SMWDIWikiPage objects. If NULL is given as a value, all subjects having |
171 | | - * that property are returned. |
| 170 | + * Get an array of all subjects that have the given value for the given |
| 171 | + * property. The result is an array of SMWDIWikiPage objects. If null |
| 172 | + * is given as a value, all subjects having that property are returned. |
172 | 173 | */ |
173 | 174 | public abstract function getPropertySubjects( SMWDIProperty $property, $value, $requestoptions = null ); |
174 | 175 | |
175 | 176 | /** |
176 | | - * Get an array of all subjects that have some value for the given property. The |
177 | | - * result is an array of SMWDIWikiPage objects. |
| 177 | + * Get an array of all subjects that have some value for the given |
| 178 | + * property. The result is an array of SMWDIWikiPage objects. |
178 | 179 | */ |
179 | 180 | public abstract function getAllPropertySubjects( SMWDIProperty $property, $requestoptions = null ); |
180 | 181 | |
181 | 182 | /** |
182 | | - * Get an array of all properties for which the given subject has some value. The result is an |
183 | | - * array of SMWDIProperty objects. |
| 183 | + * Get an array of all properties for which the given subject has some |
| 184 | + * value. The result is an array of SMWDIProperty objects. |
184 | 185 | * |
185 | 186 | * @param $subject SMWDIWikiPage denoting the subject |
186 | 187 | * @param $requestoptions SMWRequestOptions optionally defining further options |
— | — | @@ -187,10 +188,11 @@ |
188 | 189 | public abstract function getProperties( SMWDIWikiPage $subject, $requestoptions = null ); |
189 | 190 | |
190 | 191 | /** |
191 | | - * Get an array of all properties for which there is some subject that relates to the given value. |
192 | | - * The result is an array of SMWDIWikiPage objects. |
193 | | - * @note In some stores, this function might be implemented partially so that only values of type Page |
194 | | - * (_wpg) are supported. |
| 192 | + * Get an array of all properties for which there is some subject that |
| 193 | + * relates to the given value. The result is an array of SMWDIWikiPage |
| 194 | + * objects. |
| 195 | + * @note In some stores, this function might be implemented partially |
| 196 | + * so that only values of type Page (_wpg) are supported. |
195 | 197 | */ |
196 | 198 | public abstract function getInProperties( SMWDataItem $object, $requestoptions = null ); |
197 | 199 | |
— | — | @@ -198,16 +200,16 @@ |
199 | 201 | |
200 | 202 | /** |
201 | 203 | * Delete all semantic properties that the given subject has. This |
202 | | - * includes relations, attributes, and special properties. This does not |
203 | | - * delete the respective text from the wiki, but only clears the stored |
204 | | - * data. |
| 204 | + * includes relations, attributes, and special properties. This does |
| 205 | + * not delete the respective text from the wiki, but only clears the |
| 206 | + * stored data. |
205 | 207 | */ |
206 | 208 | public abstract function deleteSubject( Title $subject ); |
207 | 209 | |
208 | 210 | /** |
209 | | - * Update the semantic data stored for some individual. The data is given |
210 | | - * as a SMWSemanticData object, which contains all semantic data for one particular |
211 | | - * subject. |
| 211 | + * Update the semantic data stored for some individual. The data is |
| 212 | + * given as a SMWSemanticData object, which contains all semantic data |
| 213 | + * for one particular subject. |
212 | 214 | */ |
213 | 215 | public abstract function doDataUpdate( SMWSemanticData $data ); |
214 | 216 | |
— | — | @@ -251,22 +253,25 @@ |
252 | 254 | } |
253 | 255 | |
254 | 256 | /** |
255 | | - * Update the store to reflect a renaming of some article. Normally this happens when moving |
256 | | - * pages in the wiki, and in this case there is also a new redirect page generated at the |
257 | | - * old position. The title objects given are only used to specify the name of the title before |
258 | | - * and after the move -- do not use their IDs for anything! The ID of the moved page is given in |
259 | | - * $pageid, and the ID of the newly created redirect, if any, is given by $redirid. If no new |
260 | | - * page was created, $redirid will be 0. |
| 257 | + * Update the store to reflect a renaming of some article. Normally |
| 258 | + * this happens when moving pages in the wiki, and in this case there |
| 259 | + * is also a new redirect page generated at the old position. The title |
| 260 | + * objects given are only used to specify the name of the title before |
| 261 | + * and after the move -- do not use their IDs for anything! The ID of |
| 262 | + * the moved page is given in $pageid, and the ID of the newly created |
| 263 | + * redirect, if any, is given by $redirid. If no new page was created, |
| 264 | + * $redirid will be 0. |
261 | 265 | */ |
262 | 266 | public abstract function changeTitle( Title $oldtitle, Title $newtitle, $pageid, $redirid = 0 ); |
263 | 267 | |
264 | 268 | ///// Query answering ///// |
265 | 269 | |
266 | 270 | /** |
267 | | - * Execute the provided query and return the result as an SMWQueryResult if the query |
268 | | - * was a usual instance retrieval query. In the case that the query asked for a plain |
269 | | - * string (querymode MODE_COUNT or MODE_DEBUG) a plain wiki and HTML-compatible string |
270 | | - * is returned. |
| 271 | + * Execute the provided query and return the result as an |
| 272 | + * SMWQueryResult if the query was a usual instance retrieval query. In |
| 273 | + * the case that the query asked for a plain string (querymode |
| 274 | + * MODE_COUNT or MODE_DEBUG) a plain wiki and HTML-compatible string is |
| 275 | + * returned. |
271 | 276 | * |
272 | 277 | * @return SMWQueryResult |
273 | 278 | */ |
— | — | @@ -275,9 +280,10 @@ |
276 | 281 | ///// Special page functions ///// |
277 | 282 | |
278 | 283 | /** |
279 | | - * Return all properties that have been used on pages in the wiki. The result is an array |
280 | | - * of arrays, each containing a property title and a count. The expected order is |
281 | | - * alphabetical w.r.t. to property title texts. |
| 284 | + * Return all properties that have been used on pages in the wiki. The |
| 285 | + * result is an array of arrays, each containing a property title and a |
| 286 | + * count. The expected order is alphabetical w.r.t. to property title |
| 287 | + * texts. |
282 | 288 | * |
283 | 289 | * @param SMWRequestOptions $requestoptions |
284 | 290 | * |
— | — | @@ -287,9 +293,9 @@ |
288 | 294 | |
289 | 295 | /** |
290 | 296 | * Return all properties that have been declared in the wiki but that |
291 | | - * are not used on any page. Stores might restrict here to those properties |
292 | | - * that have been given a type if they have no efficient means of accessing |
293 | | - * the set of all pages in the property namespace. |
| 297 | + * are not used on any page. Stores might restrict here to those |
| 298 | + * properties that have been given a type if they have no efficient |
| 299 | + * means of accessing the set of all pages in the property namespace. |
294 | 300 | * |
295 | 301 | * @param SMWRequestOptions $requestoptions |
296 | 302 | * |
— | — | @@ -298,10 +304,10 @@ |
299 | 305 | public abstract function getUnusedPropertiesSpecial( $requestoptions = null ); |
300 | 306 | |
301 | 307 | /** |
302 | | - * Return all properties that are used on some page but that do not have any |
303 | | - * page describing them. Stores that have no efficient way of accessing the |
304 | | - * set of all existing pages can extend this list to all properties that are |
305 | | - * used but do not have a type assigned to them. |
| 308 | + * Return all properties that are used on some page but that do not |
| 309 | + * have any page describing them. Stores that have no efficient way of |
| 310 | + * accessing the set of all existing pages can extend this list to all |
| 311 | + * properties that are used but do not have a type assigned to them. |
306 | 312 | * |
307 | 313 | * @param SMWRequestOptions $requestoptions |
308 | 314 | * |
— | — | @@ -310,8 +316,8 @@ |
311 | 317 | public abstract function getWantedPropertiesSpecial( $requestoptions = null ); |
312 | 318 | |
313 | 319 | /** |
314 | | - * Return statistical information as an associative array with the following |
315 | | - * keys: |
| 320 | + * Return statistical information as an associative array with the |
| 321 | + * following keys: |
316 | 322 | * - 'PROPUSES': Number of property instances (value assignments) in the datatbase |
317 | 323 | * - 'USEDPROPS': Number of properties that are used with at least one value |
318 | 324 | * - 'DECLPROPS': Number of properties that have been declared (i.e. assigned a type) |
— | — | @@ -323,47 +329,56 @@ |
324 | 330 | ///// Setup store ///// |
325 | 331 | |
326 | 332 | /** |
327 | | - * Setup all storage structures properly for using the store. This function performs tasks like |
328 | | - * creation of database tables. It is called upon installation as well as on upgrade: hence it |
329 | | - * must be able to upgrade existing storage structures if needed. It should return "true" if |
330 | | - * successful and return a meaningful string error message otherwise. |
| 333 | + * Setup all storage structures properly for using the store. This |
| 334 | + * function performs tasks like creation of database tables. It is |
| 335 | + * called upon installation as well as on upgrade: hence it must be |
| 336 | + * able to upgrade existing storage structures if needed. It should |
| 337 | + * return "true" if successful and return a meaningful string error |
| 338 | + * message otherwise. |
331 | 339 | * |
332 | | - * The parameter $verbose determines whether the procedure is allowed to report on its progress. |
333 | | - * This is doen by just using print and possibly ob_flush/flush. This is also relevant for preventing |
334 | | - * timeouts during long operations. All output must be valid XHTML, but should preferrably be plain |
335 | | - * text, possibly with some linebreaks and weak markup. |
| 340 | + * The parameter $verbose determines whether the procedure is allowed |
| 341 | + * to report on its progress. This is doen by just using print and |
| 342 | + * possibly ob_flush/flush. This is also relevant for preventing |
| 343 | + * timeouts during long operations. All output must be valid in an HTML |
| 344 | + * context, but should preferrably be plain text, possibly with some |
| 345 | + * linebreaks and weak markup. |
336 | 346 | * |
337 | 347 | * @param boolean $verbose |
338 | 348 | */ |
339 | 349 | public abstract function setup( $verbose = true ); |
340 | 350 | |
341 | 351 | /** |
342 | | - * Drop (delete) all storage structures created by setup(). This will delete all semantic data and |
343 | | - * possibly leave the wiki uninitialised. |
| 352 | + * Drop (delete) all storage structures created by setup(). This will |
| 353 | + * delete all semantic data and possibly leave the wiki uninitialised. |
344 | 354 | * |
345 | 355 | * @param boolean $verbose |
346 | 356 | */ |
347 | 357 | public abstract function drop( $verbose = true ); |
348 | 358 | |
349 | 359 | /** |
350 | | - * Refresh some objects in the store, addressed by numerical ids. The meaning of the ids is |
351 | | - * private to the store, and does not need to reflect the use of IDs elsewhere (e.g. page ids). |
352 | | - * The store is to refresh $count objects starting from the given $index. Typically, updates |
353 | | - * are achieved by generating update jobs. After the operation, $index is set to the next |
354 | | - * index that should be used for continuing refreshing, or to -1 for signaling that no objects |
355 | | - * of higher index require refresh. The method returns a decimal number between 0 and 1 to |
356 | | - * indicate the overall progress of the refreshing (e.g. 0.7 if 70% of all objects were refreshed). |
| 360 | + * Refresh some objects in the store, addressed by numerical ids. The |
| 361 | + * meaning of the ids is private to the store, and does not need to |
| 362 | + * reflect the use of IDs elsewhere (e.g. page ids). The store is to |
| 363 | + * refresh $count objects starting from the given $index. Typically, |
| 364 | + * updates are achieved by generating update jobs. After the operation, |
| 365 | + * $index is set to the next index that should be used for continuing |
| 366 | + * refreshing, or to -1 for signaling that no objects of higher index |
| 367 | + * require refresh. The method returns a decimal number between 0 and 1 |
| 368 | + * to indicate the overall progress of the refreshing (e.g. 0.7 if 70% |
| 369 | + * of all objects were refreshed). |
357 | 370 | * |
358 | | - * The optional parameter $namespaces may contain an array of namespace constants. If given, |
359 | | - * only objects from those namespaces will be refreshed. The default value FALSE disables this feature. |
| 371 | + * The optional parameter $namespaces may contain an array of namespace |
| 372 | + * constants. If given, only objects from those namespaces will be |
| 373 | + * refreshed. The default value FALSE disables this feature. |
360 | 374 | * |
361 | | - * The optional parameter $usejobs indicates whether updates should be processed later using |
362 | | - * MediaWiki jobs, instead of doing all updates immediately. The default is TRUE. |
| 375 | + * The optional parameter $usejobs indicates whether updates should be |
| 376 | + * processed later using MediaWiki jobs, instead of doing all updates |
| 377 | + * immediately. The default is TRUE. |
363 | 378 | * |
364 | | - * @param integer $index |
365 | | - * @param integer $count |
366 | | - * @param mixed $namespaces Array or false |
367 | | - * @param boolean $usejobs |
| 379 | + * @param $index integer |
| 380 | + * @param $count integer |
| 381 | + * @param $namespaces mixed array or false |
| 382 | + * @param $usejobs boolean |
368 | 383 | * |
369 | 384 | * @return decimal between 0 and 1 to indicate the overall progress of the refreshing |
370 | 385 | */ |