r25626 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25625‎ | r25626 | r25627 >
Date:10:35, 7 September 2007
Author:proes
Status:old
Tags:
Comment:
Merged Relations with Annotation. "Possibly synonymous section" does not work anymore but can be replaced by a properly configured PropertyToColumnFilter. Code clean up to fully remove "Possibly synonymous" is pending.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/Controller.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Editor.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/SpecialSuggest.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataBootstrappedMeanings.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php
@@ -143,7 +143,6 @@
144144 $wgAlternativeDefinitionsAttributeId,
145145 $wgSynonymsAndTranslationsAttributeId,
146146 $wgPossiblySynonymousAttributeId,
147 - $wgRelationsAttributeId,
148147 $wgIncomingRelationsAttributeId,
149148 $wgClassMembershipAttributeId,
150149 $wgCollectionMembershipAttributeId,
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataBootstrappedMeanings.php
@@ -18,7 +18,6 @@
1919 $classAttributeLevels = array(
2020 $definedMeaningMeaningName,
2121 $definitionMeaningName,
22 - $relationMeaningName,
2322 $synTransMeaningName,
2423 $annotationMeaningName
2524 );
Index: trunk/extensions/Wikidata/OmegaWiki/SpecialSuggest.php
@@ -63,18 +63,21 @@
6464 $sqlFallback = getSQLForCollectionOfType('CLAS', 'en');
6565 $sql=constructSQLWithFallback($sqlActual, $sqlFallback, array("member_mid", "spelling", "collection_mid"));
6666 break;
67 - case 'option-attribute':
68 - $sql = getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, $annotationAttributeId, 'OPTN');
 67+ case 'defined-meaning-attribute':
 68+ $sql = getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, $annotationAttributeId, 'DM');
6969 break;
 70+ case 'text-attribute':
 71+ $sql = getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, $annotationAttributeId, 'TEXT');
 72+ break;
7073 case 'translated-text-attribute':
7174 $sql = getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, $annotationAttributeId, 'TRNS');
7275 break;
73 - case 'text-attribute':
74 - $sql = getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, $annotationAttributeId, 'TEXT');
75 - break;
7676 case 'link-attribute':
7777 $sql = getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, $annotationAttributeId, 'URL');
7878 break;
 79+ case 'option-attribute':
 80+ $sql = getSQLToSelectPossibleAttributes($definedMeaningId, $attributesLevel, $annotationAttributeId, 'OPTN');
 81+ break;
7982 case 'language':
8083 require_once('languages.php');
8184 $sql = getSQLForLanguageNames($wgUser->getOption('language'));
@@ -154,18 +157,21 @@
155158 case 'class':
156159 list($recordSet, $editor) = getClassAsRecordSet($queryResult);
157160 break;
 161+ case 'defined-meaning-attribute':
 162+ list($recordSet, $editor) = getDefinedMeaningAttributeAsRecordSet($queryResult);
 163+ break;
158164 case 'text-attribute':
159165 list($recordSet, $editor) = getTextAttributeAsRecordSet($queryResult);
160166 break;
161167 case 'translated-text-attribute':
162168 list($recordSet, $editor) = getTranslatedTextAttributeAsRecordSet($queryResult);
163169 break;
 170+ case 'link-attribute':
 171+ list($recordSet, $editor) = getLinkAttributeAsRecordSet($queryResult);
 172+ break;
164173 case 'option-attribute':
165174 list($recordSet, $editor) = getOptionAttributeAsRecordSet($queryResult);
166175 break;
167 - case 'link-attribute':
168 - list($recordSet, $editor) = getLinkAttributeAsRecordSet($queryResult);
169 - break;
170176 case 'defined-meaning':
171177 list($recordSet, $editor) = getDefinedMeaningAsRecordSet($queryResult);
172178 break;
@@ -463,6 +469,23 @@
464470 return array($recordSet, $editor);
465471 }
466472
 473+function getDefinedMeaningAttributeAsRecordSet($queryResult) {
 474+ $o=OmegaWikiAttributes::getInstance();
 475+
 476+ $dbr =& wfGetDB(DB_SLAVE);
 477+
 478+ $definedMeaningAttributeAttribute = new Attribute("defined-meaning-attribute", "Relation type", "short-text");
 479+ $recordSet = new ArrayRecordSet(new Structure($o->id, $definedMeaningAttributeAttribute), new Structure($o->id));
 480+
 481+ while ($row = $dbr->fetchObject($queryResult))
 482+ $recordSet->addRecord(array($row->attribute_mid, $row->spelling));
 483+
 484+ $editor = createSuggestionsTableViewer(null);
 485+ $editor->addEditor(createShortTextViewer($definedMeaningAttributeAttribute));
 486+
 487+ return array($recordSet, $editor);
 488+}
 489+
467490 function getTextAttributeAsRecordSet($queryResult) {
468491
469492 $o=OmegaWikiAttributes::getInstance();
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php
@@ -203,20 +203,22 @@
204204 $t->translatedTextAttributeValuesStructure = new Structure("translated-text-attribute-values",$t->translatedTextAttributeId, $t->attributeObjectId, $t->translatedTextAttribute, $t->translatedTextValueId, $t->translatedTextValue);
205205 $t->translatedTextAttributeValues = new Attribute(null, wfMsgSc("TranslatedTextAttributeValues"), $t->translatedTextAttributeValuesStructure);
206206 $t->attributeObject = new Attribute("attribute-object-id", "Attribute object", "object-id");
 207+
207208 $t->textAttributeId = new Attribute("text-attribute-id", "Attribute identifier", "object-id");
208209 $t->textAttributeObject = new Attribute("text-attribute-object-id", "Attribute object", "object-id");
209210 $t->textAttribute = new Attribute("text-attribute", wfMsgSc("TextAttribute"), $t->definedMeaningReferenceStructure);
210211 $t->textAttributeValuesStructure = new Structure("text-attribute-values", $t->textAttributeId, $t->textAttributeObject, $t->textAttribute, $t->text);
211212 $t->textAttributeValues = new Attribute(null, wfMsgSc("TextAttributeValues"), $t->textAttributeValuesStructure);
 213+
212214 $t->linkLabel = new Attribute("label", "Label", "short-text");
213215 $t->linkURL = new Attribute("url", "URL", "url");
214216 $t->link = new Attribute("link", "Link", new Structure($t->linkLabel, $t->linkURL));
215 -
216217 $t->linkAttributeId = new Attribute("link-attribute-id", "Attribute identifier", "object-id");
217218 $t->linkAttributeObject = new Attribute("link-attribute-object-id", "Attribute object", "object-id");
218219 $t->linkAttribute = new Attribute("link-attribute", wfMsgSc("LinkAttribute"), $t->definedMeaningReferenceStructure);
219220 $t->linkAttributeValuesStructure = new Structure("link-attribute-values", $t->linkAttributeId, $t->linkAttributeObject, $t->linkAttribute, $t->link);
220221 $t->linkAttributeValues = new Attribute(null, wfMsgSc("LinkAttributeValues"), $t->linkAttributeValuesStructure);
 222+
221223 $t->optionAttributeId = new Attribute("option-attribute-id", "Attribute identifier", "object-id");
222224 $t->optionAttributeObject = new Attribute("option-attribute-object-id", "Attribute object", "object-id");
223225 $t->optionAttribute = new Attribute("option-attribute", wfMsgSc("OptionAttribute"), $definedMeaningReferenceType);
@@ -253,7 +255,6 @@
254256 $t->classAttributes,
255257 $t->alternativeDefinitions,
256258 $t->synonymsAndTranslations,
257 - $t->relations,
258259 $t->reciprocalRelations,
259260 $t->classMembership,
260261 $t->collectionMembership,
@@ -268,8 +269,17 @@
269270 $t->expressionMeanings = new Attribute(null, wfMsgSc("ExpressionMeanings"), $t->expressionMeaningsStructure);
270271 $t->expressionsStructure = new Structure("expressions", $t->expressionId, $t->expression, $t->expressionMeanings);
271272 $t->expressions = new Attribute(null, wfMsgSc("Expressions"), $t->expressionsStructure);
 273+
272274 $t->objectId = new Attribute("object-id", "Object identifier", "object-id");
273 - $t->objectAttributesStructure = new Structure("object-attributes", $t->objectId, $t->textAttributeValues, $t->translatedTextAttributeValues, $t->linkAttributeValues, $t->optionAttributeValues);
 275+ $t->objectAttributesStructure = new Structure("object-attributes",
 276+ $t->objectId,
 277+ $t->relations,
 278+ $t->textAttributeValues,
 279+ $t->translatedTextAttributeValues,
 280+ $t->linkAttributeValues,
 281+ $t->optionAttributeValues
 282+ );
 283+
274284 $t->objectAttributes->setAttributeType($t->objectAttributesStructure);
275285 $t->definedMeaningAttributes->setAttributeType($t->objectAttributesStructure);
276286
Index: trunk/extensions/Wikidata/OmegaWiki/Controller.php
@@ -266,31 +266,6 @@
267267 }
268268 }
269269
270 -class DefinedMeaningRelationController implements UpdateController {
271 - public function add($keyPath, $record) {
272 -
273 - $o=OmegaWikiAttributes::getInstance();
274 -
275 - $definedMeaningId = $keyPath->peek(0)->definedMeaningId;
276 - $relationTypeId = $record->relationType;
277 - $otherDefinedMeaningId = $record->otherDefinedMeaning;
278 -
279 - if ($relationTypeId != 0 && $otherDefinedMeaningId != 0)
280 - addRelation($definedMeaningId, $relationTypeId, $otherDefinedMeaningId);
281 - }
282 -
283 - public function remove($keyPath) {
284 -
285 - $o=OmegaWikiAttributes::getInstance();
286 -
287 - $relationId = $keyPath->peek(0)->relationId;
288 - removeRelationWithId($relationId);
289 - }
290 -
291 - public function update($keyPath, $record) {
292 - }
293 -}
294 -
295270 class GroupedRelationTypeController implements UpdateController {
296271 protected $relationTypeId;
297272 protected $groupedRelationIdAttribute;
@@ -486,6 +461,25 @@
487462 }
488463 }
489464
 465+class DefinedMeaningAttributeValuesController extends ObjectAttributeValuesController {
 466+ public function add($keyPath, $record) {
 467+ $objectId = $this->objectIdFetcher->fetch($keyPath);
 468+ $definedMeaningAttributeId = $record->relationType;
 469+ $definedMeaningValue = $record->otherDefinedMeaning;
 470+
 471+ if ($definedMeaningAttributeId != 0 && $definedMeaningValue != "")
 472+ addRelation($objectId, $definedMeaningAttributeId, $definedMeaningValue);
 473+ }
 474+
 475+ public function remove($keyPath) {
 476+ $valueId = $keyPath->peek(0)->relationId;
 477+ removeRelationWithId($valueId);
 478+ }
 479+
 480+ public function update($keyPath, $record) {
 481+ }
 482+}
 483+
490484 class TextAttributeValuesController extends ObjectAttributeValuesController {
491485 public function add($keyPath, $record) {
492486
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php
@@ -243,6 +243,7 @@
244244
245245 function initializeObjectAttributeEditors(ViewInformation $viewInformation) {
246246 global
 247+ $definedMeaningValueObjectAttributesEditors,
247248 $textValueObjectAttributesEditors,
248249 $linkValueObjectAttributesEditors,
249250 $translatedTextValueObjectAttributesEditors,
@@ -251,9 +252,10 @@
252253
253254 $o=OmegaWikiAttributes::getInstance($viewInformation);
254255
255 - $linkValueObjectAttributesEditors = array();
 256+ $definedMeaningValueObjectAttributesEditors = array();
256257 $textValueObjectAttributesEditors = array();
257258 $translatedTextValueObjectAttributesEditors = array();
 259+ $linkValueObjectAttributesEditors = array();
258260 $optionValueObjectAttributesEditors = array();
259261
260262 foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) {
@@ -262,6 +264,7 @@
263265 $valueCaption = $propertyToColumnFilter->getValueCaption();
264266 $attributeIDfilter = $propertyToColumnFilter->getAttributeIDFilter();
265267
 268+ $definedMeaningValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $valueCaption, $viewInformation, $annotationMeaningName, $attributeIDfilter);
266269 $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $valueCaption, $viewInformation, $annotationMeaningName, $attributeIDfilter);
267270 $linkValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $valueCaption, $viewInformation, $annotationMeaningName, $attributeIDfilter);
268271 $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($attribute, $propertyCaption, $valueCaption, $viewInformation, $annotationMeaningName, $attributeIDfilter);
@@ -270,11 +273,15 @@
271274
272275 $leftOverAttributeIdFilter = $viewInformation->getLeftOverAttributeFilter();
273276
274 - $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, wfMsgSc("Property"), wfMsgSc("Value"), $viewInformation, $annotationMeaningName, $leftOverAttributeIdFilter);
 277+ $definedMeaningValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, wfMsgSc("Property"), wfMsgSc("Value"), $viewInformation, $annotationMeaningName, $leftOverAttributeIdFilter);
 278+ $textValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, wfMsgSc("Property"), wfMsgSc("Value"), $viewInformation, $annotationMeaningName, $leftOverAttributeIdFilter);
275279 $linkValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, wfMsgSc("Property"), wfMsgSc("Value"), $viewInformation, $annotationMeaningName, $leftOverAttributeIdFilter);
276280 $translatedTextValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, wfMsgSc("Property"), wfMsgSc("Value"), $viewInformation, $annotationMeaningName, $leftOverAttributeIdFilter);
277281 $optionValueObjectAttributesEditors[] = new ObjectAttributeValuesEditor($o->objectAttributes, wfMsgSc("Property"), wfMsgSc("Value"), $viewInformation, $annotationMeaningName, $leftOverAttributeIdFilter);
278282
 283+ foreach ($definedMeaningValueObjectAttributesEditors as $definedMeaningValueObjectAttributesEditor)
 284+ addObjectAttributesEditors($definedMeaningValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->relationType));
 285+
279286 foreach ($textValueObjectAttributesEditors as $textValueObjectAttributesEditor)
280287 addObjectAttributesEditors($textValueObjectAttributesEditor, $viewInformation, new ObjectIdFetcher(0, $o->textAttributeId));
281288
@@ -419,6 +426,7 @@
420427 $attributeIDFilter = $objectAttributesEditor->getAttributeIDfilter();
421428 $annotationLevelName = $objectAttributesEditor->getLevelName();
422429
 430+ $objectAttributesEditor->addEditor(getDefinedMeaningAttributeValuesEditor($viewInformation, new DefinedMeaningAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName, $attributeIDFilter));
423431 $objectAttributesEditor->addEditor(getTextAttributeValuesEditor($viewInformation, new TextAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName, $attributeIDFilter));
424432 $objectAttributesEditor->addEditor(getTranslatedTextAttributeValuesEditor($viewInformation, new TranslatedTextAttributeValuesController($annotatedObjectIdFetcher, $viewInformation->filterLanguageId), $annotationLevelName, $attributeIDFilter));
425433 $objectAttributesEditor->addEditor(getLinkAttributeValuesEditor($viewInformation, new LinkAttributeValuesController($annotatedObjectIdFetcher), $annotationLevelName, $attributeIDFilter));
@@ -538,23 +546,19 @@
539547 return $tableEditor;
540548 }
541549
542 -function getDefinedMeaningRelationsEditor(ViewInformation $viewInformation) {
 550+function getDefinedMeaningAttributeValuesEditor(ViewInformation $viewInformation, UpdateController $controller, $levelDefinedMeaningName, AttributeIDFilter $attributeIDFilter) {
543551 global
544 - $relationsObjectAttributesEditor, $relationMeaningName, $wgPopupAnnotationName;
 552+ $definedMeaningValueObjectAttributesEditors;
545553
546554 $o=OmegaWikiAttributes::getInstance();
547555
548 - $editor = new RecordSetTableEditor($o->relations, new SimplePermissionController(true), new ShowEditFieldChecker(true), new AllowAddController(true), true, false, new DefinedMeaningRelationController());
549 - $editor->addEditor(new RelationTypeReferenceEditor($o->relationType, new SimplePermissionController(false), true));
 556+ $showEditFieldChecker = new ShowEditFieldForAttributeValuesChecker($levelDefinedMeaningName, "DM", $attributeIDFilter);
 557+
 558+ $editor = new RecordSetTableEditor($o->relations, new SimplePermissionController(true), $showEditFieldChecker, new AllowAddController(true), true, false, $controller);
 559+ $editor->addEditor(new DefinedMeaningAttributeEditor($o->relationType, new SimplePermissionController(false), true, $levelDefinedMeaningName));
550560 $editor->addEditor(new DefinedMeaningReferenceEditor($o->otherDefinedMeaning, new SimplePermissionController(false), true));
551 -
552 - addPropertyToColumnFilterEditors($editor, $viewInformation, $o->relationId, $relationMeaningName);
553 -
554 - $editor->addEditor(new PopUpEditor(
555 - createObjectAttributesEditor($viewInformation, $o->objectAttributes, wfMsgSc("Property"), wfMsgSc("Value"), $o->relationId, $relationMeaningName, $viewInformation->getLeftOverAttributeFilter()),
556 - $wgPopupAnnotationName
557 - ));
558561
 562+ addPopupEditors($editor, $definedMeaningValueObjectAttributesEditors);
559563 addTableMetadataEditors($editor, $viewInformation);
560564
561565 return $editor;
@@ -810,7 +814,6 @@
811815 $alternativeDefinitionsEditor = getAlternativeDefinitionsEditor($viewInformation);
812816 $classAttributesEditor = getClassAttributesEditor($viewInformation);
813817 $synonymsAndTranslationsEditor = getSynonymsAndTranslationsEditor($viewInformation);
814 - $relationsEditor = getDefinedMeaningRelationsEditor($viewInformation);
815818 $reciprocalRelationsEditor = getDefinedMeaningReciprocalRelationsEditor($viewInformation);
816819 $classMembershipEditor = getDefinedMeaningClassMembershipEditor($viewInformation);
817820 $collectionMembershipEditor = getDefinedMeaningCollectionMembershipEditor($viewInformation);
@@ -830,7 +833,6 @@
831834 $availableEditors->addEditor($alternativeDefinitionsEditor);
832835 $availableEditors->addEditor($classAttributesEditor);
833836 $availableEditors->addEditor($synonymsAndTranslationsEditor);
834 - $availableEditors->addEditor($relationsEditor);
835837 $availableEditors->addEditor($reciprocalRelationsEditor);
836838 $availableEditors->addEditor($classMembershipEditor);
837839 $availableEditors->addEditor($collectionMembershipEditor);
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php
@@ -561,6 +561,7 @@
562562 $record = new ArrayRecord($o->definedMeaningAttributes->type);
563563
564564 $record->objectId = $objectId;
 565+ $record->relations = getDefinedMeaningAttributeValuesRecordSet(array($objectId), array(), $viewInformation);
565566 $record->textAttributeValues = getTextAttributesValuesRecordSet(array($objectId), $viewInformation);
566567 $record->translatedTextAttributeValues = getTranslatedTextAttributeValuesRecordSet(array($objectId), $viewInformation);
567568 $record->linkAttributeValues = getLinkAttributeValuesRecordSet(array($objectId), $viewInformation);
@@ -588,12 +589,17 @@
589590 }
590591
591592 function filterObjectAttributesRecord(Record $sourceRecord, array &$attributeIds) {
592 -
593593 $o=OmegaWikiAttributes::getInstance();
594594
595595 $result = new ArrayRecord($sourceRecord->getStructure());
596596 $result->objectId = $sourceRecord->objectId;
597597
 598+ $result->setAttributeValue($o->relations, filterAttributeValues(
 599+ $sourceRecord->relations,
 600+ $o->relationType,
 601+ $attributeIds
 602+ ));
 603+
598604 $result->setAttributeValue($o->textAttributeValues, filterAttributeValues(
599605 $sourceRecord->textAttributeValues,
600606 $o->textAttribute,
@@ -622,32 +628,29 @@
623629 }
624630
625631 function getTranslatedContentValue($translatedContentId, ViewInformation $viewInformation) {
626 -
627632 $o=OmegaWikiAttributes::getInstance();
628633
629634 if ($viewInformation->filterLanguageId == 0) {
630635 return getTranslatedContentRecordSet($translatedContentId, $viewInformation);
631636
632 - } else {
 637+ }
 638+ else {
633639 $recordSet = getFilteredTranslatedContentRecordSet($translatedContentId, $viewInformation);
634640
635641 if (count($viewInformation->queryTransactionInformation->versioningAttributes()) > 0)
636642 return $recordSet;
637643 else {
638 - if ($recordSet->getRecordCount() > 0) {
 644+ if ($recordSet->getRecordCount() > 0)
639645 return $recordSet->getRecord(0)->text;
640 - } else
 646+ else
641647 return "";
642648 }
643649 }
644650 }
645651
646652 function getTranslatedContentRecordSet($translatedContentId, ViewInformation $viewInformation) {
647 -
648 - $o=OmegaWikiAttributes::getInstance();
649653 global
650654 $translatedContentTable;
651 -
652655
653656 $o=OmegaWikiAttributes::getInstance();
654657
@@ -754,6 +757,16 @@
755758 $objectAttributesRecords[$objectIds[$i]] = $record;
756759 }
757760
 761+ // Defined meaning attributes
 762+ $allDefinedMeaningAttributeValuesRecordSet = getDefinedMeaningAttributeValuesRecordSet($objectIds, array(), $viewInformation);
 763+ $definedMeaningAttributeValuesRecordSets =
 764+ splitRecordSet(
 765+ $allDefinedMeaningAttributeValuesRecordSet,
 766+ $o->relationType
 767+ );
 768+
 769+ $emptyDefinedMeaningAttributesRecordSet = new ArrayRecordSet($allDefinedMeaningAttributeValuesRecordSet->getStructure(), $allDefinedMeaningAttributeValuesRecordSet->getKey());
 770+
758771 // Text attributes
759772 $allTextAttributeValuesRecordSet = getTextAttributesValuesRecordSet($objectIds, $viewInformation);
760773 $textAttributeValuesRecordSets =
@@ -799,6 +812,12 @@
800813 $record = $recordSet->getRecord($i);
801814 $objectId = $record->getAttributeValue($objectIdAttribute);
802815
 816+ // Defined meaning attributes
 817+ if (isset($definedMeaningAttributeValuesRecordSets[$objectId]))
 818+ $definedMeaningAttributeValuesRecordSet = $definedMeaningAttributeValuesRecordSets[$objectId];
 819+ else
 820+ $definedMeaningAttributeValuesRecordSet = $emptyDefinedMeaningAttributesRecordSet;
 821+
803822 // Text attributes
804823 if (isset($textAttributeValuesRecordSets[$objectId]))
805824 $textAttributeValuesRecordSet = $textAttributeValuesRecordSets[$objectId];
@@ -825,6 +844,7 @@
826845
827846 $objectAttributesRecord = new ArrayRecord($objectAttributesRecordStructure);
828847 $objectAttributesRecord->objectId = $objectId;
 848+ $objectAttributesRecord->relations = $definedMeaningAttributeValuesRecordSet;
829849 $objectAttributesRecord->textAttributeValues = $textAttributeValuesRecordSet;
830850 $objectAttributesRecord->translatedTextAttributeValues = $translatedTextAttributeValuesRecordSet;
831851 $objectAttributesRecord->linkAttributeValues = $linkAttributeValuesRecordSet;
@@ -848,17 +868,16 @@
849869 return $record;
850870 }
851871
852 -function getDefinedMeaningRelationsRecordSet($definedMeaningId, array $filterRelationTypes, ViewInformation $viewInformation) {
853 -
854 - $o=OmegaWikiAttributes::getInstance();
 872+function getDefinedMeaningAttributeValuesRecordSet(array $objectIds, array $filterRelationTypes, ViewInformation $viewInformation) {
855873 global
856874 $meaningRelationsTable;
857875
858 - $restrictions = array("meaning1_mid=$definedMeaningId");
 876+ $o=OmegaWikiAttributes::getInstance();
 877+// $restrictions = array("meaning1_mid=$definedMeaningId");
 878+//
 879+// if (count($filterRelationTypes) > 0)
 880+// $restrictions[] = "relationtype_mid NOT IN (". implode(", ", $filterRelationTypes) .")";
859881
860 - if (count($filterRelationTypes) > 0)
861 - $restrictions[] = "relationtype_mid NOT IN (". implode(", ", $filterRelationTypes) .")";
862 -
863882 $recordSet = queryRecordSet(
864883 $o->relationStructure->getStructureType(),
865884 $viewInformation->queryTransactionInformation,
@@ -869,7 +888,7 @@
870889 new TableColumnsToAttribute(array('meaning2_mid'), $o->otherDefinedMeaning)
871890 ),
872891 $meaningRelationsTable,
873 - $restrictions,
 892+ array("meaning1_mid IN (" . implode(", ", $objectIds) . ")"),
874893 array('add_transaction_id')
875894 );
876895
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php
@@ -156,7 +156,7 @@
157157 $record->possiblySynonymous = getPossiblySynonymousRecordSet($id, $view);
158158 $filterRelationTypes[] = $view->possiblySynonymousRelationTypeId;
159159 }
160 - $record->relations = getDefinedMeaningRelationsRecordSet($id, $filterRelationTypes, $view);
 160+
161161 $record->reciprocalRelations = getDefinedMeaningReciprocalRelationsRecordSet($id, $view);
162162 $record->classMembership = getDefinedMeaningClassMembershipRecordSet($id, $view);
163163 $record->collectionMembership= getDefinedMeaningCollectionMembershipRecordSet($id, $view);
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php
@@ -1254,9 +1254,10 @@
12551255 class ClassAttributesTypeEditor extends SelectEditor {
12561256 protected function getOptions() {
12571257 return array(
 1258+ 'DM' => 'Defined meaning',
12581259 'TRNS' => 'Translatable text',
12591260 'TEXT' => 'Plain text',
1260 - 'URL' => 'URL',
 1261+ 'URL' => 'Link',
12611262 'OPTN' => 'Option list'
12621263 );
12631264 }
@@ -1323,6 +1324,12 @@
13241325 }
13251326 }
13261327
 1328+class DefinedMeaningAttributeEditor extends AttributeEditor {
 1329+ protected function suggestType() {
 1330+ return "defined-meaning-attribute";
 1331+ }
 1332+}
 1333+
13271334 class TextAttributeEditor extends AttributeEditor {
13281335 protected function suggestType() {
13291336 return "text-attribute";
@@ -1343,7 +1350,7 @@
13441351
13451352 class OptionAttributeEditor extends AttributeEditor {
13461353 protected function suggestType() {
1347 - return 'option-attribute';
 1354+ return "option-attribute";
13481355 }
13491356
13501357 public function add(IdStack $idPath) {

Status & tagging log