Index: trunk/extensions/Wikidata/App.php |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | $wdGroupDefaultView=array(); |
27 | 27 | # Here you can set group defaults. |
28 | 28 | $wdGroupDefaultView['wikidata-omega']='uw'; |
29 | | -$wdGroupDefaultView['wikidata-test']='tt'; |
| 29 | +#$wdGroupDefaultView['wikidata-test']='tt'; |
30 | 30 | |
31 | 31 | # These are the user groups |
32 | 32 | $wgGroupPermissions['wikidata-omega']['editwikidata-uw']=true; |
— | — | @@ -108,15 +108,18 @@ |
109 | 109 | <p> For example, you could paste <code>DefinedMeaning:Boat (7774)</code> |
110 | 110 | or simply type <code>7774</code>.</p>\n", |
111 | 111 | 'ow_conceptmapping_no_action_specified'=>"Apologies, I don't know how to '$1'.", |
112 | | - 'ow_OK'=>'OK', |
113 | | - 'ow_not_present_or_malformed'=>'not present or malformed', |
| 112 | + 'ow_dm_OK'=>'OK', |
| 113 | + 'ow_dm_not_present'=>'not entered', |
| 114 | + 'ow_dm_not_found'=>'not found in database or malformed', |
114 | 115 | 'ow_mapping_successful'=>"Mapped all fields marked with [OK]<br>\n", |
115 | 116 | 'ow_mapping_unsuccessful'=>"Need to have at least two defined meanings before I can link them.\n", |
116 | 117 | 'ow_will_insert'=>"Will insert the following:", |
117 | 118 | 'ow_contents_of_mapping'=>'Contents of mapping', |
118 | 119 | 'ow_available_contexts'=>'Available contexts', |
119 | 120 | 'add_concept_link'=>'Add link to other concepts', |
120 | | - 'ow_concept_panel'=>'Concept Panel' |
| 121 | + 'ow_concept_panel'=>'Concept Panel', |
| 122 | + 'ow_dm_badtitle'=>'This page does not point to any DefinedMeaning (concept). Please check the web address.', |
| 123 | + 'ow_dm_missing'=>'This page seems to point to a non-existent DefinedMeaning (concept). Please check the web address.', |
121 | 124 | ) |
122 | 125 | ); |
123 | 126 | |
Index: trunk/extensions/Wikidata/Database scripts/Convenience/Create wikidata.php |
— | — | @@ -2,35 +2,36 @@ |
3 | 3 | |
4 | 4 | # this module create a wikidata extension for mediawiki |
5 | 5 | # it generates the tables in a database (passed as parameter) with a defined prefix (passed as parameter) |
6 | | -
|
7 | | -define('MEDIAWIKI', true );
|
8 | | -ob_end_flush();
|
9 | | -
|
| 6 | + |
| 7 | +define('MEDIAWIKI', true ); |
| 8 | +ob_end_flush(); |
| 9 | + |
10 | 10 | $wgUseMasterForMaintenance = true; |
11 | | -
|
12 | | -$sep = PATH_SEPARATOR;
|
13 | | -$IP = realpath( dirname( __FILE__ ) . "../../../../../" );
|
14 | | -$currentdir = dirname( __FILE__ );
|
15 | | -chdir( $IP );
|
16 | | -
|
17 | | -ini_set( 'include_path', ".$sepIP$sep$IP/extensions/Wikidata/OmegaWiki$sep$IP/includes$sep$IP/languages$sep$IP/maintenance" );
|
18 | | -
|
19 | | -require_once( "Defines.php");
|
20 | | -require_once( "ProfilerStub.php");
|
21 | | -require_once( "LocalSettings.php");
|
22 | | -require_once( "Setup.php");
|
23 | | -require_once( "Attribute.php" );
|
24 | | -require_once( "Transaction.php");
|
25 | | -require_once( "WikiDataBootstrappedMeanings.php");
|
26 | | -require_once( "StartProfiler.php" );
|
27 | | -require_once( "Exception.php");
|
28 | | -require_once( "GlobalFunctions.php");
|
29 | | -require_once( "Database.php");
|
30 | | -
|
31 | | -
|
32 | | -global
|
33 | | - $wgCommandLineMode, $wgUser, $numberOfBytes;
|
34 | | -
|
| 11 | + |
| 12 | +$sep = PATH_SEPARATOR; |
| 13 | + |
| 14 | +$IP = realpath( dirname( __FILE__ ) . "/../../../../" ); |
| 15 | +$currentdir = dirname( __FILE__ ); |
| 16 | +chdir( $IP ); |
| 17 | + |
| 18 | +ini_set( 'include_path', ".$sepIP$sep$IP/extensions/Wikidata/OmegaWiki$sep$IP/includes$sep$IP/languages$sep$IP/maintenance" ); |
| 19 | + |
| 20 | +require_once( "Defines.php"); |
| 21 | +require_once( "ProfilerStub.php"); |
| 22 | +require_once( "LocalSettings.php"); |
| 23 | +require_once( "Setup.php"); |
| 24 | +require_once( "Attribute.php" ); |
| 25 | +require_once( "Transaction.php"); |
| 26 | +require_once( "WikiDataBootstrappedMeanings.php"); |
| 27 | +require_once( "StartProfiler.php" ); |
| 28 | +require_once( "Exception.php"); |
| 29 | +require_once( "GlobalFunctions.php"); |
| 30 | +require_once( "Database.php"); |
| 31 | + |
| 32 | + |
| 33 | +global |
| 34 | + $wgCommandLineMode, $wgUser, $numberOfBytes; |
| 35 | + |
35 | 36 | function ReadSQLFile( $database, $pattern, $prefix, $filename ){ |
36 | 37 | $fp = fopen( $filename, 'r' ); |
37 | 38 | if ( false === $fp ) { |
— | — | @@ -71,102 +72,102 @@ |
72 | 73 | fclose( $fp ); |
73 | 74 | return true; |
74 | 75 | } |
75 | | -
|
76 | | -function getUserId( $userName ){
|
77 | | - $dbr = &wfGetDB(DB_SLAVE);
|
78 | | - $result = $dbr->query( "select user_id from user where user_name = '$userName'" );
|
79 | | - if ( $row = $dbr->fetchObject( $result ) ){
|
80 | | - return $row->user_id;
|
81 | | - }
|
82 | | - else {
|
83 | | - return -1;
|
84 | | - }
|
85 | | -}
|
86 | | -
|
87 | | -function bootStrappedDefinedMeanings( $dc ){
|
88 | | - global
|
89 | | - $definedMeaningMeaningName, $definitionMeaningName,
|
90 | | - $relationMeaningName, $synTransMeaningName,
|
91 | | - $annotationMeaningName, $wgCommandLineMode;
|
92 | | -
|
93 | | - $wgCommandLineMode = true;
|
94 | | -
|
95 | | - $dbr =& wfGetDB(DB_MASTER);
|
96 | | -
|
97 | | - $dbr->query("DROP TABLE IF EXISTS `{$dc}_bootstrapped_defined_meanings`;");
|
98 | | -
|
99 | | - $dbr->query("CREATE TABLE `{$dc}_bootstrapped_defined_meanings` (
|
100 | | - `name` VARCHAR(255) NOT NULL ,
|
101 | | - `defined_meaning_id` INT NOT NULL);");
|
102 | | -
|
103 | | -
|
104 | | - $userId = getUserId( 'Root' );
|
105 | | - if ( $userId == -1 ){
|
106 | | - echo "root user undefined\n";
|
107 | | - return;
|
108 | | - }
|
109 | | -
|
110 | | - setUser( $userId );
|
111 | | -
|
112 | | - setDefaultDC( $dc );
|
113 | | -
|
114 | | - $rdc = wdGetDataSetContext();
|
115 | | -
|
116 | | - startNewTransaction($userId, 0, "Script bootstrap class attribute meanings", $dc);
|
117 | | -
|
118 | | - $languageId = 85;
|
119 | | - $collectionId = bootstrapCollection("Class attribute levels", $languageId, "LEVL");
|
120 | | - $meanings = array();
|
121 | | - $meanings[$definedMeaningMeaningName] = bootstrapDefinedMeaning($definedMeaningMeaningName, $languageId, "The combination of an expression and definition in one language defining a concept.");
|
122 | | - $meanings[$definitionMeaningName] = bootstrapDefinedMeaning($definitionMeaningName, $languageId, "A paraphrase describing a concept.");
|
123 | | - $meanings[$synTransMeaningName] = bootstrapDefinedMeaning($synTransMeaningName, $languageId, "A translation or a synonym that is equal or near equal to the concept defined by the defined meaning.");
|
124 | | - $meanings[$relationMeaningName] = bootstrapDefinedMeaning($relationMeaningName, $languageId, "The association of two defined meanings through a specific relation type.");
|
125 | | - $meanings[$annotationMeaningName] = bootstrapDefinedMeaning($annotationMeaningName, $languageId, "Characteristic information of a concept.");
|
126 | | -
|
127 | | - foreach($meanings as $internalName => $meaningId) {
|
128 | | - addDefinedMeaningToCollection($meaningId, $collectionId, $internalName);
|
129 | | -
|
130 | | - $dbr->query("INSERT INTO `{$dc}_bootstrapped_defined_meanings` (name, defined_meaning_id) " .
|
131 | | - "VALUES (" . $dbr->addQuotes($internalName) . ", " . $meaningId . ")");
|
132 | | - }
|
133 | | -
|
134 | | - $timestamp = wfTimestampNow();
|
135 | | - $dbr->query("INSERT INTO {$dc}_script_log (time, script_name, comment) " .
|
136 | | - "VALUES (". $timestamp . "," . $dbr->addQuotes('23 - Bootstrap class attribute meanings.php') . "," . $dbr->addQuotes('create bootstrap class attribute meanings') . ")");
|
137 | | -
|
138 | | -}
|
139 | | -
|
140 | | -function bootstrapDefinedMeaning($spelling, $languageId, $definition) {
|
141 | | - $expression = findOrCreateExpression($spelling, $languageId);
|
142 | | - $definedMeaningId = createNewDefinedMeaning($expression->id, $languageId, $definition);
|
143 | | -
|
144 | | - return $definedMeaningId;
|
145 | | -}
|
146 | | -
|
147 | | -function setUser( $userid ){
|
148 | | - global $wgUser;
|
149 | | - $wgUser->setId( $userid );
|
150 | | - $wgUser->loadFromId();
|
151 | | -}
|
152 | | -
|
153 | | -function setDefaultDC( $dc ){
|
154 | | - global $wgUser, $wdDefaultViewDataSet;
|
155 | | -
|
156 | | - $groups=$wgUser->getGroups();
|
157 | | - foreach($groups as $group) {
|
158 | | - $wdGroupDefaultView[$group] = $dc;
|
159 | | - }
|
160 | | - $wdDefaultViewDataSet = $dc;
|
161 | | -}
|
162 | | -
|
| 76 | + |
| 77 | +function getUserId( $userName ){ |
| 78 | + $dbr = &wfGetDB(DB_SLAVE); |
| 79 | + $result = $dbr->query( "select user_id from user where user_name = '$userName'" ); |
| 80 | + if ( $row = $dbr->fetchObject( $result ) ){ |
| 81 | + return $row->user_id; |
| 82 | + } |
| 83 | + else { |
| 84 | + return -1; |
| 85 | + } |
| 86 | +} |
| 87 | + |
| 88 | +function bootStrappedDefinedMeanings( $dc ){ |
| 89 | + global |
| 90 | + $definedMeaningMeaningName, $definitionMeaningName, |
| 91 | + $relationMeaningName, $synTransMeaningName, |
| 92 | + $annotationMeaningName, $wgCommandLineMode; |
| 93 | + |
| 94 | + $wgCommandLineMode = true; |
| 95 | + |
| 96 | + $dbr =& wfGetDB(DB_MASTER); |
163 | 97 | |
| 98 | + $dbr->query("DROP TABLE IF EXISTS `{$dc}_bootstrapped_defined_meanings`;"); |
| 99 | + |
| 100 | + $dbr->query("CREATE TABLE `{$dc}_bootstrapped_defined_meanings` ( |
| 101 | + `name` VARCHAR(255) NOT NULL , |
| 102 | + `defined_meaning_id` INT NOT NULL);"); |
| 103 | + |
| 104 | + |
| 105 | + $userId = getUserId( 'Root' ); |
| 106 | + if ( $userId == -1 ){ |
| 107 | + echo "root user undefined\n"; |
| 108 | + return; |
| 109 | + } |
| 110 | + |
| 111 | + setUser( $userId ); |
| 112 | + |
| 113 | + setDefaultDC( $dc ); |
| 114 | + |
| 115 | + $rdc = wdGetDataSetContext(); |
| 116 | + |
| 117 | + startNewTransaction($userId, 0, "Script bootstrap class attribute meanings", $dc); |
| 118 | + |
| 119 | + $languageId = 85; |
| 120 | + $collectionId = bootstrapCollection("Class attribute levels", $languageId, "LEVL"); |
| 121 | + $meanings = array(); |
| 122 | + $meanings[$definedMeaningMeaningName] = bootstrapDefinedMeaning($definedMeaningMeaningName, $languageId, "The combination of an expression and definition in one language defining a concept."); |
| 123 | + $meanings[$definitionMeaningName] = bootstrapDefinedMeaning($definitionMeaningName, $languageId, "A paraphrase describing a concept."); |
| 124 | + $meanings[$synTransMeaningName] = bootstrapDefinedMeaning($synTransMeaningName, $languageId, "A translation or a synonym that is equal or near equal to the concept defined by the defined meaning."); |
| 125 | + $meanings[$relationMeaningName] = bootstrapDefinedMeaning($relationMeaningName, $languageId, "The association of two defined meanings through a specific relation type."); |
| 126 | + $meanings[$annotationMeaningName] = bootstrapDefinedMeaning($annotationMeaningName, $languageId, "Characteristic information of a concept."); |
| 127 | + |
| 128 | + foreach($meanings as $internalName => $meaningId) { |
| 129 | + addDefinedMeaningToCollection($meaningId, $collectionId, $internalName); |
| 130 | + |
| 131 | + $dbr->query("INSERT INTO `{$dc}_bootstrapped_defined_meanings` (name, defined_meaning_id) " . |
| 132 | + "VALUES (" . $dbr->addQuotes($internalName) . ", " . $meaningId . ")"); |
| 133 | + } |
| 134 | + |
| 135 | + $timestamp = wfTimestampNow(); |
| 136 | + $dbr->query("INSERT INTO {$dc}_script_log (time, script_name, comment) " . |
| 137 | + "VALUES (". $timestamp . "," . $dbr->addQuotes('23 - Bootstrap class attribute meanings.php') . "," . $dbr->addQuotes('create bootstrap class attribute meanings') . ")"); |
| 138 | + |
| 139 | +} |
| 140 | + |
| 141 | +function bootstrapDefinedMeaning($spelling, $languageId, $definition) { |
| 142 | + $expression = findOrCreateExpression($spelling, $languageId); |
| 143 | + $definedMeaningId = createNewDefinedMeaning($expression->id, $languageId, $definition); |
| 144 | + |
| 145 | + return $definedMeaningId; |
| 146 | +} |
| 147 | + |
| 148 | +function setUser( $userid ){ |
| 149 | + global $wgUser; |
| 150 | + $wgUser->setId( $userid ); |
| 151 | + $wgUser->loadFromId(); |
| 152 | +} |
| 153 | + |
| 154 | +function setDefaultDC( $dc ){ |
| 155 | + global $wgUser, $wdDefaultViewDataSet; |
| 156 | + |
| 157 | + $groups=$wgUser->getGroups(); |
| 158 | + foreach($groups as $group) { |
| 159 | + $wdGroupDefaultView[$group] = $dc; |
| 160 | + } |
| 161 | + $wdDefaultViewDataSet = $dc; |
| 162 | +} |
| 163 | + |
| 164 | + |
164 | 165 | $dbclass = 'Database' . ucfirst( $wgDBtype ) ; |
165 | 166 | $comment = ''; |
166 | 167 | $database = $wgDBname; |
167 | 168 | $user = $wgDBadminuser; |
168 | 169 | $password = $wgDBadminpassword; |
169 | 170 | $server = $wgDBserver; |
170 | | -
|
| 171 | + |
171 | 172 | # Parse arguments |
172 | 173 | for( $arg = reset( $argv ); $arg !== false; $arg = next( $argv ) ) { |
173 | 174 | if ( substr( $arg, 0, 7 ) == '-prefix' ) { |
— | — | @@ -226,26 +227,26 @@ |
227 | 228 | echo( "values of \$wgDBadminuser and \$wgDBadminpassword.\n" ); |
228 | 229 | exit(); |
229 | 230 | } |
230 | | -
|
231 | | -
|
232 | | -
|
| 231 | + |
| 232 | + |
| 233 | + |
233 | 234 | ReadSQLFile( $wdDatabase, "/*\$wgWDprefix*/", $wgWDprefix, $currentdir . DIRECTORY_SEPARATOR . $wgWDtemplate ); |
234 | | -
|
| 235 | + |
235 | 236 | $wdDatabase->query( "DELETE FROM wikidata_sets WHERE set_prefix = '$prefix'" ); |
236 | | -$wdDatabase->query( "INSERT INTO wikidata_sets (set_prefix,set_fallback_name,set_dmid) VALUES ('$prefix','$comment',0)" );
|
237 | | -
|
238 | | -if ( $template == "wikidataSourceTables.sql" ){
|
239 | | - bootStrappedDefinedMeanings( $prefix );
|
240 | | -}
|
| 237 | +$wdDatabase->query( "INSERT INTO wikidata_sets (set_prefix,set_fallback_name,set_dmid) VALUES ('$prefix','$comment',0)" ); |
241 | 238 | |
242 | | -$queryResult = $wdDatabase->query( "SELECT user_name FROM user WHERE user_real_name = '$prefix'" );
|
243 | | -if ( $row = $wdDatabase->fetchObject( $queryResult ) ){
|
244 | | - echo "user already existed";
|
245 | | -}
|
246 | | -else{
|
247 | | - $wdDatabase->query( "INSERT INTO user (user_name,user_real_name,user_password,user_newpassword,user_email,user_options) VALUES ('$comment','$prefix','','','','')" );
|
248 | | -}
|
| 239 | +if ( $template == "wikidataSourceTables.sql" ){ |
| 240 | + bootStrappedDefinedMeanings( $prefix ); |
| 241 | +} |
| 242 | + |
| 243 | +$queryResult = $wdDatabase->query( "SELECT user_name FROM user WHERE user_real_name = '$prefix'" ); |
| 244 | +if ( $row = $wdDatabase->fetchObject( $queryResult ) ){ |
| 245 | + echo "user already existed"; |
| 246 | +} |
| 247 | +else{ |
| 248 | + $wdDatabase->query( "INSERT INTO user (user_name,user_real_name,user_password,user_newpassword,user_email,user_options) VALUES ('$comment','$prefix','','','','')" ); |
| 249 | +} |
249 | 250 | $wdDatabase->close(); |
250 | | -
|
251 | 251 | |
| 252 | + |
252 | 253 | ?> |
\ No newline at end of file |
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php |
— | — | @@ -6,69 +6,182 @@ |
7 | 7 | require_once("Transaction.php"); |
8 | 8 | require_once("WikiDataAPI.php"); |
9 | 9 | |
10 | | -/** A front end for the database information/ArrayRecord and any other information |
| 10 | +/** |
| 11 | + * A front end for the database information/ArrayRecord and any other information |
11 | 12 | * to do with defined meanings (as per MVC) |
12 | 13 | * Will collect code for instantiating and loading and saving DMs here for now. |
13 | 14 | */ |
14 | 15 | class DefinedMeaningModel { |
15 | 16 | |
16 | 17 | protected $record=null; |
17 | | - protected $definedMeaningID=null; |
| 18 | + protected $recordIsLoaded=false; |
| 19 | + protected $exists=null; |
| 20 | + protected $id=null; |
18 | 21 | protected $viewInformation=null; |
| 22 | + protected $definingExpression=null; # String |
| 23 | + protected $dataset=null; |
| 24 | + protected $syntrans=array(); |
| 25 | + protected $titleObject=null; |
19 | 26 | |
20 | 27 | /** |
21 | | - *Construct a new DefinedMeaningModel for a particular defined meaning |
22 | | - * will fetch the appropriate record for the provided definedMeaningId |
23 | | - * you can't use this to construct a new DM from scratch (yet) |
24 | | - * you can't (yet) provide a dataset-context ($dc) |
25 | | - * @param $definedMeaningId the database ID of the DM |
26 | | - * @param $viewInformation Optional: Specify specific ViewInformation, if needed. |
| 28 | + * Construct a new DefinedMeaningModel for a particular DM. |
| 29 | + * You need to call loadRecord() to load the actual data. |
| 30 | + * |
| 31 | + * @param Integer the database ID of the DM |
| 32 | + * @param ViewInformation optional |
| 33 | + * @param DataSet where to look for the DM by default |
27 | 34 | */ |
28 | | - public function __construct($definedMeaningId, $viewInformation=null) { |
| 35 | + public function __construct($definedMeaningId, $viewInformation=null, DataSet $dc=null) { |
29 | 36 | |
30 | | - global |
31 | | - $definedMeaningAttribute, $definitionAttribute, $classAttributesAttribute, |
32 | | - $alternativeDefinitionsAttribute, $synonymsAndTranslationsAttribute, |
33 | | - $relationsAttribute, $reciprocalRelationsAttribute, |
34 | | - $classMembershipAttribute, $collectionMembershipAttribute, $definedMeaningAttributesAttribute, |
35 | | - $possiblySynonymousAttribute, $definedMeaningCompleteDefiningExpressionAttribute; |
36 | | - |
| 37 | + if(!$definedMeaningId) throw new Exception("DM needs at least a DMID!"); |
| 38 | + $this->setId($definedMeaningId); |
37 | 39 | if (is_null($viewInformation)) { |
38 | 40 | $viewInformation = new ViewInformation(); |
39 | 41 | $viewInformation->queryTransactionInformation= new QueryLatestTransactionInformation(); |
40 | 42 | } |
41 | | - |
42 | | - $this->viewInformation=$viewInformation; |
43 | | - #wfDebug("definedMeaningId:$definedMeaningId, filterLanguageId:$viewInformation->filterLanguageId, possiblySynonymousRelationTypeId:$viewInformation->possiblySynonymousRelationTypeId, queryTransactionInformation:$viewInformation->queryTransactionInformation\n"); |
44 | | - $this->setDefinedMeaningID($definedMeaningId); |
| 43 | + $this->viewInformation=$viewInformation; |
| 44 | + if(is_null($dc)) { |
| 45 | + $dc=wdGetDataSetContext(); |
| 46 | + } |
| 47 | + $this->dataset=$dc; |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Checks for existence of a DM. |
| 52 | + * If $this->definingExpression is set, it will also check if the spelling |
| 53 | + * of the defining expression matches |
| 54 | + * |
| 55 | + * @param Boolean If true, checks beyond the dataset context and will |
| 56 | + * return the first match. Always searches current |
| 57 | + * context first. |
| 58 | + * @param Boolean Switch dataset context if match outside default is found. |
| 59 | + * |
| 60 | + * @return DataSet object in which the DM was found, or null. |
| 61 | + * |
| 62 | + */ |
| 63 | + public function checkExistence($searchAllDataSets=false, $switchContext=false) { |
| 64 | + |
| 65 | + global $wdCurrentContext; |
| 66 | + $match=$this->checkExistenceInDataSet($this->dataset); |
| 67 | + if(!is_null($match)) { |
| 68 | + $this->exists=true; |
| 69 | + return $match; |
| 70 | + } else { |
| 71 | + $this->exists=false; |
| 72 | + if(!$searchAllDataSets) return null; |
| 73 | + } |
| 74 | + // Continue search |
| 75 | + $datasets=wdGetDataSets(); |
| 76 | + foreach($datasets as $currentSet) { |
| 77 | + if($currentSet->getPrefix() != $this->dataset->getPrefix()) { |
| 78 | + $match=$this->checkExistenceInDataSet($currentSet); |
| 79 | + if(!is_null($match)) { |
| 80 | + $this->exists=true; |
| 81 | + if($switchContext) { |
| 82 | + $wdCurrentContext=$match; |
| 83 | + $this->dataset=$match; |
| 84 | + } |
| 85 | + return $match; |
| 86 | + } |
| 87 | + } |
| 88 | + } |
| 89 | + $this->exists=false; |
| 90 | + return null; |
| 91 | + |
| 92 | + } |
| 93 | + |
| 94 | + /** |
| 95 | + * @param DataSet where to look |
| 96 | + * @param Integer Defined Meaning Id |
| 97 | + * @param String Spelling |
| 98 | + * @return DataSet or null |
| 99 | + * @see checkExistence |
| 100 | + * |
| 101 | + */ |
| 102 | + public function checkExistenceInDataSet(DataSet $dc) { |
| 103 | + |
| 104 | + $definingExpression=$this->definingExpression; |
| 105 | + $id=$this->getId(); |
| 106 | + $dbr =& wfGetDB(DB_SLAVE); |
| 107 | + $queryResult = $dbr->query("SELECT defined_meaning_id, expression_id from {$dc}_defined_meaning where defined_meaning_id=".$this->id." AND ".getLatestTransactionRestriction("{$dc}_defined_meaning")); |
| 108 | + $dmRow = $dbr->fetchObject($queryResult); |
| 109 | + if(!$dmRow || !$dmRow->defined_meaning_id) { |
| 110 | + return null; |
| 111 | + } |
| 112 | + if(is_null($definingExpression)) { |
| 113 | + return $dc; |
| 114 | + } else { |
| 115 | + $expid=(int)$dmRow->expression_id; |
| 116 | + $storedExpression = getExpression($expid, $dc); |
| 117 | + if(is_null($storedExpression)) return null; |
| 118 | + if($storedExpression->spelling != $definingExpression) { |
| 119 | + // Defining expression does not match, but check was requested! |
| 120 | + return null; |
| 121 | + } else { |
| 122 | + return $dc; |
| 123 | + } |
| 124 | + } |
| 125 | + } |
| 126 | + /** |
| 127 | + * Load the associated record object. |
| 128 | + * |
| 129 | + * @return Boolean indicating success. |
| 130 | + */ |
| 131 | + public function loadRecord() { |
| 132 | + |
| 133 | + if(is_null($this->exists)) { |
| 134 | + $this->checkExistence(); |
| 135 | + } |
| 136 | + |
| 137 | + if(!$this->exists) { |
| 138 | + return false; |
| 139 | + } |
| 140 | + |
| 141 | + global |
| 142 | + $definedMeaningAttribute, |
| 143 | + $definitionAttribute, |
| 144 | + $classAttributesAttribute, |
| 145 | + $alternativeDefinitionsAttribute, |
| 146 | + $synonymsAndTranslationsAttribute, |
| 147 | + $relationsAttribute, |
| 148 | + $reciprocalRelationsAttribute, |
| 149 | + $classMembershipAttribute, |
| 150 | + $collectionMembershipAttribute, |
| 151 | + $definedMeaningAttributesAttribute, |
| 152 | + $possiblySynonymousAttribute, |
| 153 | + $definedMeaningCompleteDefiningExpressionAttribute; |
| 154 | + |
| 155 | + $id=$this->getId(); |
| 156 | + $view=$this->getViewInformation(); |
| 157 | + /** FIXME: Records should be loaded using helpers rather than |
| 158 | + global functions! */ |
45 | 159 | $record = new ArrayRecord($definedMeaningAttribute->type); |
46 | | - $record->setAttributeValue($definedMeaningCompleteDefiningExpressionAttribute, getDefiningExpressionRecord($definedMeaningId)); |
47 | | - $record->setAttributeValue($definitionAttribute, getDefinedMeaningDefinitionRecord($definedMeaningId, $viewInformation)); |
48 | | - $record->setAttributeValue($classAttributesAttribute, getClassAttributesRecordSet($definedMeaningId, $viewInformation)); |
49 | | - $record->setAttributeValue($alternativeDefinitionsAttribute, getAlternativeDefinitionsRecordSet($definedMeaningId, $viewInformation)); |
50 | | - $record->setAttributeValue($synonymsAndTranslationsAttribute, getSynonymAndTranslationRecordSet($definedMeaningId, $viewInformation)); |
51 | | - |
| 160 | + $record->setAttributeValue($definedMeaningCompleteDefiningExpressionAttribute, getDefiningExpressionRecord($id)); |
| 161 | + $record->setAttributeValue($definitionAttribute, getDefinedMeaningDefinitionRecord($id, $view)); |
| 162 | + $record->setAttributeValue($classAttributesAttribute, getClassAttributesRecordSet($id, $view)); |
| 163 | + $record->setAttributeValue($alternativeDefinitionsAttribute, getAlternativeDefinitionsRecordSet($id, $view)); |
| 164 | + $record->setAttributeValue($synonymsAndTranslationsAttribute, getSynonymAndTranslationRecordSet($id, $view)); |
52 | 165 | $filterRelationTypes = array(); |
53 | 166 | |
54 | | - if ($viewInformation->possiblySynonymousRelationTypeId != 0) { |
55 | | - $record->setAttributeValue($possiblySynonymousAttribute, getPossiblySynonymousRecordSet($definedMeaningId, $viewInformation)); |
56 | | - $filterRelationTypes[] = $viewInformation->possiblySynonymousRelationTypeId; |
| 167 | + if ($view->possiblySynonymousRelationTypeId != 0) { |
| 168 | + $record->setAttributeValue($possiblySynonymousAttribute, getPossiblySynonymousRecordSet($id, $view)); |
| 169 | + $filterRelationTypes[] = $view->possiblySynonymousRelationTypeId; |
57 | 170 | } |
58 | 171 | |
59 | | - $record->setAttributeValue($relationsAttribute, getDefinedMeaningRelationsRecordSet($definedMeaningId, $filterRelationTypes, $viewInformation)); |
60 | | - $record->setAttributeValue($reciprocalRelationsAttribute, getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, $viewInformation)); |
61 | | - $record->setAttributeValue($classMembershipAttribute, getDefinedMeaningClassMembershipRecordSet($definedMeaningId, $viewInformation)); |
62 | | - $record->setAttributeValue($collectionMembershipAttribute, getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, $viewInformation)); |
63 | | - $record->setAttributeValue($definedMeaningAttributesAttribute, getObjectAttributesRecord($definedMeaningId, $viewInformation)); |
| 172 | + $record->setAttributeValue($relationsAttribute, getDefinedMeaningRelationsRecordSet($id, $filterRelationTypes, $view)); |
| 173 | + $record->setAttributeValue($reciprocalRelationsAttribute, getDefinedMeaningReciprocalRelationsRecordSet($id, $view)); |
| 174 | + $record->setAttributeValue($classMembershipAttribute, getDefinedMeaningClassMembershipRecordSet($id, $view)); |
| 175 | + $record->setAttributeValue($collectionMembershipAttribute, getDefinedMeaningCollectionMembershipRecordSet($id, $view)); |
| 176 | + $record->setAttributeValue($definedMeaningAttributesAttribute, getObjectAttributesRecord($id, $view)); |
64 | 177 | $this->record=$record; |
65 | | - |
| 178 | + $this->recordIsLoaded=true; |
| 179 | + return true; |
66 | 180 | } |
67 | 181 | |
68 | | - /*horrible cannibalised hack. Use at own risk*/ |
69 | | - /* Sorry, don't know what horrible cannibalised hacks are. Therefore I cannot update code properly. |
70 | | - * Please check if it still works correctly. Peter-Jan Roes. |
| 182 | + /** |
| 183 | + * FIXME - work in progress |
| 184 | + * |
71 | 185 | */ |
72 | | - /* You are a wise man! :-D */ |
73 | 186 | public function save() { |
74 | 187 | initializeOmegaWikiAttributes($this->viewInformation); |
75 | 188 | initializeObjectAttributeEditors($this->viewInformation); |
— | — | @@ -101,11 +214,13 @@ |
102 | 215 | ); |
103 | 216 | } |
104 | 217 | |
105 | | - /*horrible cannibalised hack. Use at own risk*/ |
| 218 | + /** |
| 219 | + * FIXME - work in progress |
| 220 | + */ |
106 | 221 | protected function getIdStack($definedMeaningId) { |
107 | 222 | global |
108 | 223 | $definedMeaningIdAttribute; |
109 | | - |
| 224 | + |
110 | 225 | $definedMeaningIdStructure = new Structure($definedMeaningIdAttribute); |
111 | 226 | $definedMeaningIdRecord = new ArrayRecord($definedMeaningIdStructure, $definedMeaningIdStructure); |
112 | 227 | $definedMeaningIdRecord->setAttributeValue($definedMeaningIdAttribute, $definedMeaningId); |
— | — | @@ -116,8 +231,9 @@ |
117 | 232 | return $idStack; |
118 | 233 | } |
119 | 234 | |
120 | | - /*horrible cannibalised hack. Use at own risk*/ |
121 | | - /* this particular function doesn't actually work yet */ |
| 235 | + /** |
| 236 | + * FIXME - work in progress |
| 237 | + */ |
122 | 238 | public function saveWithinTransaction() { |
123 | 239 | #global |
124 | 240 | # $wgTitle, $wgUser, $wgRequest; |
— | — | @@ -141,16 +257,25 @@ |
142 | 258 | #RecentChange::notifyEdit($now, $wgTitle, false, $wgUser, $summary, 0, $now, false, '', 0, 0, 0); |
143 | 259 | } |
144 | 260 | |
| 261 | + /** |
| 262 | + * @return associated record object or null. Loads it if necessary. |
| 263 | + */ |
145 | 264 | public function getRecord() { |
| 265 | + if(!$this->recordIsLoaded) { |
| 266 | + $this->loadRecord(); |
| 267 | + } |
| 268 | + if(!$this->recordIsLoaded) { |
| 269 | + return null; |
| 270 | + } |
146 | 271 | return $this->record; |
147 | 272 | } |
148 | 273 | |
149 | | - public function setDefinedMeaningID($definedMeaningID) { |
150 | | - $this->definedMeaningID=$definedMeaningID; |
| 274 | + public function setViewInformation(ViewInformation $viewInformation) { |
| 275 | + $this->viewInformation=$viewInformation; |
151 | 276 | } |
152 | 277 | |
153 | | - public function getDefinedMeaningID() { |
154 | | - return $this->definedMeaningID; |
| 278 | + public function getViewInformation() { |
| 279 | + return $this->viewInformation; |
155 | 280 | } |
156 | 281 | |
157 | 282 | /** Attempts to save defining expression if it does not exist "here" |
— | — | @@ -160,7 +285,6 @@ |
161 | 286 | |
162 | 287 | $record=$this->getRecord(); |
163 | 288 | $expression=$record->getValue("defined-meaning-full-defining-expression"); |
164 | | - |
165 | 289 | $spelling=$expression->getValue("defined-meaning-defining-expression"); |
166 | 290 | $language=$expression->getValue("language"); |
167 | 291 | return findOrCreateExpression($spelling, $language); |
— | — | @@ -188,5 +312,153 @@ |
189 | 313 | # use proper OO for this. |
190 | 314 | } |
191 | 315 | |
192 | | -} |
| 316 | + /** |
| 317 | + * Return one of the syntrans entries of this defined meaning, |
| 318 | + * specified by language code. Caches the syntrans records |
| 319 | + * in an array. |
| 320 | + * |
| 321 | + * @param String Language code of the synonym/translation to look for |
| 322 | + * @param String Fallback to use if not found |
| 323 | + * @return Spelling or null if not found at all |
| 324 | + * |
| 325 | + * TODO make fallback optional |
| 326 | + * |
| 327 | + */ |
| 328 | + public function getSyntransByLanguageCode($languageCode, $fallbackCode="en") { |
193 | 329 | |
| 330 | + if(array_key_exists($languageCode, $this->syntrans)) |
| 331 | + return $this->syntrans[$languageCode]; |
| 332 | + |
| 333 | + $syntrans=getSpellingForLanguage($this->getId(), $languageCode, $fallbackCode, $this->dataset); |
| 334 | + if(!is_null($syntrans)) { |
| 335 | + $this->syntrans[$languageCode]=$syntrans; |
| 336 | + } |
| 337 | + return $syntrans; |
| 338 | + } |
| 339 | + |
| 340 | + /** |
| 341 | + * @return the page title object associated with this defined meaning |
| 342 | + * First time from DB lookup. Subsequently from cache |
| 343 | + */ |
| 344 | + public function getTitleObject() { |
| 345 | + if ($this->titleObject==null) { |
| 346 | + $definingExpression=$this->getDefiningExpression(); |
| 347 | + $id=$this->getId(); |
| 348 | + |
| 349 | + if (is_null($definingExpression) or is_null($id)) |
| 350 | + return null; |
| 351 | + |
| 352 | + $definingExpressionAsTitle=str_replace(" ", "_", $definingExpression); |
| 353 | + $text="DefinedMeaning:".$definingExpressionAsTitle."_($id)"; |
| 354 | + $titleObject=Title::newFromText($text); |
| 355 | + $this->titleObject=$titleObject; |
| 356 | + } |
| 357 | + return $this->titleObject; |
| 358 | + } |
| 359 | + |
| 360 | + |
| 361 | + /** |
| 362 | + * @return HTML link including the wrapping tag |
| 363 | + * @param String Language code of synonym/translation to show |
| 364 | + * @param String Fallback code |
| 365 | + * @throws Exception If title object is missing |
| 366 | + */ |
| 367 | + public function getHTMLLink($languageCode, $fallbackCode="en") { |
| 368 | + global $wgUser; |
| 369 | + $skin=$wgUser->getSkin(); |
| 370 | + $titleObject=$this->getTitleObject(); |
| 371 | + if ($titleObject==null) |
| 372 | + throw new Exception("Need title object to create link"); |
| 373 | + |
| 374 | + $dataset=$this->getDataset(); |
| 375 | + $prefix=$dataset->getPrefix(); |
| 376 | + $name=$this->getSyntransByLanguageCode($languageCode, $fallbackCode); |
| 377 | + return $skin->makeLinkObj($title, $name , "dataset=$prefix"); |
| 378 | + } |
| 379 | + |
| 380 | + /** |
| 381 | + * |
| 382 | + * Splits title of the form "Abc (123)" into text and number |
| 383 | + * components. |
| 384 | + * |
| 385 | + * @param String the title to analyze |
| 386 | + * @return Array of the two components or null. |
| 387 | + * |
| 388 | + */ |
| 389 | + public static function splitTitleText($titleText) { |
| 390 | + $bracketPosition = strrpos($titleText, "("); |
| 391 | + if ($bracketPosition==false) |
| 392 | + return null; # Defined Meaning ID is missing from title string |
| 393 | + $rv=array(); |
| 394 | + $definingExpression = substr($titleText, 0, $bracketPosition -1); |
| 395 | + $definingExpression = str_replace("_"," ",$definingExpression); |
| 396 | + $definedMeaningId = substr($titleText, $bracketPosition + 1, strlen($titleText) - $bracketPosition - 2); |
| 397 | + $rv["expression"]=$definingExpression; |
| 398 | + $rv["id"]=(int)$definedMeaningId; |
| 399 | + return $rv; |
| 400 | + } |
| 401 | + |
| 402 | + /** |
| 403 | + * @return full text representation of title |
| 404 | + */ |
| 405 | + public function getTitleText() { |
| 406 | + $title=$this->getTitleObject(); |
| 407 | + return $title->getFullText(); |
| 408 | + } |
| 409 | + |
| 410 | + public function setId($id) { |
| 411 | + $this->id=$id; |
| 412 | + } |
| 413 | + |
| 414 | + public function getId() { |
| 415 | + return $this->id; |
| 416 | + } |
| 417 | + |
| 418 | + /** |
| 419 | + * Fetch from DB if necessary |
| 420 | + * |
| 421 | + */ |
| 422 | + public function getDefiningExpression() { |
| 423 | + if(is_null($this->definingExpression)) { |
| 424 | + return definingExpression($this->getId(),$this->getDataset()); |
| 425 | + } |
| 426 | + return $this->definingExpression; |
| 427 | + } |
| 428 | + |
| 429 | + public function setDefiningExpression($definingExpression) { |
| 430 | + $this->definingExpression=$definingExpression; |
| 431 | + } |
| 432 | + |
| 433 | + public function setDataset(&$dataset) { |
| 434 | + $this->dataset=$dataset; |
| 435 | + } |
| 436 | + |
| 437 | + public function getDataset() { |
| 438 | + return $this->dataset; |
| 439 | + } |
| 440 | + |
| 441 | + public function setLanguageId($languageId) { |
| 442 | + $this->languageId = $languageId; |
| 443 | + } |
| 444 | + |
| 445 | + public function getLanguageId() { |
| 446 | + return $this->languageId; |
| 447 | + } |
| 448 | + |
| 449 | + public function setLanguageCode($languageCode) { |
| 450 | + return $this->langaugeCode; |
| 451 | + } |
| 452 | + |
| 453 | + public function getLanguageCode() { |
| 454 | + if ($this->languageCode==null) { |
| 455 | + global |
| 456 | + $wgUser; |
| 457 | + $this->languageCode=$wgUser->getOption('language'); |
| 458 | + } |
| 459 | + return $this->languageCode; |
| 460 | + } |
| 461 | + public function exists() { |
| 462 | + return $this->exists; |
| 463 | + } |
| 464 | + |
| 465 | +} |
\ No newline at end of file |
Index: trunk/extensions/Wikidata/OmegaWiki/Transaction.php |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | |
52 | 52 | class QueryLatestTransactionInformation extends DefaultQueryTransactionInformation { |
53 | 53 | public function getRestriction(Table $table) { |
54 | | - return getLatestTransactionRestriction($table->identifier); |
| 54 | + return getLatestTransactionRestriction($table->getIdentifier()); |
55 | 55 | } |
56 | 56 | |
57 | 57 | public function setVersioningAttributes(Record $record, $row) { |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | } |
93 | 93 | |
94 | 94 | public function getRestriction(Table $table) { |
95 | | - return getAtTransactionRestriction($table->identifier, $this->transactionId); |
| 95 | + return getAtTransactionRestriction($table->getIdentifier(), $this->transactionId); |
96 | 96 | } |
97 | 97 | |
98 | 98 | public function versioningAttributes() { |
— | — | @@ -126,8 +126,8 @@ |
127 | 127 | |
128 | 128 | public function getRestriction(Table $table) { |
129 | 129 | return |
130 | | - " " . $table->identifier . ".add_transaction_id =". $this->transactionId . |
131 | | - " OR " . $table->identifier . ".removeTransactionId =" . $this->transactionId; |
| 130 | + " " . $table->getIdentifier() . ".add_transaction_id =". $this->transactionId . |
| 131 | + " OR " . $table->getIdentifier() . ".removeTransactionId =" . $this->transactionId; |
132 | 132 | } |
133 | 133 | |
134 | 134 | // public function versioningAttributes() { |
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php |
— | — | @@ -1303,7 +1303,6 @@ |
1304 | 1304 | $class = $idPath->getClass(); |
1305 | 1305 | $attributeId = $idPath->getId(); |
1306 | 1306 | $attributeValue = $value->getAttributeValue($attribute); |
1307 | | - |
1308 | 1307 | if ($editor->showsData($attributeValue)) |
1309 | 1308 | $result .= '<' . $this->htmlTag . '>' . |
1310 | 1309 | $this->childHeader($editor, $attribute, $class, $attributeId) . |
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataTables.php |
— | — | @@ -15,6 +15,10 @@ |
16 | 16 | $this->identifier = $identifier; |
17 | 17 | } |
18 | 18 | |
| 19 | + public function getIdentifier() { |
| 20 | + return $this->identifier; |
| 21 | + } |
| 22 | + |
19 | 23 | public function qualifiedName() { |
20 | 24 | return $this->table->identifier . '.' . $this->identifier; |
21 | 25 | } |
— | — | @@ -31,12 +35,17 @@ |
32 | 36 | public $columns; |
33 | 37 | |
34 | 38 | public function __construct($identifier, $isVersioned, $keyFields) { |
| 39 | + # Without dataset prefix! |
35 | 40 | $this->identifier = $identifier; |
36 | 41 | $this->isVersioned = $isVersioned; |
37 | 42 | $this->keyFields = $keyFields; |
38 | 43 | $this->columns = array(); |
39 | 44 | } |
40 | | - |
| 45 | + |
| 46 | + public function getIdentifier() { |
| 47 | + $dc = wdGetDataSetContext(); |
| 48 | + return "{$dc}_".$this->identifier; |
| 49 | + } |
41 | 50 | protected function createColumn($identifier) { |
42 | 51 | $result = new TableColumn($this, $identifier); |
43 | 52 | $this->columns[] = $result; |
— | — | @@ -116,22 +125,22 @@ |
117 | 126 | $urlAttributeValuesTable; |
118 | 127 | |
119 | 128 | $dc=wdGetDataSetContext(); |
120 | | -$alternativeDefinitionsTable = new Table("{$dc}_alt_meaningtexts", true, array('meaning_mid', 'meaning_text_tcid')); |
121 | | -$bootstrappedDefinedMeaningsTable = new BootstrappedDefinedMeaningsTable("{$dc}_bootstrapped_defined_meanings"); |
122 | | -$classAttributesTable = new Table("{$dc}_class_attributes", true, array('object_id')); |
123 | | -$classMembershipsTable = new Table("{$dc}_class_membership", true, array('class_membership_id')); |
124 | | -$collectionMembershipsTable = new Table("{$dc}_collection_contents", true, array('collection_id', 'member_mid')); |
125 | | -$definedMeaningTable = new DefinedMeaningTable("{$dc}_defined_meaning"); |
126 | | -$expressionTable = new ExpressionTable("{$dc}_expression_ns"); |
127 | | -$meaningRelationsTable = new Table("{$dc}_meaning_relations", true, array('relation_id')); |
128 | | -$syntransTable = new Table("{$dc}_syntrans", true, array('syntrans_sid')); |
129 | | -$textAttributeValuesTable = new Table("{$dc}_text_attribute_values", true, array('value_id')); |
130 | | -$transactionsTable = new Table("{$dc}_transactions", false, array('transaction_id')); |
131 | | -$translatedContentAttributeValuesTable = new Table("{$dc}_translated_content_attribute_values", true, array('value_id')); |
132 | | -$translatedContentTable = new Table("{$dc}_translated_content", true, array('translated_content_id', 'language_id')); |
133 | | -$optionAttributeOptionsTable = new Table("{$dc}_option_attribute_options", true, array('attribute_id', 'option_mid')); |
134 | | -$optionAttributeValuesTable = new Table("{$dc}_option_attribute_values", true, array('value_id')); |
135 | | -$urlAttributeValuesTable = new Table("{$dc}_url_attribute_values", true, array('value_id')); |
| 129 | +$alternativeDefinitionsTable = new Table("alt_meaningtexts", true, array('meaning_mid', 'meaning_text_tcid')); |
| 130 | +$bootstrappedDefinedMeaningsTable = new BootstrappedDefinedMeaningsTable("bootstrapped_defined_meanings"); |
| 131 | +$classAttributesTable = new Table("class_attributes", true, array('object_id')); |
| 132 | +$classMembershipsTable = new Table("class_membership", true, array('class_membership_id')); |
| 133 | +$collectionMembershipsTable = new Table("collection_contents", true, array('collection_id', 'member_mid')); |
| 134 | +$definedMeaningTable = new DefinedMeaningTable("defined_meaning"); |
| 135 | +$expressionTable = new ExpressionTable("expression_ns"); |
| 136 | +$meaningRelationsTable = new Table("meaning_relations", true, array('relation_id')); |
| 137 | +$syntransTable = new Table("syntrans", true, array('syntrans_sid')); |
| 138 | +$textAttributeValuesTable = new Table("text_attribute_values", true, array('value_id')); |
| 139 | +$transactionsTable = new Table("transactions", false, array('transaction_id')); |
| 140 | +$translatedContentAttributeValuesTable = new Table("translated_content_attribute_values", true, array('value_id')); |
| 141 | +$translatedContentTable = new Table("translated_content", true, array('translated_content_id', 'language_id')); |
| 142 | +$optionAttributeOptionsTable = new Table("option_attribute_options", true, array('attribute_id', 'option_mid')); |
| 143 | +$optionAttributeValuesTable = new Table("option_attribute_values", true, array('value_id')); |
| 144 | +$urlAttributeValuesTable = new Table("url_attribute_values", true, array('value_id')); |
136 | 145 | |
137 | 146 | function select($expressions, $tables, $restrictions) { |
138 | 147 | $result = "SELECT " . $expressions[0]->toExpression(); |
— | — | @@ -140,10 +149,10 @@ |
141 | 150 | $result .= ", " . $expressions[$i]->toExpression(); |
142 | 151 | |
143 | 152 | if (count($tables) > 0) { |
144 | | - $result .= " FROM " . $tables[0]->identifier; |
| 153 | + $result .= " FROM " . $tables[0]->getIdentifier(); |
145 | 154 | |
146 | 155 | for ($i = 1; $i < count($tables); $i++) |
147 | | - $result .= ", " . $tables[$i]->identifier; |
| 156 | + $result .= ", " . $tables[$i]->getIdentifier(); |
148 | 157 | } |
149 | 158 | |
150 | 159 | if (count($restrictions) > 0) { |
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php |
— | — | @@ -8,33 +8,49 @@ |
9 | 9 | class DefinedMeaning extends DefaultWikidataApplication { |
10 | 10 | public function view() { |
11 | 11 | global |
12 | | - $wgOut, $wgTitle, $wgRequest; |
| 12 | + $wgOut, $wgTitle, $wgRequest, $wdCurrentContext; |
13 | 13 | |
| 14 | + // Split title into defining expression and ID |
| 15 | + $titleText = $wgTitle->getText(); |
| 16 | + $dmInfo = DefinedMeaningModel::splitTitleText($titleText); |
| 17 | + |
| 18 | + // Title doesn't have an ID in it (or ID 0) |
| 19 | + if(is_null($dmInfo) || !$dmInfo["id"]) { |
| 20 | + $wgOut->showErrorPage('errorpagetitle','ow_dm_badtitle'); |
| 21 | + return false; |
| 22 | + } |
| 23 | + $definedMeaningModel = new DefinedMeaningModel($dmInfo["id"]); |
| 24 | + |
| 25 | + if(!empty($dmInfo["expression"])) |
| 26 | + $definedMeaningModel->setDefiningExpression($dmInfo["expression"]); |
| 27 | + |
| 28 | + // Search for this DM in all data-sets, beginning with the current one. |
| 29 | + // Switch dataset context if found elsewhere. |
| 30 | + $match=$definedMeaningModel->checkExistence(true, true); |
| 31 | + |
| 32 | + if(is_null($match)) { |
| 33 | + $wgOut->showErrorPage('errorpagetitle','ow_dm_missing'); |
| 34 | + return false; |
| 35 | + } |
| 36 | + |
| 37 | + $definedMeaningModel->loadRecord(); |
14 | 38 | $this->showDataSetPanel=false; |
15 | 39 | parent::view(); |
16 | 40 | |
| 41 | + # Raw mode |
17 | 42 | $view_as=$wgRequest->getText('view_as'); |
18 | | - |
19 | 43 | if ($view_as=="raw") { |
20 | | - $wgOut->disable(); |
21 | | - echo("<pre>".$this->raw()."</pre>"); |
| 44 | + $wgOut->addHTML("<pre>".$definedMeaningModel->getRecord()."</pre>"); |
| 45 | + #$wgOut->disable(); |
22 | 46 | return; |
23 | 47 | } |
| 48 | + |
24 | 49 | $this->outputViewHeader(); |
25 | | - |
26 | | - // Obtain ID from title of the form "DefinedMeaning:Foo (1234)" for database lookup |
27 | | - $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText()); |
28 | | - |
29 | 50 | $wgOut->addHTML($this->getConceptPanel()); |
30 | | - |
31 | | - $dmModel=new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
32 | | - |
33 | | - $wgOut->addHTML( |
34 | | - getDefinedMeaningEditor($this->viewInformation)->view( |
35 | | - $this->getIdStack($definedMeaningId), |
36 | | - $dmModel->getRecord() |
37 | | - ) |
38 | | - ); |
| 51 | + $editor=getDefinedMeaningEditor($this->viewInformation); |
| 52 | + $idStack=$this->getIdStack($definedMeaningModel->getId()); |
| 53 | + $html=$editor->view($idStack,$definedMeaningModel->getRecord()); |
| 54 | + $wgOut->addHTML($html); |
39 | 55 | $this->outputViewFooter(); |
40 | 56 | } |
41 | 57 | |
— | — | @@ -51,7 +67,7 @@ |
52 | 68 | |
53 | 69 | $wgOut->addHTML( |
54 | 70 | getDefinedMeaningEditor($this->viewInformation)->edit( |
55 | | - $this->getIdStack($definedMeaningId), |
| 71 | + $this->getIdStack($dmModel->getId()), |
56 | 72 | $dmModel->getRecord() |
57 | 73 | ) |
58 | 74 | ); |
— | — | @@ -77,19 +93,6 @@ |
78 | 94 | $wgOut->addHTML("<script language='javascript'><!--\nexpandEditors();\n--></script>"); |
79 | 95 | } |
80 | 96 | |
81 | | - /** |
82 | | - @return Basic structured data dump |
83 | | - */ |
84 | | - public function raw() { |
85 | | - global |
86 | | - $wgTitle; |
87 | | - |
88 | | - $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText()); |
89 | | - $dmModel = new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
90 | | - $record=$dmModel->getRecord(); |
91 | | - return $record; |
92 | | - } |
93 | | - |
94 | 97 | protected function save($referenceQueryTransactionInformation) { |
95 | 98 | global |
96 | 99 | $wgTitle; |
— | — | @@ -164,7 +167,7 @@ |
165 | 168 | $html="<div class=\"dataset-panel\">";; |
166 | 169 | $html.="<table border=\"0\"><tr><th class=\"dataset-panel-heading\">$ow_conceptpanel</th></tr>"; |
167 | 170 | $sk=$wgUser->getSkin(); |
168 | | - $meanings=getDefinedMeaningDataAssociatedByConcept($dm,$dc); |
| 171 | + $meanings=getDefinedMeaningDataAssociatedByConcept($dm, $dc); |
169 | 172 | if($meanings) { |
170 | 173 | foreach ($meanings as $dm) { |
171 | 174 | $dataset=$dm->getDataset(); |
— | — | @@ -173,7 +176,7 @@ |
174 | 177 | $prefix=$dataset->getPrefix(); |
175 | 178 | |
176 | 179 | $class= $active ? 'dataset-panel-active' : 'dataset-panel-inactive'; |
177 | | - $slot = $active ? "$name" : $sk->makeLinkObj($dm->getTitle(),$name,"dataset=$prefix"); |
| 180 | + $slot = $active ? "$name" : $sk->makeLinkObj($dm->getTitleObject(),$name,"dataset=$prefix"); |
178 | 181 | $html.="<tr><td class=\"$class\">$slot</td></tr>"; |
179 | 182 | } |
180 | 183 | } else { |
Index: trunk/extensions/Wikidata/OmegaWiki/HTMLtable.php |
— | — | @@ -5,9 +5,9 @@ |
6 | 6 | require_once("RecordSet.php"); |
7 | 7 | |
8 | 8 | global |
9 | | - $wgSitename; |
| 9 | + $wgStylePath; |
10 | 10 | |
11 | | -$URL = "/$wgSitename/skins/common/images/sort_none.gif"; |
| 11 | +$URL = "$wgStylePath/common/images/sort_none.gif"; |
12 | 12 | define ('SORT_IMAGE', ' <img src="' . $URL . '"></img>'); |
13 | 13 | |
14 | 14 | function parityClass($value) { |
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php |
— | — | @@ -40,16 +40,22 @@ |
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | | -function getExpression($expressionId) { |
45 | | - $dc=wdGetDataSetContext(); |
| 44 | +function getExpression($expressionId, $dc=null) { |
| 45 | + if(is_null($dc)) { |
| 46 | + $dc=wdGetDataSetContext(); |
| 47 | + } |
46 | 48 | $dbr =& wfGetDB(DB_SLAVE); |
47 | 49 | $queryResult = $dbr->query("SELECT spelling, language_id " . |
48 | 50 | " FROM {$dc}_expression_ns " . |
49 | 51 | " WHERE {$dc}_expression_ns.expression_id=$expressionId". |
50 | 52 | " AND " . getLatestTransactionRestriction("{$dc}_expression_ns")); |
51 | 53 | $expressionRecord = $dbr->fetchObject($queryResult); |
52 | | - $expression = new Expression($expressionId, $expressionRecord->spelling, $expressionRecord->language_id); |
53 | | - return $expression; |
| 54 | + if($expressionRecord) { |
| 55 | + $expression = new Expression($expressionId, $expressionRecord->spelling, $expressionRecord->language_id); |
| 56 | + return $expression; |
| 57 | + } else { |
| 58 | + return null; |
| 59 | + } |
54 | 60 | } |
55 | 61 | |
56 | 62 | function newObjectId($table) { |
— | — | @@ -1257,10 +1263,8 @@ |
1258 | 1264 | $map=getDataSetsAssociatedByConcept($dm, $dc); |
1259 | 1265 | $dm_map=getAssociatedByConcept($dm, $dc); |
1260 | 1266 | foreach ($map as $map_dc => $map_dataset) { |
1261 | | - $dmData=new DefinedMeaningData(); |
1262 | | - $dmData->setDataset($map_dataset); |
1263 | | - $dmData->setId($dm_map[$map_dc]); |
1264 | | - $meanings[$map_dc]=$dmData; |
| 1267 | + $dmModel=new DefinedMeaningModel($dm_map[$map_dc], null, $map_dataset); |
| 1268 | + $meanings[$map_dc]=$dmModel; |
1265 | 1269 | } |
1266 | 1270 | return $meanings; |
1267 | 1271 | } |
— | — | @@ -1278,8 +1282,10 @@ |
1279 | 1283 | return array($expression->expression_id, $expression->spelling, $expression->language_id); |
1280 | 1284 | } |
1281 | 1285 | |
1282 | | -function definingExpression($definedMeaningId) { |
1283 | | - $dc=wdGetDataSetContext(); |
| 1286 | +function definingExpression($definedMeaningId, $dc=null) { |
| 1287 | + if(is_null($dc)) { |
| 1288 | + $dc=wdGetDataSetContext(); |
| 1289 | + } |
1284 | 1290 | $dbr =& wfGetDB(DB_SLAVE); |
1285 | 1291 | $queryResult = $dbr->query("SELECT spelling " . |
1286 | 1292 | " FROM {$dc}_defined_meaning, {$dc}_expression_ns " . |
— | — | @@ -1288,7 +1294,11 @@ |
1289 | 1295 | " AND " . getLatestTransactionRestriction("{$dc}_defined_meaning"). |
1290 | 1296 | " AND " . getLatestTransactionRestriction("{$dc}_expression_ns")); |
1291 | 1297 | $expression = $dbr->fetchObject($queryResult); |
1292 | | - return $expression->spelling; |
| 1298 | + if($expression) { |
| 1299 | + return $expression->spelling; |
| 1300 | + } else { |
| 1301 | + return null; |
| 1302 | + } |
1293 | 1303 | } |
1294 | 1304 | |
1295 | 1305 | function definedMeaningExpressionForLanguage($definedMeaningId, $languageId) { |
— | — | @@ -1370,5 +1380,3 @@ |
1371 | 1381 | return $dbr->fetchObject($queryResult)->text_text; |
1372 | 1382 | } |
1373 | 1383 | |
1374 | | - |
1375 | | - |
Index: trunk/extensions/Wikidata/OmegaWiki/RecordSetQueries.php |
— | — | @@ -3,14 +3,14 @@ |
4 | 4 | require_once('Transaction.php'); |
5 | 5 | |
6 | 6 | function getTransactedSQL(QueryTransactionInformation $transactionInformation, array $selectFields, Table $table, array $restrictions, array $orderBy = array(), $count = -1, $offset = 0) { |
7 | | - $tableNames = array($table->identifier); |
| 7 | + $tableNames = array($table->getIdentifier()); |
8 | 8 | |
9 | 9 | if ($table->isVersioned) { |
10 | 10 | $restrictions[] = $transactionInformation->getRestriction($table); |
11 | 11 | $tableNames = array_merge($tableNames, $transactionInformation->getTables()); |
12 | 12 | $orderBy = array_merge($orderBy, $transactionInformation->versioningOrderBy()); |
13 | 13 | $groupBy = $transactionInformation->versioningGroupBy($table); |
14 | | - $selectFields = array_merge($selectFields, $transactionInformation->versioningFields($table->identifier)); |
| 14 | + $selectFields = array_merge($selectFields, $transactionInformation->versioningFields($table->getIdentifier())); |
15 | 15 | } |
16 | 16 | else |
17 | 17 | $groupBy = array(); |
Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php |
— | — | @@ -442,219 +442,4 @@ |
443 | 443 | return $this->getPrefix(); |
444 | 444 | } |
445 | 445 | |
446 | | -} |
447 | | - |
448 | | -/** |
449 | | - * A representation and easy access to all defined-meaning related data in one handy spot |
450 | | - * or would be. Currently only holds data that is really needed. Please expand and |
451 | | - * use to replace WiKiDataAPI. |
452 | | - * Sometimes a getter or setter will query the database and/or attempt to deduce additional |
453 | | - * information based on what it already knows, but don't count on that (yet). |
454 | | - */ |
455 | | - |
456 | | -class DefinedMeaningData { |
457 | | - private $languageId=null; # 85 = English, a pretty safe default. |
458 | | - private $languageCode=null; #the associated wikiId |
459 | | - private $spelling=null; |
460 | | - private $id=null; |
461 | | - private $dataset=null; |
462 | | - private $title=null; |
463 | | - |
464 | | - /** return spelling of associated expression in particular langauge |
465 | | - * not nescesarily the correct language. |
466 | | - */ |
467 | | - public function getSpelling() { |
468 | | - if ($this->spelling==null) { |
469 | | - |
470 | | - $id=$this->getId(); |
471 | | - if ($id==null) |
472 | | - return null; |
473 | | - |
474 | | - $languageCode=$this->getLanguageCode(); |
475 | | - if ($languageCode==null) |
476 | | - return null; # this should probably never happen |
477 | | - |
478 | | - $dataset=$this->getDataset(); |
479 | | - if ($dataset==null) |
480 | | - return null; |
481 | | - $this->spelling=getSpellingForLanguage($id, $languageCode, "en", $dataset); |
482 | | - } |
483 | | - return $this->spelling; |
484 | | - } |
485 | | - |
486 | | - public function makeLinkObj() { |
487 | | - global |
488 | | - $wgUser; |
489 | | - |
490 | | - $skin=$wgUser->getSkin(); |
491 | | - if ($skin==null) |
492 | | - return null; # This is a bit of a guess |
493 | | - |
494 | | - $title=$this->getTitle(); |
495 | | - if ($title==null) |
496 | | - return null; |
497 | | - |
498 | | - $dataset=$this->getDataset(); |
499 | | - if ($dataset==null) |
500 | | - return null; |
501 | | - |
502 | | - $prefix=$dataset->getPrefix(); |
503 | | - $name=$this->getSpelling(); |
504 | | - |
505 | | - $skin->makeLinkObj($title, $name , "dataset=$prefix"); |
506 | | - } |
507 | | - |
508 | | - /** returns the page title associated with this defined meaning (as a Title object) |
509 | | - * First time from db lookup. Subsequently from cache |
510 | | - */ |
511 | | - public function getTitle() { |
512 | | - $title=$this->title; |
513 | | - if ($title==null) { |
514 | | - $name=$this->getSpelling(); |
515 | | - $id=$this->getId(); |
516 | | - |
517 | | - if (is_null($name) or is_null($id)) |
518 | | - return null; |
519 | | - |
520 | | - $text="DefinedMeaning:".$name."_($id)"; |
521 | | - $title=Title::newFromText($text); |
522 | | - $this->title=$title; |
523 | | - } |
524 | | - return $title; |
525 | | - } |
526 | | - |
527 | | - /** set the title (and associated ID) from text representation |
528 | | - * This is partially copied from DefinedMeaning.getDefinedMeaningIdFromTitle |
529 | | - * which is slightly less usable (and hence should be deprecated) |
530 | | - * |
531 | | - * Also note the traditionally very weak error-checking, th$this->title=Title::newFromText($titleText); |
532 | | - $bracketPosition = strrpos($titleText, "("); |
533 | | - if ($bracketPosition==false) |
534 | | - return; # we accept that we may have a someis may need |
535 | | - * updating. Canonicalize helps a bit. |
536 | | - * |
537 | | - * Will gladly eat invalid titles (in which case object state |
538 | | - * may become somewhat undefined) |
539 | | - */ |
540 | | - public function setTitleText($titleText){ |
541 | | - // get id from title: DefinedMeaning:expression (id) |
542 | | - $this->title=Title::newFromText($titleText); |
543 | | - $bracketPosition = strrpos($titleText, "("); |
544 | | - if ($bracketPosition==false) |
545 | | - return; # Defined Meaning ID is missing from title string |
546 | | - $definedMeaningId = substr($titleText, $bracketPosition + 1, strlen($titleText) - $bracketPosition - 2); |
547 | | - $this->setId($definedMeaningId); |
548 | | - } |
549 | | - |
550 | | - /**set the title (and associated ID) from mediawiki Title object*/ |
551 | | - public function setTitle(&$title){ |
552 | | - $this->setTitleText($title->getFullText()); |
553 | | - } |
554 | | - |
555 | | - /**retturn full text representation of title*/ |
556 | | - public function getTitleText(){ |
557 | | - $title=$this->getTitle(); |
558 | | - return $title->getFullText(); |
559 | | - } |
560 | | - /** |
561 | | - * Look up defined meaning id in db, |
562 | | - * and attempt to get defined meaning into |
563 | | - * canonical form, with correct spelling, etc. |
564 | | - * |
565 | | - * use canonicalize anytime you take user input. |
566 | | - * note that the defined meaning must already |
567 | | - * be in the database for this to work. |
568 | | - * |
569 | | - * example(s): |
570 | | - * For any user supplied defined meaning, |
571 | | - * "traditionally" we have only looked at the part |
572 | | - * between parens. |
573 | | - * For instance, for |
574 | | - * DefinedMeaning:Jump (6684) |
575 | | - * |
576 | | - * We only really look at (6684), and discard the rest. |
577 | | - * This can lead to funny situations... |
578 | | - * |
579 | | - * If a user were to look for DefinedMeaning:YellowBus (6684) |
580 | | - * they would get a page back with that title, but with |
581 | | - * the contents of DefinedMeaning:Jump (6684)... very confusing! |
582 | | - * |
583 | | - * This kind of odd behaviour (and anything else we might come across later) |
584 | | - * gets corrected here. |
585 | | - * |
586 | | - * @return true on success (page (already) exists in db, title now updated); |
587 | | - * false on failure (page not (yet?) in db, or id was never set, |
588 | | - * or not enough info to perform lookup (need at least id or something with id in it: |
589 | | - * a horribly misformed title will work, as long as the id is correct :-P ) |
590 | | - */ |
591 | | - public function canonicalize(){ |
592 | | - $oldtitle=$this->title; |
593 | | - $oldspelling=$this->spelling; |
594 | | - |
595 | | - $this->title=null; # } clear cached values to force db fetch. |
596 | | - $this->spelling=null; # } |
597 | | - $this->title=$this->getTitle(); # will fetch from db! |
598 | | - |
599 | | - if ($this->title==null) { # db lookup failure |
600 | | - $this->title=$oldtitle; |
601 | | - $this->spelling=$oldspelling; |
602 | | - return false; |
603 | | - } |
604 | | - |
605 | | - return true; |
606 | | - } |
607 | | - |
608 | | - /** returns true if a database entry already exists for this dmid, and an expression is present in this langauge in this dataset, otherwise returns false. */ |
609 | | - public function exists() { |
610 | | - /*reusing getSpelling for now as a hack. Probably better |
611 | | - *to write a dedicated exists in WikiDataAPI, or here |
612 | | - */ |
613 | | - if ($this->getSpelling()!=null) |
614 | | - return true; |
615 | | - return false; |
616 | | - } |
617 | | - |
618 | | - /** sets id*/ |
619 | | - public function setId($id) { |
620 | | - $this->id=$id; |
621 | | - $this->canonicalize(); |
622 | | - } |
623 | | - |
624 | | - public function getId() { |
625 | | - return $this->id; |
626 | | - } |
627 | | - |
628 | | - public function setDataset(&$dataset) { |
629 | | - $this->dataset=$dataset; |
630 | | - } |
631 | | - |
632 | | - public function &getDataset() { |
633 | | - if ($this->dataset==null) { |
634 | | - $this->dataset=wdGetDataSetContext(); |
635 | | - } |
636 | | - return $this->dataset; |
637 | | - } |
638 | | - |
639 | | - public function setLanguageId($languageId) { |
640 | | - $this->languageId = $languageId; |
641 | | - } |
642 | | - |
643 | | - public function getLanguageId() { |
644 | | - return $this->languageId; |
645 | | - } |
646 | | - |
647 | | - public function setLanguageCode($languageCode) { |
648 | | - return $this->langaugeCode; |
649 | | - } |
650 | | - |
651 | | - public function getLanguageCode() { |
652 | | - if ($this->languageCode==null) { |
653 | | - global |
654 | | - $wgUser; |
655 | | - $this->languageCode=$wgUser->getOption('language'); |
656 | | - } |
657 | | - return $this->languageCode; |
658 | | - } |
659 | | -} |
660 | | - |
661 | | - |
| 446 | +} |
\ No newline at end of file |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiEditors.php |
— | — | @@ -491,7 +491,6 @@ |
492 | 492 | |
493 | 493 | $definedMeaningEditor->expandEditor($definitionEditor); |
494 | 494 | $definedMeaningEditor->expandEditor($synonymsAndTranslationsEditor); |
495 | | - |
496 | 495 | return $definedMeaningEditor; |
497 | 496 | } |
498 | 497 | |
Index: trunk/extensions/Wikidata/OmegaWiki/SpecialConceptMapping.php |
— | — | @@ -73,31 +73,32 @@ |
74 | 74 | $rq=$wgRequest->getText("set_".$key); |
75 | 75 | $noerror=$wgRequest->getText("suppressWarnings"); |
76 | 76 | $rq=trim($rq); |
77 | | - $dmData=new DefinedMeaningData(); |
78 | | - $dmData->setDataset($set); |
79 | | - $dmData->setTitleText($rq); #is $rq a page title? |
80 | | - if ($dmData->getId()==null) { #guess not |
81 | | - $dmData->setId($rq); # maybe it's a defined meaning id? |
82 | | - } |
83 | | - $dmData->canonicalize(); |
84 | | - $id=null; |
85 | | - $title=null; |
86 | | - if ($dmData->exists()) { |
87 | | - $id=$dmData->getId(); |
88 | | - $title=$dmData->getTitleText(); |
89 | | - } |
90 | | - if(!$noerror) { |
91 | | - $wgOut->addHTML("$key: $rq ($title)"); |
92 | | - } |
93 | | - if ($id!=null) { |
94 | | - $mappings[$key]=$id; |
95 | | - if(!$noerror) { |
96 | | - $wgOut->addHTML(' <span style="color:green">['.wfMsg('ow_OK').']</span>'); |
| 77 | + $dmInfo=DefinedMeaningModel::splitTitleText($rq); |
| 78 | + if(!$dmInfo["id"]) { |
| 79 | + $wgOut->addHTML(' <span style="color:yellow">['.wfMsg('ow_dm_not_present').']</span>'); |
| 80 | + } else { |
| 81 | + $dmModel=new DefinedMeaningModel($dmInfo["id"],null,$set); |
| 82 | + $dmModel->checkExistence(); |
| 83 | + if ($dmModel->exists()) { |
| 84 | + $id=$dmModel->getId(); |
| 85 | + $title=$dmModel->getTitleText(); |
| 86 | + } else { |
| 87 | + $id=null; |
| 88 | + $title=null; |
97 | 89 | } |
98 | | - } else { |
99 | 90 | if(!$noerror) { |
100 | | - $wgOut->addHTML(' <span style="color:red">['.wfMsg('ow_not_present_or_malformed').']</span>'); |
| 91 | + $wgOut->addHTML("$key: $rq ($title)"); |
101 | 92 | } |
| 93 | + if ($id!=null) { |
| 94 | + $mappings[$key]=$id; |
| 95 | + if(!$noerror) { |
| 96 | + $wgOut->addHTML(' <span style="color:green">['.wfMsg('ow_dm_OK').']</span>'); |
| 97 | + } |
| 98 | + } else { |
| 99 | + if(!$noerror) { |
| 100 | + $wgOut->addHTML(' <span style="color:red">['.wfMsg('ow_dm_not_found').']</span>'); |
| 101 | + } |
| 102 | + } |
102 | 103 | } |
103 | 104 | $wgOut->addHTML("<br>\n"); |
104 | 105 | } |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php |
— | — | @@ -621,7 +621,6 @@ |
622 | 622 | |
623 | 623 | $dc=wdGetDataSetContext(); |
624 | 624 | $restrictions = array("defined_meaning_id=$definedMeaningId"); |
625 | | - |
626 | 625 | if ($viewInformation->filterLanguageId != 0) |
627 | 626 | $restrictions[] = |
628 | 627 | "expression_id IN (" . |
— | — | @@ -649,7 +648,6 @@ |
650 | 649 | expandExpressionReferencesInRecordSet($recordSet, array($expressionAttribute)); |
651 | 650 | else |
652 | 651 | expandExpressionSpellingsInRecordSet($recordSet, array($expressionAttribute)); |
653 | | - |
654 | 652 | //add object attributes attribute to the generated structure |
655 | 653 | //and expand the records |
656 | 654 | $recordSet->getStructure()->addAttribute($objectAttributesAttribute); |