r25769 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25768‎ | r25769 | r25770 >
Date:08:20, 11 September 2007
Author:proes
Status:old
Tags:
Comment:
Removed "possibly synonymous" functionality because it has been superseded by property to column filters.
Modified paths:
  • /trunk/extensions/Wikidata/App.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Controller.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.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/ViewInformation.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Wikidata.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php
@@ -561,7 +561,7 @@
562562 $record = new ArrayRecord($o->definedMeaningAttributes->type);
563563
564564 $record->objectId = $objectId;
565 - $record->relations = getDefinedMeaningAttributeValuesRecordSet(array($objectId), array(), $viewInformation);
 565+ $record->relations = getDefinedMeaningAttributeValuesRecordSet(array($objectId), $viewInformation);
566566 $record->textAttributeValues = getTextAttributesValuesRecordSet(array($objectId), $viewInformation);
567567 $record->translatedTextAttributeValues = getTranslatedTextAttributeValuesRecordSet(array($objectId), $viewInformation);
568568 $record->linkAttributeValues = getLinkAttributeValuesRecordSet(array($objectId), $viewInformation);
@@ -758,7 +758,7 @@
759759 }
760760
761761 // Defined meaning attributes
762 - $allDefinedMeaningAttributeValuesRecordSet = getDefinedMeaningAttributeValuesRecordSet($objectIds, array(), $viewInformation);
 762+ $allDefinedMeaningAttributeValuesRecordSet = getDefinedMeaningAttributeValuesRecordSet($objectIds, $viewInformation);
763763 $definedMeaningAttributeValuesRecordSets =
764764 splitRecordSet(
765765 $allDefinedMeaningAttributeValuesRecordSet,
@@ -868,15 +868,11 @@
869869 return $record;
870870 }
871871
872 -function getDefinedMeaningAttributeValuesRecordSet(array $objectIds, array $filterRelationTypes, ViewInformation $viewInformation) {
 872+function getDefinedMeaningAttributeValuesRecordSet(array $objectIds, ViewInformation $viewInformation) {
873873 global
874874 $meaningRelationsTable;
875875
876876 $o=OmegaWikiAttributes::getInstance();
877 -// $restrictions = array("meaning1_mid=$definedMeaningId");
878 -//
879 -// if (count($filterRelationTypes) > 0)
880 -// $restrictions[] = "relationtype_mid NOT IN (". implode(", ", $filterRelationTypes) .")";
881877
882878 $recordSet = queryRecordSet(
883879 $o->relationStructure->getStructureType(),
@@ -924,36 +920,7 @@
925921 return $recordSet;
926922 }
927923
928 -function getPossiblySynonymousRecordSet($definedMeaningId, ViewInformation $viewInformation) {
929 -
930 - $o=OmegaWikiAttributes::getInstance();
931 - global
932 - $meaningRelationsTable;
933 -
934 - $recordSet = queryRecordSet(
935 - null,
936 - $viewInformation->queryTransactionInformation,
937 - $o->possiblySynonymousId,
938 - new TableColumnsToAttributesMapping(
939 - new TableColumnsToAttribute(array('relation_id'), $o->possiblySynonymousId),
940 - new TableColumnsToAttribute(array('meaning2_mid'), $o->possibleSynonym)
941 - ),
942 - $meaningRelationsTable,
943 - array(
944 - "meaning1_mid=$definedMeaningId",
945 - "relationtype_mid=" . $viewInformation->possiblySynonymousRelationTypeId
946 - ),
947 - array('add_transaction_id')
948 - );
949 -
950 - expandDefinedMeaningReferencesInRecordSet($recordSet, array($o->possibleSynonym));
951 - expandObjectAttributesAttribute($recordSet, $o->objectAttributes, $o->possiblySynonymousId, $viewInformation);
952 -
953 - return $recordSet;
954 -}
955 -
956924 function getGotoSourceRecord($record) {
957 -
958925 $o=OmegaWikiAttributes::getInstance();
959926
960927 $result = new ArrayRecord($o->gotoSourceStructure);
@@ -964,11 +931,11 @@
965932 }
966933
967934 function getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, ViewInformation $viewInformation) {
968 -
969 - $o=OmegaWikiAttributes::getInstance();
970935 global
971936 $collectionMembershipsTable;
972937
 938+ $o=OmegaWikiAttributes::getInstance();
 939+
973940 $recordSet = queryRecordSet(
974941 $o->collectionMembershipStructure->getStructureType(),
975942 $viewInformation->queryTransactionInformation,
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php
@@ -150,13 +150,6 @@
151151 $record->classAttributes = getClassAttributesRecordSet($id, $view);
152152 $record->alternativeDefinitions = getAlternativeDefinitionsRecordSet($id, $view);
153153 $record->synonymsAndTranslations = getSynonymAndTranslationRecordSet($id, $view);
154 - $filterRelationTypes = array();
155 -
156 - if ($view->possiblySynonymousRelationTypeId != 0) {
157 - $record->possiblySynonymous = getPossiblySynonymousRecordSet($id, $view);
158 - $filterRelationTypes[] = $view->possiblySynonymousRelationTypeId;
159 - }
160 -
161154 $record->reciprocalRelations = getDefinedMeaningReciprocalRelationsRecordSet($id, $view);
162155 $record->classMembership = getDefinedMeaningClassMembershipRecordSet($id, $view);
163156 $record->collectionMembership= getDefinedMeaningCollectionMembershipRecordSet($id, $view);
Index: trunk/extensions/Wikidata/OmegaWiki/ViewInformation.php
@@ -13,7 +13,6 @@
1414
1515 class ViewInformation {
1616 public $filterLanguageId;
17 - public $possiblySynonymousRelationTypeId;
1817 public $queryTransactionInformation;
1918 public $showRecordLifeSpan;
2019 public $viewOrEdit;
@@ -22,7 +21,6 @@
2322
2423 public function __construct() {
2524 $this->filterLanguageId = 0;
26 - $this->possiblySynonymousRelationTypeId = 0;
2725 $this->queryTransactionInformation;
2826 $this->showRecordLifeSpan = false;
2927 $this->propertyToColumnFilters = array();
@@ -63,7 +61,6 @@
6462 public function hashCode() {
6563 return
6664 $this->filterLanguageId.",".
67 - $this->possiblySynonymousRelationTypeId.",".
6865 $this->showRecordLifeSpan.",".
6966 $this->viewOrEdit;
7067 }
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php
@@ -41,8 +41,6 @@
4242 $wgOptionAttributeValuesAttributeName,
4343 $wgOtherDefinedMeaningAttributeName,
4444 $wgPopupAnnotationName,
45 - $wgPossibleSynonymAttributeName,
46 - $wgPossiblySynonymousAttributeName,
4745 $wgRelationsAttributeName,
4846 $wgRelationTypeAttributeName,
4947 $wgSourceAttributeName,
@@ -88,8 +86,6 @@
8987 $wgOptionAttributeValuesAttributeName = "Options";
9088 $wgOtherDefinedMeaningAttributeName = "Other defined meaning";
9189 $wgPopupAnnotationName = "Annotation";
92 -$wgPossibleSynonymAttributeName = "Possible synonym";
93 -$wgPossiblySynonymousAttributeName = "Possibly synonymous";
9490 $wgRelationsAttributeName = "Relations";
9591 $wgRelationTypeAttributeName = "Relation type";
9692 $wgSpellingAttributeName = "Spelling";
@@ -117,7 +113,6 @@
118114 $wgDefinedMeaningAttributesAttributeId,
119115 $wgDefinitionAttributeId,
120116 $wgIncomingRelationsAttributeId,
121 - $wgPossiblySynonymousAttributeId,
122117 $wgRelationsAttributeId,
123118 $wgSynonymsAndTranslationsAttributeId;
124119
@@ -128,7 +123,6 @@
129124 $wgDefinedMeaningAttributesAttributeId = "defined-meaning-attributes";
130125 $wgDefinitionAttributeId = "definition";
131126 $wgIncomingRelationsAttributeId = "reciprocal-relations";
132 -$wgPossiblySynonymousAttributeId = "possibly-synonymous";
133127 $wgRelationsAttributeId = "relations";
134128 $wgSynonymsAndTranslationsAttributeId = "synonyms-translations";
135129
@@ -142,7 +136,6 @@
143137 $wgClassAttributesAttributeId,
144138 $wgAlternativeDefinitionsAttributeId,
145139 $wgSynonymsAndTranslationsAttributeId,
146 - $wgPossiblySynonymousAttributeId,
147140 $wgIncomingRelationsAttributeId,
148141 $wgClassMembershipAttributeId,
149142 $wgCollectionMembershipAttributeId,
Index: trunk/extensions/Wikidata/OmegaWiki/Controller.php
@@ -227,31 +227,6 @@
228228 }
229229 }
230230
231 -class GroupedRelationTypeController extends DefaultUpdateController {
232 - protected $relationTypeId;
233 - protected $groupedRelationIdAttribute;
234 - protected $otherDefinedMeaningAttribute;
235 -
236 - public function __construct($relationTypeId, $groupedRelationIdAttribute, $otherDefinedMeaningAttribute) {
237 - $this->relationTypeId = $relationTypeId;
238 - $this->groupedRelationIdAttribute = $groupedRelationIdAttribute;
239 - $this->otherDefinedMeaningAttribute = $otherDefinedMeaningAttribute;
240 - }
241 -
242 - public function add(IdStack $idPath, $record) {
243 - $definedMeaningId = $idPath->getKeyStack()->peek(0)->definedMeaningId;
244 - $otherDefinedMeaningId = $record->getAttributeValue($this->otherDefinedMeaningAttribute);
245 -
246 - if ($otherDefinedMeaningId != 0)
247 - addRelation($definedMeaningId, $this->relationTypeId, $otherDefinedMeaningId);
248 - }
249 -
250 - public function remove($keyPath) {
251 - $relationId = $keyPath->peek(0)->getAttributeValue($this->groupedRelationIdAttribute);
252 - removeRelationWithId($relationId);
253 - }
254 -}
255 -
256231 class DefinedMeaningClassMembershipController extends DefaultUpdateController {
257232 public function add(IdStack $idPath, $record) {
258233 $definedMeaningId = $idPath->getKeyStack()->peek(0)->definedMeaningId;
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php
@@ -140,14 +140,6 @@
141141 $t->classMembership = new Attribute(null, wfMsgSc("ClassMembership"), $t->classMembershipStructure);
142142
143143 global
144 - $wgPossiblySynonymousAttributeId;
145 -
146 - $t->possiblySynonymousId = new Attribute("possibly-synonymous-id", "Possibly synonymous id", "integer");
147 - $t->possibleSynonym = new Attribute("possible-synonym", wfMsgSc("PossibleSynonym"), $t->definedMeaningReferenceStructure);
148 - $t->possiblySynonymousStructure = new Structure("possibly-synonymous", $t->possiblySynonymousId, $t->possibleSynonym);
149 - $t->possiblySynonymous = new Attribute(null, wfMsgSc("PossiblySynonymous"), $t->possiblySynonymousStructure);
150 -
151 - global
152144 $relationTypeType;
153145
154146 $t->relationId = new Attribute("relation-id", "Relation identifier", "object-id");
Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php
@@ -13,9 +13,8 @@
1414 protected $showCommunityContribution;
1515
1616 // The following member variables control some application specific preferences
17 - protected $filterLanguageId = 0; // Filter pages on this languageId, set to 0 to show all languages
18 - protected $possiblySynonymousRelationTypeId = 0; // Put this relation type in a special section "Possibly synonymous"
19 - protected $showClassicPageTitles = true; // Show classic page titles instead of prettier page titles
 17+ protected $filterLanguageId = 0; // Filter pages on this languageId, set to 0 to show all languages
 18+ protected $showClassicPageTitles = true; // Show classic page titles instead of prettier page titles
2019
2120 protected $propertyToColumnFilters = array();
2221 protected $viewInformation;
@@ -26,7 +25,7 @@
2726 public function __construct() {
2827 global
2928 $wgFilterLanguageId,
30 - $wgShowClassicPageTitles, $wgPossiblySynonymousRelationTypeId,
 29+ $wgShowClassicPageTitles,
3130 $wgPropertyToColumnFilters;
3231
3332 if (isset($wgFilterLanguageId))
@@ -35,9 +34,6 @@
3635 if (isset($wgShowClassicPageTitles))
3736 $this->showClassicPageTitles = $wgShowClassicPageTitles;
3837
39 - if (isset($wgPossiblySynonymousRelationTypeId))
40 - $this->possiblySynonymousRelationTypeId = $wgPossiblySynonymousRelationTypeId;
41 -
4238 if (isset($wgPropertyToColumnFilters))
4339 $this->propertyToColumnFilters = $wgPropertyToColumnFilters;
4440 }
@@ -76,7 +72,6 @@
7773
7874 $viewInformation = new ViewInformation();
7975 $viewInformation->filterLanguageId = $this->filterLanguageId;
80 - $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId;
8176 $viewInformation->showRecordLifeSpan = false;
8277 $viewInformation->queryTransactionInformation = $this->queryTransactionInformation;
8378 $viewInformation->setPropertyToColumnFilters($this->propertyToColumnFilters);
@@ -112,7 +107,6 @@
113108 protected function save($referenceQueryTransactionInformation) {
114109 $viewInformation = new ViewInformation();
115110 $viewInformation->filterLanguageId = $this->filterLanguageId;
116 - $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId;
117111 $viewInformation->queryTransactionInformation = $referenceQueryTransactionInformation;
118112 $viewInformation->setPropertyToColumnFilters($this->propertyToColumnFilters);
119113 $viewInformation->viewOrEdit = "edit";
@@ -164,7 +158,6 @@
165159
166160 $viewInformation = new ViewInformation();
167161 $viewInformation->filterLanguageId = $this->filterLanguageId;
168 - $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId;
169162 $viewInformation->showRecordLifeSpan = false;
170163 $viewInformation->queryTransactionInformation = new QueryLatestTransactionInformation();
171164 $viewInformation->viewOrEdit = "edit";
@@ -219,7 +212,6 @@
220213
221214 $viewInformation = new ViewInformation();
222215 $viewInformation->filterLanguageId = $this->filterLanguageId;
223 - $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId;
224216 $viewInformation->showRecordLifeSpan = $this->showRecordLifeSpan;
225217 $viewInformation->queryTransactionInformation = $this->queryTransactionInformation;
226218 $viewInformation->setPropertyToColumnFilters($this->propertyToColumnFilters);
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php
@@ -607,30 +607,6 @@
608608 return $editor;
609609 }
610610
611 -function getGroupedRelationTypeEditor(Attribute $groupedRelationsAttribute, Attribute $groupedRelationIdAttribute, Attribute $otherDefinedMeaningAttribute, $relationTypeId, ViewInformation $viewInformation, Editor $objectAttributesEditor) {
612 - global
613 - $wgPopupAnnotationName;
614 -
615 - $editor = new RecordSetTableEditor(
616 - $groupedRelationsAttribute,
617 - new SimplePermissionController(true),
618 - new ShowEditFieldChecker(true),
619 - new AllowAddController(true),
620 - true,
621 - false,
622 - new GroupedRelationTypeController($relationTypeId, $groupedRelationIdAttribute, $otherDefinedMeaningAttribute)
623 - );
624 -
625 - $editor->addEditor(new DefinedMeaningReferenceEditor($otherDefinedMeaningAttribute, new SimplePermissionController(false), true));
626 -
627 - if ($objectAttributesEditor != null)
628 - $editor->addEditor(new PopUpEditor($objectAttributesEditor, $wgPopupAnnotationName));
629 -
630 - addTableMetadataEditors($editor, $viewInformation);
631 -
632 - return $editor;
633 -}
634 -
635611 function getDefinedMeaningCollectionMembershipEditor(ViewInformation $viewInformation) {
636612 global
637613 $wgGotoSourceTemplates;
@@ -828,16 +804,6 @@
829805 $classMembershipEditor = getDefinedMeaningClassMembershipEditor($viewInformation);
830806 $collectionMembershipEditor = getDefinedMeaningCollectionMembershipEditor($viewInformation);
831807
832 - #var_dump($definitionEditor);
833 - $possiblySynonymousEditor = getGroupedRelationTypeEditor(
834 - $o->possiblySynonymous,
835 - $o->possiblySynonymousId,
836 - $o->possibleSynonym,
837 - $viewInformation->possiblySynonymousRelationTypeId,
838 - $viewInformation,
839 - createObjectAttributesEditor($viewInformation, $o->objectAttributes, wfMsgSc("Property"), wfMsgSc("Value"), $o->possiblySynonymousId, $relationMeaningName, $viewInformation->getLeftOverAttributeFilter())
840 - );
841 -
842808 $availableEditors = new AttributeEditorMap();
843809 $availableEditors->addEditor($definitionEditor);
844810 $availableEditors->addEditor($alternativeDefinitionsEditor);
@@ -852,9 +818,6 @@
853819
854820 $availableEditors->addEditor(createObjectAttributesEditor($viewInformation, $o->definedMeaningAttributes, wfMsgSc("Property"), wfMsgSc("Value"), $o->definedMeaningId, $definedMeaningMeaningName, $viewInformation->getLeftOverAttributeFilter()));
855821
856 - if ($viewInformation->possiblySynonymousRelationTypeId != 0)
857 - $availableEditors->addEditor($possiblySynonymousEditor);
858 -
859822 $definedMeaningEditor = new RecordUnorderedListEditor($o->definedMeaning, 4);
860823
861824 foreach ($wdDefinedMeaningAttributesOrder as $attributeId) {
Index: trunk/extensions/Wikidata/App.php
@@ -88,8 +88,7 @@
8989 $dbr =& wfGetDB(DB_MASTER);
9090 $dbr->query("SET NAMES utf8");
9191
92 - $msgarray=
93 - array(
 92+ $msgarray = array(
9493 "save" => "Save",
9594 "history" => "History",
9695 "datasets" => "Data-set selection",
@@ -152,8 +151,6 @@
153152 "OptionAttributeValues" => "Option values",
154153 "OtherDefinedMeaning" => "Other defined meaning",
155154 "PopupAnnotation" => "Annotation",
156 - "PossibleSynonym" => "Possible synonym",
157 - "PossiblySynonymous" => "Possibly synonymous",
158155 "Relations" => "Relations",
159156 "RelationType" => "Relation type",
160157 "Spelling" => "Spelling",
@@ -170,32 +167,34 @@
171168 "TranslatedTextAttributeValues" => "Translatable texts",
172169 "LinkAttribute" => "Property",
173170 "LinkAttributeValues" => "Links",
174 - );
 171+ "Property" => "Property",
 172+ "Value" => "Value"
 173+ );
175174
176175 $prefixedmsgarray=array();
177 - foreach($msgarray as $key=>$value) {
 176+
 177+ foreach($msgarray as $key=>$value)
178178 $prefixedmsgarray[$wdSiteContext."_".$key]=$value;
179 - }
180179
181180 $wgMessageCache->addMessages($prefixedmsgarray);
182181
183 -
184182 $datasets=wdGetDatasets();
185183 $datasetarray['']=wfMsgHtml('ow_none_selected');
186184 foreach($datasets as $datasetid=>$dataset) {
187185 $datasetarray[$datasetid]=$dataset->fetchName();
188186 }
189 - $wgExtensionPreferences[]=array(
190 - 'name'=>'ow_uipref_datasets',
191 - 'section'=>'ow_uiprefs',
192 - 'type'=>PREF_OPTIONS_T,
193 - 'size'=>10,
194 - 'options'=>$datasetarray
 187+ $wgExtensionPreferences[] = array(
 188+ 'name' => 'ow_uipref_datasets',
 189+ 'section' => 'ow_uiprefs',
 190+ 'type' => PREF_OPTIONS_T,
 191+ 'size' => 10,
 192+ 'options' => $datasetarray
195193 );
196194
197195 global
198196 $messageCacheOK;
199 - $messageCacheOK=True;
 197+
 198+ $messageCacheOK = true;
200199
201200 return true;
202201 }

Status & tagging log