r22978 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22977‎ | r22978 | r22979 >
Date:12:03, 14 June 2007
Author:erik
Status:old
Tags:
Comment:
stub DefinedMeaningModel
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php (added) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/Wikidata.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php
@@ -404,7 +404,7 @@
405405
406406 /**
407407 * A representation and easy access to all defined-meaning related data in one handy spot
408 - * or would be. Currently only holds data that is eally needed. Please expand and
 408+ * or would be. Currently only holds data that is really needed. Please expand and
409409 * use to replace WiKiDataAPI.
410410 * Sometimes a getter or setter will query the database and/or attempt to deduce additional
411411 * information based on what it already knows, but don't count on that (yet).
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php
@@ -359,11 +359,12 @@
360360
361361 while($definedMeaning = $dbr->fetchObject($queryResult)) {
362362 $definedMeaningId = $definedMeaning->defined_meaning_id;
 363+ $dmModel=new DefinedMeaningModel($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation);
363364 $recordSet->addRecord(
364365 array(
365366 $definedMeaningId,
366367 getDefinedMeaningDefinition($definedMeaningId),
367 - getDefinedMeaningRecord($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation)
 368+ $dmModel->getRecord()
368369 )
369370 );
370371 }
@@ -449,36 +450,7 @@
450451 return 0;
451452 }
452453
453 -function getDefinedMeaningRecord($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) {
454 - global
455 - $definedMeaningAttribute, $definitionAttribute, $classAttributesAttribute,
456 - $alternativeDefinitionsAttribute, $synonymsAndTranslationsAttribute,
457 - $relationsAttribute, $reciprocalRelationsAttribute,
458 - $classMembershipAttribute, $collectionMembershipAttribute, $definedMeaningAttributesAttribute,
459 - $possiblySynonymousAttribute;
460454
461 - $record = new ArrayRecord($definedMeaningAttribute->type->getStructure());
462 - $record->setAttributeValue($definitionAttribute, getDefinedMeaningDefinitionRecord($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
463 - $record->setAttributeValue($classAttributesAttribute, getClassAttributesRecordSet($definedMeaningId, $queryTransactionInformation));
464 - $record->setAttributeValue($alternativeDefinitionsAttribute, getAlternativeDefinitionsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
465 - $record->setAttributeValue($synonymsAndTranslationsAttribute, getSynonymAndTranslationRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
466 -
467 - $filterRelationTypes = array();
468 -
469 - if ($possiblySynonymousRelationTypeId != 0) {
470 - $record->setAttributeValue($possiblySynonymousAttribute, getPossiblySynonymousRecordSet($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation));
471 - $filterRelationTypes[] = $possiblySynonymousRelationTypeId;
472 - }
473 -
474 - $record->setAttributeValue($relationsAttribute, getDefinedMeaningRelationsRecordSet($definedMeaningId, $filterLanguageId, $filterRelationTypes, $queryTransactionInformation));
475 - $record->setAttributeValue($reciprocalRelationsAttribute, getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
476 - $record->setAttributeValue($classMembershipAttribute, getDefinedMeaningClassMembershipRecordSet($definedMeaningId, $queryTransactionInformation));
477 - $record->setAttributeValue($collectionMembershipAttribute, getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, $queryTransactionInformation));
478 - $record->setAttributeValue($definedMeaningAttributesAttribute, getObjectAttributesRecord($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
479 -
480 - return $record;
481 -}
482 -
483455 function getClassAttributesRecordSet($definedMeaningId, $queryTransactionInformation) {
484456 global
485457 $classAttributesTable, $classAttributeIdAttribute, $classAttributeLevelAttribute, $classAttributeAttributeAttribute, $classAttributeTypeAttribute, $optionAttributeOptionsAttribute;
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php
@@ -0,0 +1,49 @@
 2+<?php
 3+
 4+require_once('OmegaWikiRecordSets.php');
 5+
 6+class DefinedMeaningModel {
 7+
 8+ protected $record=null;
 9+
 10+ public function __construct($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) {
 11+
 12+ global
 13+ $definedMeaningAttribute, $definitionAttribute, $classAttributesAttribute,
 14+ $alternativeDefinitionsAttribute, $synonymsAndTranslationsAttribute,
 15+ $relationsAttribute, $reciprocalRelationsAttribute,
 16+ $classMembershipAttribute, $collectionMembershipAttribute, $definedMeaningAttributesAttribute,
 17+ $possiblySynonymousAttribute;
 18+
 19+ $record = new ArrayRecord($definedMeaningAttribute->type->getStructure());
 20+ $record->setAttributeValue($definitionAttribute, getDefinedMeaningDefinitionRecord($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
 21+ $record->setAttributeValue($classAttributesAttribute, getClassAttributesRecordSet($definedMeaningId, $queryTransactionInformation));
 22+ $record->setAttributeValue($alternativeDefinitionsAttribute, getAlternativeDefinitionsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
 23+ $record->setAttributeValue($synonymsAndTranslationsAttribute, getSynonymAndTranslationRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
 24+
 25+ $filterRelationTypes = array();
 26+
 27+ if ($possiblySynonymousRelationTypeId != 0) {
 28+ $record->setAttributeValue($possiblySynonymousAttribute, getPossiblySynonymousRecordSet($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation));
 29+ $filterRelationTypes[] = $possiblySynonymousRelationTypeId;
 30+ }
 31+
 32+ $record->setAttributeValue($relationsAttribute, getDefinedMeaningRelationsRecordSet($definedMeaningId, $filterLanguageId, $filterRelationTypes, $queryTransactionInformation));
 33+ $record->setAttributeValue($reciprocalRelationsAttribute, getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
 34+ $record->setAttributeValue($classMembershipAttribute, getDefinedMeaningClassMembershipRecordSet($definedMeaningId, $queryTransactionInformation));
 35+ $record->setAttributeValue($collectionMembershipAttribute, getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, $queryTransactionInformation));
 36+ $record->setAttributeValue($definedMeaningAttributesAttribute, getObjectAttributesRecord($definedMeaningId, $filterLanguageId, $queryTransactionInformation));
 37+ $this->record=$record;
 38+
 39+ }
 40+
 41+ public function save() {
 42+
 43+ }
 44+
 45+ public function getRecord() {
 46+ return $this->record;
 47+ }
 48+
 49+}
 50+?>
\ No newline at end of file
Property changes on: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php
___________________________________________________________________
Added: svn:eol-style
151 + native
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php
@@ -3,6 +3,7 @@
44 require_once('Wikidata.php');
55 require_once('OmegaWikiRecordSets.php');
66 require_once('OmegaWikiEditors.php');
 7+require_once('DefinedMeaningModel.php');
78
89 class DefinedMeaning extends DefaultWikidataApplication {
910 public function view() {
@@ -27,16 +28,18 @@
2829 $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
2930
3031 $wgOut->addHTML($this->getConceptPanel());
 32+
 33+ $dmModel=new DefinedMeaningModel(
 34+ $definedMeaningId,
 35+ $this->filterLanguageId,
 36+ $this->possiblySynonymousRelationTypeId,
 37+ $this->viewQueryTransactionInformation);
 38+
3139 $wgOut->addHTML(
3240 getDefinedMeaningEditor(
3341 $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, $this->shouldShowAuthorities)->view(
3442 $this->getIdStack($definedMeaningId),
35 - getDefinedMeaningRecord(
36 - $definedMeaningId,
37 - $this->filterLanguageId,
38 - $this->possiblySynonymousRelationTypeId,
39 - $this->viewQueryTransactionInformation
40 - )
 43+ $dmModel->getRecord()
4144 )
4245 );
4346 $this->outputViewFooter();
@@ -51,15 +54,16 @@
5255 $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
5356
5457 $this->outputEditHeader();
 58+ $dmModel=new DefinedMeaningModel(
 59+ $definedMeaningId,
 60+ $this->filterLanguageId,
 61+ $this->possiblySynonymousRelationTypeId,
 62+ new QueryLatestTransactionInformation()
 63+ );
5564 $wgOut->addHTML(
5665 getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->edit(
5766 $this->getIdStack($definedMeaningId),
58 - getDefinedMeaningRecord(
59 - $definedMeaningId,
60 - $this->filterLanguageId,
61 - $this->possiblySynonymousRelationTypeId,
62 - new QueryLatestTransactionInformation()
63 - )
 67+ $dmModel->getRecord()
6468 )
6569 );
6670 $this->outputEditFooter();
@@ -72,15 +76,16 @@
7377 parent::history();
7478
7579 $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
76 - $wgOut->addHTML(
77 - getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, $this->showRecordLifeSpan, false)->view(
78 - new IdStack("defined-meaning"),
79 - getDefinedMeaningRecord(
 80+ $dmModel=new DefinedMeaningModel(
8081 $definedMeaningId,
8182 $this->filterLanguageId,
8283 $this->possiblySynonymousRelationTypeId,
8384 $this->queryTransactionInformation
84 - )
 85+ );
 86+ $wgOut->addHTML(
 87+ getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, $this->showRecordLifeSpan, false)->view(
 88+ new IdStack("defined-meaning"),
 89+ $dmModel->getRecord()
8590 )
8691 );
8792
@@ -96,13 +101,13 @@
97102 $wgTitle;
98103
99104 $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
100 - $record=getDefinedMeaningRecord(
 105+ $dmModel=new DefinedMeaningModel(
101106 $definedMeaningId,
102107 $this->filterLanguageId,
103108 $this->possiblySynonymousRelationTypeId,
104109 $this->viewQueryTransactionInformation
105110 );
106 - return $record;
 111+ return $dmModel->getRecord();
107112 }
108113
109114 protected function save($referenceTransaction) {
@@ -111,7 +116,7 @@
112117
113118 parent::save($referenceTransaction);
114119
115 - $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
 120+/* $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
116121 getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->save(
117122 $this->getIdStack($definedMeaningId),
118123 getDefinedMeaningRecord(
@@ -120,7 +125,22 @@
121126 $this->possiblySynonymousRelationTypeId,
122127 $referenceTransaction
123128 )
 129+ );*/
 130+
 131+ global
 132+ $wgTitle;
 133+
 134+ $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText());
 135+
 136+ $dmModel=new DefinedMeaningModel(
 137+ $definedMeaningId,
 138+ $this->filterLanguageId,
 139+ $this->possiblySynonymousRelationTypeId,
 140+ $referenceTransaction
124141 );
 142+
 143+ echo $dmModel->getRecord();
 144+
125145 }
126146
127147 protected function getIdStack($definedMeaningId) {

Status & tagging log