r23688 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23687‎ | r23688 | r23689 >
Date:21:30, 3 July 2007
Author:kim
Status:old
Tags:
Comment:
Some documentation, and spotted a refactor while I was at it
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/SaveDM.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php
@@ -6,22 +6,38 @@
77 require_once("Transaction.php");
88 require_once("WikiDataAPI.php");
99
10 -
 10+/** A front end for the database information/ArrayRecord and any other information
 11+ * to do with defined meanings (as per MVC)
 12+ * Will collect code for instantiating and loading and saving DMs here for now.
 13+ */
1114 class DefinedMeaningModel {
1215
1316 protected $record=null;
1417 protected $definedMeaningID=null;
1518
16 - public function __construct($definedMeaningId, $viewInformation) {
 19+ /**
 20+ *Construct a new DefinedMeaningModel for a particular defined meaning
 21+ * will fetch the appropriate record for the provided definedMeaningId
 22+ * you can't use this to construct a new DM from scratch (yet)
 23+ * you can't (yet) provide a dataset-context ($dc)
 24+ * @param $definedMeaningId the database ID of the DM
 25+ * @param $viewInformation Specify specific ViewInformation, if needed.
 26+ */
 27+ public function __construct($definedMeaningId, $viewInformation=null) {
1728
18 - wfDebug("definedMeaningId:$definedMeaningId, filterLanguageId:$viewInformation->filterLanguageId, possiblySynonymousRelationTypeId:$viewInformation->possiblySynonymousRelationTypeId, queryTransactionInformation:$viewInformation->queryTransactionInformation\n");
1929 global
2030 $definedMeaningAttribute, $definitionAttribute, $classAttributesAttribute,
2131 $alternativeDefinitionsAttribute, $synonymsAndTranslationsAttribute,
2232 $relationsAttribute, $reciprocalRelationsAttribute,
2333 $classMembershipAttribute, $collectionMembershipAttribute, $definedMeaningAttributesAttribute,
2434 $possiblySynonymousAttribute;
 35+
 36+ if (is_null($viewInformation)) {
 37+ $viewInformation = new ViewInformation();
 38+ $viewInformation->queryTransactionInformation= new QueryLatestTransactionInformation();
 39+ }
2540
 41+ #wfDebug("definedMeaningId:$definedMeaningId, filterLanguageId:$viewInformation->filterLanguageId, possiblySynonymousRelationTypeId:$viewInformation->possiblySynonymousRelationTypeId, queryTransactionInformation:$viewInformation->queryTransactionInformation\n");
2642 $this->setDefinedMeaningID($definedMeaningId);
2743 $record = new ArrayRecord($definedMeaningAttribute->type);
2844 $record->setAttributeValue($definitionAttribute, getDefinedMeaningDefinitionRecord($definedMeaningId, $viewInformation));
Index: trunk/extensions/Wikidata/OmegaWiki/SaveDM.php
@@ -1,6 +1,9 @@
22 <?php
33
44 # let's see...
 5+# start out with a test skeleton, get a record from one dataset
 6+# then save it to the other. Once this works, we can wrap it up nicely, and
 7+# apply it to our actual code.
58
69 define('MEDIAWIKI', true );
710
@@ -18,9 +21,9 @@
1922 global
2023 $wdCurrentContext;
2124 $wdCurrentContext=$dc;
22 - $viewInformation = new ViewInformation();
23 - $viewInformation->queryTransactionInformation= new QueryLatestTransactionInformation();
24 - $model=new DefinedMeaningModel($definedMeaningId, $viewInformation);
 25+ #$viewInformation = new ViewInformation();
 26+ #$viewInformation->queryTransactionInformation= new QueryLatestTransactionInformation();
 27+ $model=new DefinedMeaningModel($definedMeaningId);
2528 $record=$model->getRecord();
2629 #$record->finish("DefinedMeaning");
2730 return $model;
@@ -44,10 +47,10 @@
4548 /* insert code here */
4649
4750 $model=getDM(663672,"uw");
48 -saveDM($model,"tt");
 51+#saveDM($model,"tt");
4952
50 -#$record=$model->getRecord();
51 -#echo $record;
 53+$record=$model->getRecord();
 54+echo $record;
5255
5356 $endTime = time();
5457 echo("\n\nTime elapsed: " . durationToString($endTime - $beginTime));

Status & tagging log