Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exp_Data.php |
— | — | @@ -50,6 +50,8 @@ |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Return subject to which the stored semantic annotation refer to. |
| 54 | + * |
| 55 | + * @return SMWExpElement |
54 | 56 | */ |
55 | 57 | public function getSubject() { |
56 | 58 | return $this->m_subject; |
— | — | @@ -57,6 +59,8 @@ |
58 | 60 | |
59 | 61 | /** |
60 | 62 | * Set the subject element. |
| 63 | + * |
| 64 | + * @param SMWExpResource $subject |
61 | 65 | */ |
62 | 66 | public function setSubject( SMWExpResource $subject ) { |
63 | 67 | $this->m_subject = $subject; |
— | — | @@ -64,7 +68,10 @@ |
65 | 69 | |
66 | 70 | /** |
67 | 71 | * Store a value for a property identified by its title object. No duplicate elimination as this |
68 | | - * is usually done in SMWSemanticData already (which is typically used to generate this object) |
| 72 | + * is usually done in SMWSemanticData already (which is typically used to generate this object). |
| 73 | + * |
| 74 | + * @param SMWExpResource $property |
| 75 | + * @param SMWExpData $child |
69 | 76 | */ |
70 | 77 | public function addPropertyObjectValue( SMWExpResource $property, SMWExpData $child ) { |
71 | 78 | if ( !array_key_exists( $property->getName(), $this->m_edges ) ) { |
— | — | @@ -76,13 +83,17 @@ |
77 | 84 | |
78 | 85 | /** |
79 | 86 | * Return the list of SMWExpElements for all properties for which some values exist. |
| 87 | + * |
| 88 | + * @return array of SMWExpElements |
80 | 89 | */ |
81 | 90 | public function getProperties() { |
82 | 91 | return $this->m_edges; |
83 | 92 | } |
84 | 93 | |
85 | 94 | /** |
86 | | - * Return the list of SMWExpData values associated to some property (element) |
| 95 | + * Return the list of SMWExpData values associated to some property (element). |
| 96 | + * |
| 97 | + * @return array of SMWExpData |
87 | 98 | */ |
88 | 99 | public function getValues( SMWExpResource $property ) { |
89 | 100 | if ( array_key_exists( $property->getName(), $this->m_children ) ) { |
— | — | @@ -95,6 +106,8 @@ |
96 | 107 | /** |
97 | 108 | * Return the list of SMWExpData values associated to some property that is |
98 | 109 | * specifed by a standard namespace id and local name. |
| 110 | + * |
| 111 | + * @return array of SMWExpData |
99 | 112 | */ |
100 | 113 | public function getSpecialValues( $namespace, $localname ) { |
101 | 114 | $pe = SMWExporter::getSpecialElement( $namespace, $localname ); |
— | — | @@ -175,23 +188,29 @@ |
176 | 189 | */ |
177 | 190 | public function getTripleList() { |
178 | 191 | global $smwgBnodeCount; |
| 192 | + |
179 | 193 | if ( !isset( $smwgBnodeCount ) ) { |
180 | 194 | $smwgBnodeCount = 0; |
181 | 195 | } |
| 196 | + |
182 | 197 | $result = array(); |
| 198 | + |
183 | 199 | foreach ( $this->m_edges as $key => $edge ) { |
184 | 200 | foreach ( $this->m_children[$key] as $child ) { |
185 | 201 | $name = $child->getSubject()->getName(); |
186 | | - if ( ( $name == '' ) || ( $name[0] == '_' ) ) { // bnode, rename ID to avoid unifying bnodes of different contexts |
| 202 | + |
| 203 | + if ( $name === '' || $name[0] === '_' ) { // bnode, rename ID to avoid unifying bnodes of different contexts |
187 | 204 | // TODO: should we really rename bnodes of the form "_id" here? |
188 | 205 | $child = clone $child; |
189 | 206 | $subject = new SMWExpResource( '_' . $smwgBnodeCount++, $child->getSubject()->getDataValue() ); |
190 | 207 | $child->setSubject( $subject ); |
191 | 208 | } |
| 209 | + |
192 | 210 | $result[] = array( $this->m_subject, $edge, $child->getSubject() ); |
193 | 211 | $result = array_merge( $result, $child->getTripleList() ); // recursively generate all children's triples |
194 | 212 | } |
195 | 213 | } |
| 214 | + |
196 | 215 | return $result; |
197 | 216 | } |
198 | 217 | |