Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php |
— | — | @@ -204,12 +204,16 @@ |
205 | 205 | $synonymsAndTranslationsAttribute = new Attribute(null, "$synonymsAndTranslationsCaption", $synonymsTranslationsStructure); |
206 | 206 | |
207 | 207 | global |
| 208 | + $attributeObjectAttribute; |
| 209 | + |
| 210 | + $attributeObjectAttribute = new Attribute("attribute-object-id", "Attribute object", "object-id"); |
| 211 | + |
| 212 | + global |
208 | 213 | $translatedTextAttributeIdAttribute, $translatedTextValueIdAttribute, |
209 | | - $translatedTextAttributeObjectAttribute, $translatedTextAttributeAttribute, $translatedTextValueAttribute, $translatedTextAttributeValuesAttribute, |
| 214 | + $translatedTextAttributeAttribute, $translatedTextValueAttribute, $translatedTextAttributeValuesAttribute, |
210 | 215 | $translatedTextAttributeValuesStructure, $wgTranslatedTextAttributeValuesAttributeName, $wgTranslatedTextAttributeAttributeName, $wgTranslatedTextAttributeValueAttributeName; |
211 | 216 | |
212 | 217 | $translatedTextAttributeIdAttribute = new Attribute("translated-text-attribute-id", "Attribute identifier", "object-id"); |
213 | | - $translatedTextAttributeObjectAttribute = new Attribute("translated-text-attribute-object-id", "Attribute object", "object-id"); |
214 | 218 | $translatedTextAttributeAttribute = new Attribute("translated-text-attribute", $wgTranslatedTextAttributeAttributeName, $definedMeaningReferenceType); |
215 | 219 | $translatedTextValueIdAttribute = new Attribute("translated-text-value-id", "Translated text value identifier", "translated-text-value-id"); |
216 | 220 | |
— | — | @@ -218,7 +222,7 @@ |
219 | 223 | else |
220 | 224 | $translatedTextValueAttribute = new Attribute("translated-text", $wgTranslatedTextAttributeValueAttributeName, $translatedTextStructure); |
221 | 225 | |
222 | | - $translatedTextAttributeValuesStructure = new Structure("translated-text-attribute-values",$translatedTextAttributeIdAttribute, $translatedTextAttributeObjectAttribute, $translatedTextAttributeAttribute, $translatedTextValueIdAttribute, $translatedTextValueAttribute, $objectAttributesAttribute); |
| 226 | + $translatedTextAttributeValuesStructure = new Structure("translated-text-attribute-values",$translatedTextAttributeIdAttribute, $attributeObjectAttribute, $translatedTextAttributeAttribute, $translatedTextValueIdAttribute, $translatedTextValueAttribute, $objectAttributesAttribute); |
223 | 227 | $translatedTextAttributeValuesAttribute = new Attribute(null, $wgTranslatedTextAttributeValuesAttributeName, $translatedTextAttributeValuesStructure); |
224 | 228 | |
225 | 229 | global |
— | — | @@ -426,6 +430,7 @@ |
427 | 431 | $t->class = new Attribute("class", "Class", $t->definedMeaningReferenceStructure); |
428 | 432 | $t->classMembershipStructure = new Structure("class-membership", $t->classMembershipId, $t->class); |
429 | 433 | $t->classMembership = new Attribute(null, wfMsg("ClassMembership"), $t->classMembershipStructure); |
| 434 | + |
430 | 435 | global |
431 | 436 | $wgPossiblySynonymousAttributeId; |
432 | 437 | |
— | — | @@ -437,14 +442,14 @@ |
438 | 443 | $t->possiblySynonymous = new Attribute(null, wfMsg("PossiblySynonymous"), $t->possiblySynonymousStructure); |
439 | 444 | |
440 | 445 | global |
441 | | - $relationTypeType; |
| 446 | + $relationTypeType; |
442 | 447 | |
443 | 448 | $t->relationId = new Attribute("relation-id", "Relation identifier", "object-id"); |
444 | 449 | $t->relationType = new Attribute("relation-type", wfMsg("RelationType"), $t->definedMeaningReferenceStructure); |
445 | 450 | $t->otherDefinedMeaning = new Attribute("other-defined-meaning", wfMsg("OtherDefinedMeaning"), $definedMeaningReferenceType); |
446 | 451 | |
447 | 452 | global |
448 | | - $wgRelationsAttributeId, $wgIncomingRelationsAttributeId ; |
| 453 | + $wgRelationsAttributeId, $wgIncomingRelationsAttributeId ; |
449 | 454 | |
450 | 455 | $t->relationStructure = new Structure("relations", $t->relationId, $t->relationType, $t->otherDefinedMeaning, $t->objectAttributes); |
451 | 456 | $t->relations = new Attribute(null, wfMsg("Relations"), $t->relationStructure); |
— | — | @@ -476,11 +481,12 @@ |
477 | 482 | else |
478 | 483 | $synonymsAndTranslationsCaption = wfMsg("SynonymsAndTranslations"); |
479 | 484 | |
| 485 | + $t->attributeObjectId = new Attribute("attributeObjectId", "Attribute object", "object-id"); |
| 486 | + |
480 | 487 | $t->syntransId = new Attribute("syntrans-id", "$synonymsAndTranslationsCaption identifier", "integer"); |
481 | 488 | $t->synonymsTranslationsStructure = new Structure("synonyms-translations", $t->syntransId, $t->expression, $t->identicalMeaning, $t->objectAttributes); |
482 | 489 | $t->synonymsAndTranslations = new Attribute(null, "$synonymsAndTranslationsCaption", $t->synonymsTranslationsStructure); |
483 | 490 | $t->translatedTextAttributeId = new Attribute("translated-text-attribute-id", "Attribute identifier", "object-id"); |
484 | | - $t->translatedTextAttributeObject = new Attribute("translated-text-attribute-object-id", "Attribute object", "object-id"); |
485 | 491 | $t->translatedTextAttribute = new Attribute("translated-text-attribute", wfMsg("TranslatedTextAttribute"), $definedMeaningReferenceType); |
486 | 492 | $t->translatedTextValueId = new Attribute("translated-text-value-id", "Translated text value identifier", "translated-text-value-id"); |
487 | 493 | |
— | — | @@ -489,7 +495,7 @@ |
490 | 496 | else |
491 | 497 | $t->translatedTextValue = new Attribute("translated-text", wfMsg("TranslatedTextAttributeValue"), $t->translatedTextStructure); |
492 | 498 | |
493 | | - $t->translatedTextAttributeValuesStructure = new Structure("translated-text-attribute-values",$t->translatedTextAttributeId, $t->translatedTextAttributeObject, $t->translatedTextAttribute, $t->translatedTextValueId, $t->translatedTextValue, $t->objectAttributes); |
| 499 | + $t->translatedTextAttributeValuesStructure = new Structure("translated-text-attribute-values",$t->translatedTextAttributeId, $t->attributeObjectId, $t->translatedTextAttribute, $t->translatedTextValueId, $t->translatedTextValue, $t->objectAttributes); |
494 | 500 | $t->translatedTextAttributeValues = new Attribute(null, wfMsg("TranslatedTextAttributeValues"), $t->translatedTextAttributeValuesStructure); |
495 | 501 | $t->textAttributeId = new Attribute("text-attribute-id", "Attribute identifier", "object-id"); |
496 | 502 | $t->textAttributeObject = new Attribute("text-attribute-object-id", "Attribute object", "object-id"); |
— | — | @@ -514,6 +520,7 @@ |
515 | 521 | $t->optionAttributeOptionId = new Attribute('option-attribute-option-id', 'Option identifier', 'object-id'); |
516 | 522 | $t->optionAttributeOptionsStructure = new Structure('option-attribute-options', $t->optionAttributeOptionId, $t->optionAttribute, $t->optionAttributeOption, $t->language); |
517 | 523 | $t->optionAttributeOptions = new Attribute(null, wfMsg("OptionAttributeOptions"), $t->optionAttributeOptionsStructure); |
| 524 | + |
518 | 525 | if ($viewInformation->filterOnLanguage() && !$viewInformation->hasMetaDataAttributes()) |
519 | 526 | $t->translatedText = new Attribute("translated-text", wfMsg("Text"), "text"); |
520 | 527 | else |
— | — | @@ -582,7 +589,7 @@ |
583 | 590 | public function __get($key) { |
584 | 591 | $attributes=&$this->attributes; |
585 | 592 | if (!array_key_exists($key, $attributes)) { |
586 | | - throw new Exception("Key does not exist"); |
| 593 | + throw new Exception("Key does not exist: " . $key); |
587 | 594 | } |
588 | 595 | return $attributes[$key]; |
589 | 596 | } |
Index: trunk/extensions/Wikidata/OmegaWiki/Controller.php |
— | — | @@ -586,8 +586,8 @@ |
587 | 587 | if ($textValue->getRecordCount() > 0) { |
588 | 588 | $textValueRecord = $textValue->getRecord(0); |
589 | 589 | |
590 | | - $languageId = $textValueRecord->languageAttribute; |
591 | | - $text = $textValueRecord->textAttribute; |
| 590 | + $languageId = $textValueRecord->language; |
| 591 | + $text = $textValueRecord->text; |
592 | 592 | |
593 | 593 | if ($languageId != 0 && $text != '') |
594 | 594 | addTranslatedTextAttributeValue($objectId, $textAttributeId, $languageId, $text); |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php |
— | — | @@ -745,7 +745,7 @@ |
746 | 746 | function expandObjectAttributesAttribute(RecordSet $recordSet, Attribute $attributeToExpand, Attribute $objectIdAttribute, ViewInformation $viewInformation) { |
747 | 747 | global |
748 | 748 | $textAttributeObjectAttribute, $textAttributeValuesAttribute, |
749 | | - $translatedTextAttributeObjectAttribute, $translatedTextAttributeValuesAttribute, |
| 749 | + $attributeObjectAttribute, $translatedTextAttributeValuesAttribute, |
750 | 750 | $linkAttributeObjectAttribute, $linkAttributeValuesAttribute, |
751 | 751 | $optionAttributeObjectAttribute, $optionAttributeValuesAttribute; |
752 | 752 | |
— | — | @@ -777,7 +777,7 @@ |
778 | 778 | $translatedTextAttributeValuesRecordSets = |
779 | 779 | splitRecordSet( |
780 | 780 | $allTranslatedTextAttributeValuesRecordSet, |
781 | | - $translatedTextAttributeObjectAttribute |
| 781 | + $attributeObjectAttribute |
782 | 782 | ); |
783 | 783 | |
784 | 784 | $emptyTranslatedTextAttributesRecordSet = new ArrayRecordSet($allTranslatedTextAttributeValuesRecordSet->getStructure(), $allTranslatedTextAttributeValuesRecordSet->getKey()); |
— | — | @@ -1037,7 +1037,7 @@ |
1038 | 1038 | function getTranslatedTextAttributeValuesRecordSet(array $objectIds, ViewInformation $viewInformation) { |
1039 | 1039 | global |
1040 | 1040 | $translatedTextAttributeIdAttribute, $translatedContentAttributeValuesTable, $translatedTextAttributeAttribute, |
1041 | | - $objectAttributesAttribute, $translatedTextAttributeObjectAttribute, $translatedTextValueAttribute, $translatedTextValueIdAttribute, |
| 1041 | + $objectAttributesAttribute, $attributeObjectAttribute, $translatedTextValueAttribute, $translatedTextValueIdAttribute, |
1042 | 1042 | $translatedTextAttributeValuesStructure; |
1043 | 1043 | |
1044 | 1044 | $recordSet = queryRecordSet( |
— | — | @@ -1046,7 +1046,7 @@ |
1047 | 1047 | $translatedTextAttributeIdAttribute, |
1048 | 1048 | new TableColumnsToAttributesMapping( |
1049 | 1049 | new TableColumnsToAttribute(array('value_id'), $translatedTextAttributeIdAttribute), |
1050 | | - new TableColumnsToAttribute(array('object_id'), $translatedTextAttributeObjectAttribute), |
| 1050 | + new TableColumnsToAttribute(array('object_id'), $attributeObjectAttribute), |
1051 | 1051 | new TableColumnsToAttribute(array('attribute_mid'), $translatedTextAttributeAttribute), |
1052 | 1052 | new TableColumnsToAttribute(array('value_tcid'), $translatedTextValueIdAttribute) |
1053 | 1053 | ), |
Index: trunk/extensions/Wikidata/OmegaWiki/Record.php |
— | — | @@ -30,23 +30,22 @@ |
31 | 31 | return @$this->values[$attribute->id]; |
32 | 32 | } |
33 | 33 | |
34 | | - |
35 | 34 | /** |
36 | 35 | * Look up the correct attribute using omegaWikiAttributes |
37 | 36 | * and return its value |
38 | 37 | */ |
39 | | - public function __get($attribute_name){ |
40 | | - $o=OmegaWikiAttributes::getInstance(); |
41 | | - return $this->getAttributeValue($o->$attribute_name); |
| 38 | + public function __get($attributeName) { |
| 39 | + $o = OmegaWikiAttributes::getInstance(); |
| 40 | + return $this->getAttributeValue($o->$attributeName); |
42 | 41 | } |
43 | 42 | |
44 | 43 | /** |
45 | 44 | * Look up the correct attribute using omegaWikiAttributes |
46 | 45 | * and set its value |
47 | 46 | */ |
48 | | - public function __set($attribute_name, $value){ |
49 | | - $o=OmegaWikiAttributes::getInstance(); |
50 | | - return $this->setAttributeValue ($o->$attribute_name, $value); |
| 47 | + public function __set($attributeName, $value) { |
| 48 | + $o = OmegaWikiAttributes::getInstance(); |
| 49 | + return $this->setAttributeValue($o->$attributeName, $value); |
51 | 50 | } |
52 | 51 | /** |
53 | 52 | * Obtains a value based on the provided key. |
— | — | @@ -55,7 +54,7 @@ |
56 | 55 | * For now, this just does a direct lookup. |
57 | 56 | * @deprecated use __get and __set instead |
58 | 57 | */ |
59 | | - public function getValue ($key) { |
| 58 | + public function getValue($key) { |
60 | 59 | return @$this->values[$key]; |
61 | 60 | } |
62 | 61 | |