Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php |
— | — | @@ -2,8 +2,10 @@ |
3 | 3 | /** |
4 | 4 | * This file contains basic classes for representing (query) descriptions in |
5 | 5 | * the SMW API. |
| 6 | + * |
6 | 7 | * @file |
7 | 8 | * @ingroup SMWQuery |
| 9 | + * |
8 | 10 | * @author Markus Krötzsch |
9 | 11 | */ |
10 | 12 | |
— | — | @@ -20,6 +22,8 @@ |
21 | 23 | /** |
22 | 24 | * Get the (possibly empty) array of all print requests that |
23 | 25 | * exist for the entities that fit this description. |
| 26 | + * |
| 27 | + * @return array |
24 | 28 | */ |
25 | 29 | public function getPrintRequests() { |
26 | 30 | return $this->m_printreqs; |
— | — | @@ -27,11 +31,18 @@ |
28 | 32 | |
29 | 33 | /** |
30 | 34 | * Set the array of print requests completely. |
| 35 | + * |
| 36 | + * @param array $printrequests |
31 | 37 | */ |
32 | | - public function setPrintRequests( $printrequests ) { |
| 38 | + public function setPrintRequests( array $printrequests ) { |
33 | 39 | $this->m_printreqs = $printrequests; |
34 | 40 | } |
35 | 41 | |
| 42 | + /** |
| 43 | + * Add a single SMWPrintRequest. |
| 44 | + * |
| 45 | + * @param SMWPrintRequest $printrequest |
| 46 | + */ |
36 | 47 | public function addPrintRequest( SMWPrintRequest $printrequest ) { |
37 | 48 | $this->m_printreqs[$printrequest->getHash()] = $printrequest; |
38 | 49 | } |
— | — | @@ -39,6 +50,8 @@ |
40 | 51 | /** |
41 | 52 | * Add a new print request, but at the beginning of the list of requests |
42 | 53 | * (thus it will be printed first). |
| 54 | + * |
| 55 | + * @param SMWPrintRequest |
43 | 56 | */ |
44 | 57 | public function prependPrintRequest( SMWPrintRequest $printrequest ) { |
45 | 58 | $this->m_printreqs = array_merge( array( $printrequest->getHash() => $printrequest ), $this->m_printreqs ); |
— | — | @@ -49,20 +62,27 @@ |
50 | 63 | * Some descriptions have different syntax in property value positions. The |
51 | 64 | * parameter $asvalue specifies whether the serialisation should take that into |
52 | 65 | * account. |
| 66 | + * |
53 | 67 | * Example: The SMWValueDescription [[Paris]] returns the single result "Paris" |
54 | 68 | * but can also be used as value in [[has location::Paris]] which is preferred |
55 | 69 | * over the canonical [[has location::\<q\>[[Paris]]\</q\>]]. |
| 70 | + * |
| 71 | + * @param boolean $asvalue |
56 | 72 | */ |
57 | 73 | abstract public function getQueryString( $asvalue = false ); |
58 | 74 | |
59 | 75 | /** |
60 | 76 | * Return true if the description is required to encompass at most a single |
61 | 77 | * result, independently of the knowledge base. |
| 78 | + * |
| 79 | + * @return boolean |
62 | 80 | */ |
63 | 81 | abstract public function isSingleton(); |
64 | 82 | |
65 | 83 | /** |
66 | 84 | * Compute the size of the decription. Default is 1. |
| 85 | + * |
| 86 | + * @return integer |
67 | 87 | */ |
68 | 88 | public function getSize() { |
69 | 89 | return 1; |
— | — | @@ -70,6 +90,8 @@ |
71 | 91 | |
72 | 92 | /** |
73 | 93 | * Compute the depth of the decription. Default is 0. |
| 94 | + * |
| 95 | + * @return integer |
74 | 96 | */ |
75 | 97 | public function getDepth() { |
76 | 98 | return 0; |
— | — | @@ -88,6 +110,8 @@ |
89 | 111 | * Most descriptins can only describe wiki pages, so this is the default, |
90 | 112 | * but some descriptions may refer to other datatypes, and overwrite this |
91 | 113 | * function accordingly. |
| 114 | + * |
| 115 | + * @return string |
92 | 116 | */ |
93 | 117 | public function getTypeID() { |
94 | 118 | return '_wpg'; |
— | — | @@ -100,6 +124,7 @@ |
101 | 125 | * Default implementation for non-nested descriptions of size 1. |
102 | 126 | * The parameter $log contains a list of all pruned conditions, updated when some |
103 | 127 | * description was reduced. |
| 128 | + * |
104 | 129 | * @note Objects must not do changes on $this during pruning, since $this can be |
105 | 130 | * reused in multiple places of one or many queries. Make new objects to reflect |
106 | 131 | * changes! |