r25230 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25229‎ | r25230 | r25231 >
Date:13:29, 28 August 2007
Author:proes
Status:old
Tags:
Comment:
Better way of adding objectAttributes to an attribute that needs annotation.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php
@@ -144,8 +144,6 @@
145145
146146 $t->possiblySynonymousId = new Attribute("possibly-synonymous-id", "Possibly synonymous id", "integer");
147147 $t->possibleSynonym = new Attribute("possible-synonym", wfMsgSc("PossibleSynonym"), $t->definedMeaningReferenceStructure);
148 - # Bug found ... This never worked before: (!)
149 - #$t->possiblySynonymousStructure = new Structure("possibly-synonymous", $t->possiblySynonymousId, $t->possiblySynonymous);
150148 $t->possiblySynonymousStructure = new Structure("possibly-synonymous", $t->possiblySynonymousId, $t->possibleSynonym);
151149 $t->possiblySynonymous = new Attribute(null, wfMsgSc("PossiblySynonymous"), $t->possiblySynonymousStructure);
152150
@@ -157,9 +155,9 @@
158156 $t->otherDefinedMeaning = new Attribute("other-defined-meaning", wfMsgSc("OtherDefinedMeaning"), $definedMeaningReferenceType);
159157
160158 global
161 - $wgRelationsAttributeId, $wgIncomingRelationsAttributeId ;
 159+ $wgRelationsAttributeId, $wgIncomingRelationsAttributeId;
162160
163 - $t->relationStructure = new Structure("relations", $t->relationId, $t->relationType, $t->otherDefinedMeaning, $t->objectAttributes);
 161+ $t->relationStructure = new Structure("relations", $t->relationId, $t->relationType, $t->otherDefinedMeaning);
164162 $t->relations = new Attribute("relations", wfMsgSc("Relations"), $t->relationStructure);
165163 $t->reciprocalRelations = new Attribute("reciprocal-relations", wfMsgSc("IncomingRelations"), $t->relationStructure);
166164 $t->translatedTextId = new Attribute("translated-text-id", "Translated text ID", "integer");
@@ -188,27 +186,27 @@
189187 else
190188 $synonymsAndTranslationsCaption = wfMsgSc("SynonymsAndTranslations");
191189
192 - $t->attributeObjectId = new Attribute("attributeObjectId", "Attribute object", "object-id");
193 -
194190 $t->syntransId = new Attribute("syntrans-id", "$synonymsAndTranslationsCaption identifier", "integer");
195 - $t->synonymsTranslationsStructure = new Structure("synonyms-translations", $t->syntransId, $t->expression, $t->identicalMeaning, $t->objectAttributes);
 191+ $t->synonymsTranslationsStructure = new Structure("synonyms-translations", $t->syntransId, $t->expression, $t->identicalMeaning);
196192 $t->synonymsAndTranslations = new Attribute(null, "$synonymsAndTranslationsCaption", $t->synonymsTranslationsStructure);
197193 $t->translatedTextAttributeId = new Attribute("translated-text-attribute-id", "Attribute identifier", "object-id");
198194 $t->translatedTextAttribute = new Attribute("translated-text-attribute", wfMsgSc("TranslatedTextAttribute"), $definedMeaningReferenceType);
199195 $t->translatedTextValueId = new Attribute("translated-text-value-id", "Translated text value identifier", "translated-text-value-id");
200196
 197+ $t->attributeObjectId = new Attribute("attributeObjectId", "Attribute object", "object-id");
 198+
201199 if ($viewInformation->filterOnLanguage() && !$viewInformation->hasMetaDataAttributes())
202200 $t->translatedTextValue = new Attribute("translated-text-value", wfMsgSc("TranslatedTextAttributeValue"), "text");
203201 else
204202 $t->translatedTextValue = new Attribute("translated-text-value", wfMsgSc("TranslatedTextAttributeValue"), $t->translatedTextStructure);
205203
206 - $t->translatedTextAttributeValuesStructure = new Structure("translated-text-attribute-values",$t->translatedTextAttributeId, $t->attributeObjectId, $t->translatedTextAttribute, $t->translatedTextValueId, $t->translatedTextValue, $t->objectAttributes);
 204+ $t->translatedTextAttributeValuesStructure = new Structure("translated-text-attribute-values",$t->translatedTextAttributeId, $t->attributeObjectId, $t->translatedTextAttribute, $t->translatedTextValueId, $t->translatedTextValue);
207205 $t->translatedTextAttributeValues = new Attribute(null, wfMsgSc("TranslatedTextAttributeValues"), $t->translatedTextAttributeValuesStructure);
208206 $t->attributeObject = new Attribute("attribute-object-id", "Attribute object", "object-id");
209207 $t->textAttributeId = new Attribute("text-attribute-id", "Attribute identifier", "object-id");
210208 $t->textAttributeObject = new Attribute("text-attribute-object-id", "Attribute object", "object-id");
211209 $t->textAttribute = new Attribute("text-attribute", wfMsgSc("TextAttribute"), $t->definedMeaningReferenceStructure);
212 - $t->textAttributeValuesStructure = new Structure("text-attribute-values", $t->textAttributeId, $t->textAttributeObject, $t->textAttribute, $t->text, $t->objectAttributes);
 210+ $t->textAttributeValuesStructure = new Structure("text-attribute-values", $t->textAttributeId, $t->textAttributeObject, $t->textAttribute, $t->text);
213211 $t->textAttributeValues = new Attribute(null, wfMsgSc("TextAttributeValues"), $t->textAttributeValuesStructure);
214212 $t->linkLabel = new Attribute("label", "Label", "short-text");
215213 $t->linkURL = new Attribute("url", "URL", "url");
@@ -217,13 +215,13 @@
218216 $t->linkAttributeId = new Attribute("link-attribute-id", "Attribute identifier", "object-id");
219217 $t->linkAttributeObject = new Attribute("link-attribute-object-id", "Attribute object", "object-id");
220218 $t->linkAttribute = new Attribute("link-attribute", wfMsgSc("LinkAttribute"), $t->definedMeaningReferenceStructure);
221 - $t->linkAttributeValuesStructure = new Structure("link-attribute-values", $t->linkAttributeId, $t->linkAttributeObject, $t->linkAttribute, $t->link, $t->objectAttributes);
 219+ $t->linkAttributeValuesStructure = new Structure("link-attribute-values", $t->linkAttributeId, $t->linkAttributeObject, $t->linkAttribute, $t->link);
222220 $t->linkAttributeValues = new Attribute(null, wfMsgSc("LinkAttributeValues"), $t->linkAttributeValuesStructure);
223221 $t->optionAttributeId = new Attribute("option-attribute-id", "Attribute identifier", "object-id");
224222 $t->optionAttributeObject = new Attribute("option-attribute-object-id", "Attribute object", "object-id");
225223 $t->optionAttribute = new Attribute("option-attribute", wfMsgSc("OptionAttribute"), $definedMeaningReferenceType);
226224 $t->optionAttributeOption = new Attribute("option-attribute-option", wfMsgSc("OptionAttributeOption"), $definedMeaningReferenceType);
227 - $t->optionAttributeValuesStructure = new Structure("option-attribute-values", $t->optionAttributeId, $t->optionAttribute, $t->optionAttributeObject, $t->optionAttributeOption, $t->objectAttributes);
 225+ $t->optionAttributeValuesStructure = new Structure("option-attribute-values", $t->optionAttributeId, $t->optionAttribute, $t->optionAttributeObject, $t->optionAttributeOption);
228226 $t->optionAttributeValues = new Attribute(null, wfMsgSc("OptionAttributeValues"), $t->optionAttributeValuesStructure);
229227 $t->optionAttributeOptionId = new Attribute("option-attribute-option-id", "Option identifier", "object-id");
230228 $t->optionAttributeOptionsStructure = new Structure("option-attribute-options", $t->optionAttributeOptionId, $t->optionAttribute, $t->optionAttributeOption, $t->language);
@@ -234,7 +232,7 @@
235233 else
236234 $t->translatedText = new Attribute("translated-text", wfMsgSc("TranslatedText"), $t->translatedTextStructure);
237235
238 - $t->definition = new Attribute(null, wfMsgSc("Definition"), new Structure("definition", $t->translatedText, $t->objectAttributes));
 236+ $t->definition = new Attribute(null, wfMsgSc("Definition"), new Structure("definition", $t->translatedText));
239237
240238 global
241239 $wgClassAttributesAttributeId;
@@ -265,7 +263,6 @@
266264 $t->expressionMeaningStructure = new Structure($t->definedMeaningId, $t->text, $t->definedMeaning);
267265 $t->expressionExactMeanings = new Attribute("expression-exact-meanings", wfMsgSc("ExactMeanings"), $t->expressionMeaningStructure);
268266 $t->expressionApproximateMeanings = new Attribute("expression-approximate-meanings", wfMsgSc("ApproximateMeanings"), $t->expressionMeaningStructure);
269 - # bug found here also: $t->expressionAoproximateMeaning_S_
270267 $t->expressionMeaningsStructure = new Structure("expression-meanings", $t->expressionExactMeanings, $t->expressionApproximateMeanings);
271268 $t->expressionMeanings = new Attribute(null, wfMsgSc("ExpressionMeanings"), $t->expressionMeaningsStructure);
272269 $t->expressionsStructure = new Structure("expressions", $t->expressionId, $t->expression, $t->expressionMeanings);
@@ -287,6 +284,9 @@
288285 $t->optionAttributeValues
289286 );
290287
 288+ foreach ($annotatedAttributes as $annotatedAttribute)
 289+ $annotatedAttribute->type->addAttribute($t->objectAttributes);
 290+
291291 foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) {
292292 $attribute = $propertyToColumnFilter->getAttribute();
293293 $attribute->setAttributeType($t->objectAttributesStructure);
@@ -294,6 +294,7 @@
295295 foreach ($annotatedAttributes as $annotatedAttribute)
296296 $annotatedAttribute->type->addAttribute($attribute);
297297 }
 298+
298299 $t->in_setup=False;
299300 }
300301

Status & tagging log