r86207 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86206‎ | r86207 | r86208 >
Date:14:30, 16 April 2011
Author:mkroetzsch
Status:deferred
Tags:
Comment:
minor fixes in comments
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php
@@ -10,8 +10,8 @@
1111
1212 /**
1313 * 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.
1616 *
1717 * @defgroup SMWStore SMWStore
1818 * @ingroup SMW
@@ -19,8 +19,8 @@
2020
2121 /**
2222 * 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.
2525 *
2626 * @ingroup SMWStore
2727 *
@@ -103,16 +103,16 @@
104104 public $include_boundary = true;
105105
106106 /**
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.
109109 */
110110 private $stringcond = array();
111111
112112 /**
113113 * Set a new string condition applied to labels of results (if available).
114114 *
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
117117 */
118118 public function addStringCondition( $string, $condition ) {
119119 $this->stringcond[] = new SMWStringCondition( $string, $condition );
@@ -147,39 +147,40 @@
148148 * SMWSemanticData container. There are no options: it just returns all
149149 * available data as shown in the page's Factbox.
150150 * $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.
153153 *
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.
157157 */
158158 public abstract function getSemanticData( SMWDIWikiPage $subject, $filter = false );
159159
160160 /**
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.
163163 *
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.
165166 */
166167 public abstract function getPropertyValues( $subject, SMWDIProperty $property, $requestoptions = null );
167168
168169 /**
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.
172173 */
173174 public abstract function getPropertySubjects( SMWDIProperty $property, $value, $requestoptions = null );
174175
175176 /**
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.
178179 */
179180 public abstract function getAllPropertySubjects( SMWDIProperty $property, $requestoptions = null );
180181
181182 /**
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.
184185 *
185186 * @param $subject SMWDIWikiPage denoting the subject
186187 * @param $requestoptions SMWRequestOptions optionally defining further options
@@ -187,10 +188,11 @@
188189 public abstract function getProperties( SMWDIWikiPage $subject, $requestoptions = null );
189190
190191 /**
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.
195197 */
196198 public abstract function getInProperties( SMWDataItem $object, $requestoptions = null );
197199
@@ -198,16 +200,16 @@
199201
200202 /**
201203 * 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.
205207 */
206208 public abstract function deleteSubject( Title $subject );
207209
208210 /**
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.
212214 */
213215 public abstract function doDataUpdate( SMWSemanticData $data );
214216
@@ -251,22 +253,25 @@
252254 }
253255
254256 /**
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.
261265 */
262266 public abstract function changeTitle( Title $oldtitle, Title $newtitle, $pageid, $redirid = 0 );
263267
264268 ///// Query answering /////
265269
266270 /**
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.
271276 *
272277 * @return SMWQueryResult
273278 */
@@ -275,9 +280,10 @@
276281 ///// Special page functions /////
277282
278283 /**
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.
282288 *
283289 * @param SMWRequestOptions $requestoptions
284290 *
@@ -287,9 +293,9 @@
288294
289295 /**
290296 * 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.
294300 *
295301 * @param SMWRequestOptions $requestoptions
296302 *
@@ -298,10 +304,10 @@
299305 public abstract function getUnusedPropertiesSpecial( $requestoptions = null );
300306
301307 /**
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.
306312 *
307313 * @param SMWRequestOptions $requestoptions
308314 *
@@ -310,8 +316,8 @@
311317 public abstract function getWantedPropertiesSpecial( $requestoptions = null );
312318
313319 /**
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:
316322 * - 'PROPUSES': Number of property instances (value assignments) in the datatbase
317323 * - 'USEDPROPS': Number of properties that are used with at least one value
318324 * - 'DECLPROPS': Number of properties that have been declared (i.e. assigned a type)
@@ -323,47 +329,56 @@
324330 ///// Setup store /////
325331
326332 /**
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.
331339 *
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.
336346 *
337347 * @param boolean $verbose
338348 */
339349 public abstract function setup( $verbose = true );
340350
341351 /**
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.
344354 *
345355 * @param boolean $verbose
346356 */
347357 public abstract function drop( $verbose = true );
348358
349359 /**
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).
357370 *
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.
360374 *
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.
363378 *
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
368383 *
369384 * @return decimal between 0 and 1 to indicate the overall progress of the refreshing
370385 */

Status & tagging log