[MediaWiki-CVS] SVN: [49213] trunk/extensions/SemanticMediaWiki
Revision: 49213 Author: mkroetzsch Date: 2009-04-05 15:25:36 + (Sun, 05 Apr 2009) Log Message: --- Updated mechanims for selecting result printers; selected printer no longer depending on eventual query result: a new printer for format="auto" makes this choice later if needed Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php Added Paths: --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2009-04-05 15:01:25 UTC (rev 49212) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2009-04-05 15:25:36 UTC (rev 49213) @@ -117,6 +117,7 @@ $wgAutoloadClasses['SMWConceptPage']= $smwgIP . '/includes/articlepages/SMW_ConceptPage.php'; printers $wgAutoloadClasses['SMWResultPrinter'] = $smwgIP . '/includes/SMW_QueryPrinter.php'; + $wgAutoloadClasses['SMWAutoResultPrinter'] = $smwgIP . '/includes/SMW_QP_Auto.php'; $wgAutoloadClasses['SMWTableResultPrinter'] = $smwgIP . '/includes/SMW_QP_Table.php'; $wgAutoloadClasses['SMWListResultPrinter'] = $smwgIP . '/includes/SMW_QP_List.php'; $wgAutoloadClasses['SMWEmbeddedResultPrinter'] = $smwgIP . '/includes/SMW_QP_Embedded.php'; Added: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php (rev 0) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php 2009-04-05 15:25:36 UTC (rev 49213) @@ -0,0 +1,33 @@ +getColumnCount()>1) && ($results->getColumnCount()>0) ) { + $format = 'table'; + } else { + $format = 'list'; + } + $printer = SMWQueryProcessor::getResultPrinter($format, ($this->mInline?SMWQueryProcessor::INLINE_QUERY:SMWQueryProcessor::SPECIAL_PAGE)); + return $printer->getResult($results, $params, $outputmode); + } + + protected function getResultText($res, $outputmode) { + return ''; // acutally not needed in this implementation + } + +} \ No newline at end of file Property changes on: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php ___ Added: svn:eol-style + native Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php 2009-04-05 15:01:25 UTC (rev 49212) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php 2009-04-05 15:25:36 UTC (rev 49213) @@ -31,6 +31,10 @@ return 'result.csv'; } + public function getQueryMode($context) { + return ($context==SMWQueryProcessor::SPECIAL_PAGE)?SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE; + } + protected function getResultText($res, $outputmode) { $result = ''; if ($outputmode == SMW_OUTPUT_FILE) { // make CSV file Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php 2009-04-05 15:01:25 UTC (rev 49212) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php 2009-04-05 15:25:36 UTC (rev 49213) @@ -26,6 +26,10 @@ } } + public function getQueryMode($context) { + return ($context==SMWQueryProcessor::SPECIAL_PAGE)?SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE; + } + protected function getResultText($res, $outputmode) { global $smwgIQRunningNumber, $wgSitename, $wgServer, $wgScriptPath; $result = ''; Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSl
[MediaWiki-CVS] SVN: [49214] trunk/extensions/SemanticResultFormats
Revision: 49214 Author: mkroetzsch Date: 2009-04-05 15:26:06 + (Sun, 05 Apr 2009) Log Message: --- implemented new method for signaling query mode Modified Paths: -- trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php trunk/extensions/SemanticResultFormats/vCard/SRF_vCard.php Modified: trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php === --- trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php 2009-04-05 15:25:36 UTC (rev 49213) +++ trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php 2009-04-05 15:26:06 UTC (rev 49214) @@ -43,6 +43,10 @@ } } + public function getQueryMode($context) { + return ($context==SMWQueryProcessor::SPECIAL_PAGE)?SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE; + } + protected function getResultText($res, $outputmode) { global $smwgIQRunningNumber, $wgSitename, $wgServer, $wgRequest; $result = ''; Modified: trunk/extensions/SemanticResultFormats/vCard/SRF_vCard.php === --- trunk/extensions/SemanticResultFormats/vCard/SRF_vCard.php 2009-04-05 15:25:36 UTC (rev 49213) +++ trunk/extensions/SemanticResultFormats/vCard/SRF_vCard.php 2009-04-05 15:26:06 UTC (rev 49214) @@ -28,6 +28,10 @@ } } + public function getQueryMode($context) { + return ($context==SMWQueryProcessor::SPECIAL_PAGE)?SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE; + } + protected function getResultText($res, $outputmode) { global $smwgIQRunningNumber, $wgSitename, $wgServer, $wgRequest; $result = ''; ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [49215] trunk/extensions/SemanticMediaWiki
Revision: 49215 Author: mkroetzsch Date: 2009-04-05 16:05:35 + (Sun, 05 Apr 2009) Log Message: --- Enable localized names for result formats to improve format selection in Special_Ask Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Embedded.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Table.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Template.php trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php 2009-04-05 15:26:06 UTC (rev 49214) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php 2009-04-05 16:05:35 UTC (rev 49215) @@ -30,4 +30,9 @@ return ''; // acutally not needed in this implementation } + public function getName() { + wfLoadExtensionMessages('SemanticMediaWiki'); + return wfMsgForContent('smw_printername_auto'); + } + } \ No newline at end of file Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php 2009-04-05 15:26:06 UTC (rev 49214) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php 2009-04-05 16:05:35 UTC (rev 49215) @@ -35,6 +35,11 @@ return ($context==SMWQueryProcessor::SPECIAL_PAGE)?SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE; } + public function getName() { + wfLoadExtensionMessages('SemanticMediaWiki'); + return wfMsgForContent('smw_printername_csv'); + } + protected function getResultText($res, $outputmode) { $result = ''; if ($outputmode == SMW_OUTPUT_FILE) { // make CSV file Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Embedded.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Embedded.php 2009-04-05 15:26:06 UTC (rev 49214) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Embedded.php 2009-04-05 16:05:35 UTC (rev 49215) @@ -36,6 +36,11 @@ } } + public function getName() { + wfLoadExtensionMessages('SemanticMediaWiki'); + return wfMsgForContent('smw_printername_embedded'); + } + protected function getResultText($res,$outputmode) { global $wgParser; // No page should embed itself, find out who we are: Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php 2009-04-05 15:26:06 UTC (rev 49214) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php 2009-04-05 16:05:35 UTC (rev 49215) @@ -30,6 +30,11 @@ return ($context==SMWQueryProcessor::SPECIAL_PAGE)?SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE; } + public function getName() { + wfLoadExtensionMessages('SemanticMediaWiki'); + return wfMsgForContent('smw_printername_json'); + } + protected function getResultText($res, $outputmode) { global $smwgIQRunningNumber, $wgSitename, $wgServer, $wgScriptPath; $result = ''; Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php 2009-04-05 15:26:06 UTC (rev 49214) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php 2009-04-05 16:05:35 UTC (rev 49215) @@ -36,6 +36,10 @@ } } + public function getName() { + wfLoadExtensionMessages('SemanticMediaWiki'); + return wfMsgForContent('smw_printername_' . $this->mFormat); + } protected function getResultText($res,$outputmode) { // Determine mark-up strings used around list items: Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php ===
[MediaWiki-CVS] SVN: [49216] trunk/extensions/SemanticMediaWiki/includes
Revision: 49216 Author: mkroetzsch Date: 2009-04-05 16:08:15 + (Sun, 05 Apr 2009) Log Message: --- use wfMsg (not "for content") Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Embedded.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Table.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Template.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php 2009-04-05 16:05:35 UTC (rev 49215) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php 2009-04-05 16:08:15 UTC (rev 49216) @@ -32,7 +32,7 @@ public function getName() { wfLoadExtensionMessages('SemanticMediaWiki'); - return wfMsgForContent('smw_printername_auto'); + return wfMsg('smw_printername_auto'); } } \ No newline at end of file Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php 2009-04-05 16:05:35 UTC (rev 49215) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php 2009-04-05 16:08:15 UTC (rev 49216) @@ -37,7 +37,7 @@ public function getName() { wfLoadExtensionMessages('SemanticMediaWiki'); - return wfMsgForContent('smw_printername_csv'); + return wfMsg('smw_printername_csv'); } protected function getResultText($res, $outputmode) { Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Embedded.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Embedded.php 2009-04-05 16:05:35 UTC (rev 49215) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Embedded.php 2009-04-05 16:08:15 UTC (rev 49216) @@ -38,7 +38,7 @@ public function getName() { wfLoadExtensionMessages('SemanticMediaWiki'); - return wfMsgForContent('smw_printername_embedded'); + return wfMsg('smw_printername_embedded'); } protected function getResultText($res,$outputmode) { Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php 2009-04-05 16:05:35 UTC (rev 49215) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php 2009-04-05 16:08:15 UTC (rev 49216) @@ -32,7 +32,7 @@ public function getName() { wfLoadExtensionMessages('SemanticMediaWiki'); - return wfMsgForContent('smw_printername_json'); + return wfMsg('smw_printername_json'); } protected function getResultText($res, $outputmode) { Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php 2009-04-05 16:05:35 UTC (rev 49215) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php 2009-04-05 16:08:15 UTC (rev 49216) @@ -38,7 +38,7 @@ public function getName() { wfLoadExtensionMessages('SemanticMediaWiki'); - return wfMsgForContent('smw_printername_' . $this->mFormat); + return wfMsg('smw_printername_' . $this->mFormat); } protected function getResultText($res,$outputmode) { Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php 2009-04-05 16:05:35 UTC (rev 49215) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php 2009-04-05 16:08:15 UTC (rev 49216) @@ -42,7 +42,7 @@ public function getName() { wfLoadExtensionMessages('SemanticMediaWiki'); - return wfMsgForContent('smw_printername_rss'); + return wfMsg('smw_printername_rss'); } protected function getResultText($res, $outputmode) { Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Table.php =
[MediaWiki-CVS] SVN: [49217] trunk/extensions/SemanticResultFormats
Revision: 49217 Author: mkroetzsch Date: 2009-04-05 16:14:49 + (Sun, 05 Apr 2009) Log Message: --- added translations for some of the format names Modified Paths: -- trunk/extensions/SemanticResultFormats/BibTeX/SRF_BibTeX.php trunk/extensions/SemanticResultFormats/SRF_Messages.php trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php trunk/extensions/SemanticResultFormats/vCard/SRF_vCard.php Modified: trunk/extensions/SemanticResultFormats/BibTeX/SRF_BibTeX.php === --- trunk/extensions/SemanticResultFormats/BibTeX/SRF_BibTeX.php 2009-04-05 16:08:15 UTC (rev 49216) +++ trunk/extensions/SemanticResultFormats/BibTeX/SRF_BibTeX.php 2009-04-05 16:14:49 UTC (rev 49217) @@ -45,6 +45,15 @@ } } + public function getQueryMode($context) { + return ($context==SMWQueryProcessor::SPECIAL_PAGE)?SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE; + } + + public function getName() { + wfLoadExtensionMessages('SemanticResultFormats'); + return wfMsg('srf_printername_bibtex'); + } + protected function getResultText($res, $outputmode) { global $smwgIQRunningNumber, $wgSitename, $wgServer, $wgRequest; $result = ''; @@ -276,7 +285,7 @@ foreach ($items as $item) { $result .= $item->text(); } - } else { // just make link to vcard + } else { // just make link to export if ($this->getSearchLabel($outputmode)) { $label = $this->getSearchLabel($outputmode); } else { @@ -460,5 +469,5 @@ unpublished A document having an author and title, but not formally published. Required fields: author, title, note - Optional fields: month, year, key + Optional fields: month, year, key */ Modified: trunk/extensions/SemanticResultFormats/SRF_Messages.php === --- trunk/extensions/SemanticResultFormats/SRF_Messages.php 2009-04-05 16:08:15 UTC (rev 49216) +++ trunk/extensions/SemanticResultFormats/SRF_Messages.php 2009-04-05 16:14:49 UTC (rev 49217) @@ -18,10 +18,16 @@ 'srfc_gotomonth' => 'Go to month', // format "vCard" 'srf_vcard_link' => 'vCard', + 'srf_printername_vcard' => 'vCard export', // format "iCalendar" 'srf_icalendar_link' => 'iCalendar', + 'srf_printername_icalendar' => 'iCalendar export', // format "BibTeX" 'srf_bibtex_link'=> 'BibTeX', + 'srf_printername_bibtex' => 'BibTeX export', + // format "timeline" + 'srf_printername_timeline' => 'Timeline', + 'srf_printername_eventline' => 'Eventline', ); /** Message documentation (Message documentation) Modified: trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php === --- trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php 2009-04-05 16:08:15 UTC (rev 49216) +++ trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php 2009-04-05 16:14:49 UTC (rev 49217) @@ -47,6 +47,11 @@ } } + public function getName() { + wfLoadExtensionMessages('SemanticResultFormats'); + return wfMsg('srf_printername_' . $this->mFormat); + } + protected function getResultText($res, $outputmode) { global $smwgIQRunningNumber, $wgScriptPath; SMWOutputs::requireHeadItem(SMW_HEADER_STYLE); Modified: trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php === --- trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php 2009-04-05 16:08:15 UTC (rev 49216) +++ trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php 2009-04-05 16:14:49 UTC (rev 49217) @@ -47,6 +47,11 @@ return ($context==SMWQueryProcessor::SPECIAL_PAGE)?SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE; } + public function getName() { + wfLoadExtensionMessages('SemanticResultFormats'); + return wfMsg('srf_printername_icalendar'); + } + protected function getResultText($res, $outputmode) { global $smwgIQRunningNumb
[MediaWiki-CVS] SVN: [50165] trunk/extensions/SemanticMediaWiki/INSTALL
Revision: 50165 Author: mkroetzsch Date: 2009-05-04 08:57:58 + (Mon, 04 May 2009) Log Message: --- fixed documentation Modified Paths: -- trunk/extensions/SemanticMediaWiki/INSTALL Modified: trunk/extensions/SemanticMediaWiki/INSTALL === --- trunk/extensions/SemanticMediaWiki/INSTALL 2009-05-04 08:57:33 UTC (rev 50164) +++ trunk/extensions/SemanticMediaWiki/INSTALL 2009-05-04 08:57:58 UTC (rev 50165) @@ -107,9 +107,8 @@ If you are uncertain that everything went well, you can do some testing steps to check if SMW is set up properly. -Go to the Special:Version page and you should see Semantic MediaWiki (version -nn) listed as a Parser Hook and several wfSMWXxxx functions listed as -Extension Functions. +Go to the Special:Version page. You should see Semantic MediaWiki (version nn) +listed as a Parser Hook there. Create a regular wiki page named "TestSMW", and in it enter the wiki text Property test: [[testproperty::Dummypage]] ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [51647] trunk/extensions/SemanticMediaWiki/includes
Revision: 51647 Author: mkroetzsch Date: 2009-06-09 16:06:23 + (Tue, 09 Jun 2009) Log Message: --- Better fix for problem with empty URIs for imported vocabulary (unstubbing needs to happen when get- methods are called) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Import.php trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Import.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Import.php 2009-06-09 15:59:21 UTC (rev 51646) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Import.php 2009-06-09 16:06:23 UTC (rev 51647) @@ -127,10 +127,12 @@ } public function getShortWikiText($linked = NULL) { + $this->unstub(); return $this->m_caption; } public function getShortHTMLText($linker = NULL) { + $this->unstub(); return htmlspecialchars($this->m_value); } @@ -151,22 +153,27 @@ } public function getDBkeys() { + $this->unstub(); return array($this->m_namespace . ' ' . $this->m_section . ' ' . $this->m_uri); } public function getWikiValue(){ + $this->unstub(); return $this->m_value; } public function getNS(){ + $this->unstub(); return $this->m_uri; } public function getNSID(){ + $this->unstub(); return $this->m_namespace; } public function getLocalName(){ + $this->unstub(); return $this->m_section; } } Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php 2009-06-09 15:59:21 UTC (rev 51646) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php 2009-06-09 16:06:23 UTC (rev 51647) @@ -86,8 +86,6 @@ $dv = SMWDataValueFactory::newPropertyObjectValue($property); $dv->setDBkeys($dbkeys); - $dv->isValid(); - if ($this->m_noduplicates) { $this->propvals[$property->getDBkey()][$dv->getHash()] = $dv; } else { ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [52507] trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php
Revision: 52507 Author: mkroetzsch Date: 2009-06-28 13:18:24 + (Sun, 28 Jun 2009) Log Message: --- do a type check for avoiding surprises if trying to create RSS for queries that do not return wiki pages Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php 2009-06-28 13:14:53 UTC (rev 52506) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php 2009-06-28 13:18:24 UTC (rev 52507) @@ -80,7 +80,10 @@ } } } - $items[] = new SMWRSSItem($wikipage->getTitle(), $creators, $dates); + if ($wikipage instanceof SMWWikiPageValue) { // this should rarely fail, but better be carful + ///TODO: It would be more elegant to have type chekcs initially + $items[] = new SMWRSSItem($wikipage->getTitle(), $creators, $dates); + } $row = $res->getNext(); } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [52604] trunk/extensions/SemanticMediaWiki/specials/Export/ SMW_SpecialOWLExport.php
Revision: 52604 Author: mkroetzsch Date: 2009-06-30 16:26:47 + (Tue, 30 Jun 2009) Log Message: --- use URIs for exported ontologies, avoid indentity confusion in linked data exports Modified Paths: -- trunk/extensions/SemanticMediaWiki/specials/Export/SMW_SpecialOWLExport.php Modified: trunk/extensions/SemanticMediaWiki/specials/Export/SMW_SpecialOWLExport.php === --- trunk/extensions/SemanticMediaWiki/specials/Export/SMW_SpecialOWLExport.php 2009-06-30 16:07:29 UTC (rev 52603) +++ trunk/extensions/SemanticMediaWiki/specials/Export/SMW_SpecialOWLExport.php 2009-06-30 16:26:47 UTC (rev 52604) @@ -253,7 +253,12 @@ $this->delay_flush = 10; //flush only after (fully) printing 11 objects $this->extra_namespaces = array(); - $this->printHeader(); // also inits global namespaces + if (count($pages) == 1) { // ensure that ontologies that are retrieved as linked data are not confused with their subject! + $ontologyuri=SMWExporter::expandURI('&export;') . '/' . urlencode(end($pages)); + } else { // use empty URI, i.e. "location" as URI otherwise + $ontologyuri=''; + } + $this->printHeader($ontologyuri); // also inits global namespaces wfProfileIn("RDF::PrintPages::PrepareQueue"); // transform pages into queued export titles @@ -286,20 +291,20 @@ } // for pages not processed recursively, print at least basic declarations - wfProfileIn("RDF::PrintPages::Auxilliary"); + wfProfileIn("RDF::PrintPages::Auxiliary"); $this->date = ''; // no date restriction for the rest! if (!empty($this->element_queue)) { if ( '' != $this->pre_ns_buffer ) { - $this->post_ns_buffer .= "\t\n"; + $this->post_ns_buffer .= "\t\n"; } else { - print "\t\n"; // just print this comment, so that later outputs still find the empty pre_ns_buffer! + print "\t\n"; // just print this comment, so that later outputs still find the empty pre_ns_buffer! } while (!empty($this->element_queue)) { $st = array_pop($this->element_queue); $this->printObject($st,false,false); } } - wfProfileOut("RDF::PrintPages::Auxilliary"); + wfProfileOut("RDF::PrintPages::Auxiliary"); $this->printFooter(); $this->flushBuffers(true); wfProfileOut("RDF::PrintPages"); @@ -535,7 +540,7 @@ /* Functions for exporting RDF */ - protected function printHeader() { + protected function printHeader($ontologyuri = '') { global $wgContLang; $this->pre_ns_buffer .= @@ -561,7 +566,7 @@ $this->post_ns_buffer .= ">\n\t\n" . - "\t\n" . + "\t\n" . "\t\thttp://www.w3.org/2001/XMLSchema#dateTime\";>" . date(DATE_W3C) . "\n" . "\t\thttp://semantic-mediawiki.org/swivt/1.0\"; />\n" . "\t\n" . ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [52702] trunk/extensions/SemanticMediaWiki/languages
Revision: 52702 Author: mkroetzsch Date: 2009-07-02 16:42:41 + (Thu, 02 Jul 2009) Log Message: --- updated translations by Lukasz Bolikowski Modified Paths: -- trunk/extensions/SemanticMediaWiki/languages/SMW_Aliases.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePl.php Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_Aliases.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_Aliases.php 2009-07-02 16:24:11 UTC (rev 52701) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_Aliases.php 2009-07-02 16:42:41 UTC (rev 52702) @@ -311,6 +311,22 @@ 'WantedProperties' => array( 'Proprietats demandadas', 'ProprietatsDemandadas' ), ); +/** Polish (Polski) */ +$aliases['en'] = array( + 'Ask' => array( 'Pytanie' ), + 'Browse' => array( 'Przegląd' ), + 'ExportRDF' => array( 'EksportRDF' ), + 'PageProperty' => array( 'WłasnośćStrony' ), + 'Properties' => array( 'Własności' ), + 'SMWAdmin' => array( 'AdminSMW' ), + 'SearchByProperty' => array( 'SzukanieWgWłasności' ), + 'SemanticStatistics' => array( 'StatystykiSemantyczne' ), + 'Types' => array( 'Typy' ), + 'URIResolver' => array( 'ResolverURI' ), + 'UnusedProperties' => array( 'NieużywaneWłasności' ), + 'WantedProperties' => array( 'PotrzebneWłasności' ), +); + /** Pashto (پښتو) */ $aliases['ps'] = array( 'Ask' => array( 'پوښتل' ), Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePl.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePl.php 2009-07-02 16:24:11 UTC (rev 52701) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePl.php 2009-07-02 16:42:41 UTC (rev 52702) @@ -35,33 +35,37 @@ * on this site = w tym miejscu * * @author Łukasz Bolikowski - * @version 0.2 + * @version 0.3 * @ingroup SMWLanguage * @ingroup Language */ class SMWLanguagePl extends SMWLanguage { protected $m_DatatypeLabels = array( - '_wpg' => 'Page', // name of page datatype //TODO translate + '_wpg' => 'Strona', // name of page datatype '_str' => 'Łańcuch znaków', // name of the string type - '_txt' => 'Text', // name of the text type (very long strings) //TODO: translate - '_cod' => 'Code', // name of the (source) code type //TODO: translate + '_txt' => 'Tekst', // name of the text type (very long strings) + '_cod' => 'Kod', // name of the (source) code type '_boo' => 'Wartość logiczna', // name of the boolean type - '_num' => 'Liczba', // name for the datatype of numbers // TODO: check translation (done by pattern matching. mak) + '_num' => 'Liczba', // name for the datatype of numbers '_geo' => 'Współrzędne geograficzne', // name of the geocoord type '_tem' => 'Temperatura', // name of the temperature type '_dat' => 'Data', // name of the datetime (calendar) type '_ema' => 'Email', // name of the email type '_uri' => 'URL', // name of the URL type - '_anu' => 'Annotation URI' // name of the annotation URI type (OWL annotation property) //TODO: translate + '_anu' => 'URI adnotacji' // name of the annotation URI type (OWL annotation property) ); protected $m_DatatypeAliases = array( 'URI' => '_uri', + 'Liczba zmiennoprzecinkowa' => '_num', 'Liczba całkowita' => '_num', - 'Liczba zmiennoprzecinkowa' => '_num', 'Wyliczenie'=> '_str', // support English aliases: + 'URI' => '_uri', + 'Float' => '_num', + 'Integer' => '_num', + 'Enumeration' => '_str', 'Page' => '_wpg', 'String'
[MediaWiki-CVS] SVN: [52786] trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter. php
Revision: 52786 Author: mkroetzsch Date: 2009-07-06 07:49:11 + (Mon, 06 Jul 2009) Log Message: --- fixed Bug 18910 Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php 2009-07-06 01:43:34 UTC (rev 52785) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php 2009-07-06 07:49:11 UTC (rev 52786) @@ -213,7 +213,7 @@ $this->mSearchlabel = $params['searchlabel']; } if (array_key_exists('link', $params)) { - switch (strtolower($params['link'])) { + switch (strtolower(trim($params['link']))) { case 'head': case 'subject': $this->mLinkFirst = true; $this->mLinkOthers = false; ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [52787] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage. php
Revision: 52787 Author: mkroetzsch Date: 2009-07-06 08:14:37 + (Mon, 06 Jul 2009) Log Message: --- Catch cases where MW title generation fails to avoid Bug 18323 Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php 2009-07-06 07:49:11 UTC (rev 52786) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php 2009-07-06 08:14:37 UTC (rev 52787) @@ -136,6 +136,7 @@ public function getShortHTMLText($linker = NULL) { $this->unstub(); + if ( ($linker !== NULL) && ($this->m_caption !== '') ) { $this->getTitle(); } // init the Title object, may reveal hitherto unnoticed errors if ( ($linker === NULL) || (!$this->isValid()) || ($this->m_caption === '') ) { return htmlspecialchars($this->getCaption()); } else { @@ -168,6 +169,7 @@ public function getLongHTMLText($linker = NULL) { $this->unstub(); + if ($linker !== NULL) { $this->getTitle(); } // init the Title object, may reveal hitherto unnoticed errors if (!$this->isValid()) { return $this->getErrorText(); } @@ -245,10 +247,15 @@ /** * Return according Title object or NULL if no valid value was set. +* NULL can be returned even if this object returns TRUE for isValue(), +* since the latter function does not check whether MediaWiki can really +* make a Title out of the given data. +* However, isValid() will return FALSE *after* this function failed in +* trying to create a title. */ public function getTitle() { $this->unstub(); - if ($this->m_title === NULL) { + if ( ($this->isValid()) && ($this->m_title === NULL) ) { if ($this->m_interwiki == '') { $this->m_title = Title::makeTitle($this->m_namespace, $this->m_dbkeyform); } else { // interwiki title objects must be built from full input texts ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [52788] trunk/extensions/SemanticMediaWiki
Revision: 52788 Author: mkroetzsch Date: 2009-07-06 08:31:19 + (Mon, 06 Jul 2009) Log Message: --- fixed Bug 19128 Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_OrderedListPage.php trunk/extensions/SemanticMediaWiki/skins/SMW_custom.css Modified: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_OrderedListPage.php === --- trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_OrderedListPage.php 2009-07-06 08:14:37 UTC (rev 52787) +++ trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_OrderedListPage.php 2009-07-06 08:31:19 UTC (rev 52788) @@ -76,7 +76,7 @@ global $wgOut; $this->clearPageState(); $this->doQuery(); - $r = "\n" . $this->getPages(); + $r = "\n" . $this->getPages(); return $r; } @@ -94,7 +94,7 @@ protected abstract function doQuery(); /** -* Generates the headline for the page list and the HTML encoded list of pages which +* Generates the headline for the page list and the HTML encoded list of pages which * shall be shown. */ protected abstract function getPages(); @@ -106,7 +106,7 @@ global $wgUser, $wgLang; $sk = $this->getSkin(); $limitText = $wgLang->formatNum( $this->limit ); - + $ac = count($this->articles); if ($this->until != '') { if ($ac > $this->limit) { // (we assume that limit is at least 1) Modified: trunk/extensions/SemanticMediaWiki/skins/SMW_custom.css === --- trunk/extensions/SemanticMediaWiki/skins/SMW_custom.css 2009-07-06 08:14:37 UTC (rev 52787) +++ trunk/extensions/SemanticMediaWiki/skins/SMW_custom.css 2009-07-06 08:31:19 UTC (rev 52788) @@ -16,6 +16,10 @@ margin-top: 0.5em; } +#smwfootbr { /* terminate page contents when inserting stuff below a page, typically used in */ + clear: both; +} + /* tables for inline queries */ table.smwtable{ ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [52789] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php
Revision: 52789 Author: mkroetzsch Date: 2009-07-06 08:51:41 + (Mon, 06 Jul 2009) Log Message: --- catch upgrade problems with email, beautify output (Bug 18547) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php 2009-07-06 08:31:19 UTC (rev 52788) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php 2009-07-06 08:51:41 UTC (rev 52789) @@ -133,6 +133,11 @@ $this->m_caption = $this->m_value; if ($this->m_mode == SMW_URI_MODE_EMAIL) { $this->m_url = $this->m_value; + if (strpos($this->m_value,'mailto:') === 0) { // this check is just to be wary + $this->m_caption = substr($this->m_value, 7); + } else { // this case is only for backwards compatibility/repair; may vanish at some point + $this->m_url = 'mailto:' . $this->m_value; + } } else { $parts = explode(':', $this->m_value, 2); // try to split "schema:rest" global $wgUrlProtocols; ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [53813] trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink. php
Revision: 53813 Author: mkroetzsch Date: 2009-07-27 16:25:28 + (Mon, 27 Jul 2009) Log Message: --- include category information in JSON Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php 2009-07-27 15:24:14 UTC (rev 53812) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php 2009-07-27 16:25:28 UTC (rev 53813) @@ -68,6 +68,7 @@ $prefixedtext = $value->getPrefixedText(); } $valuestack[] = 'label: "'.$values.'"'; + $label = $values; } else { $values = array(); $finalvalues = ''; @@ -98,6 +99,21 @@ $count++; } $valuestack[] = '"uri" : "'.$wgServer.$wgScriptPath.'/index.php?title='.$prefixedtext.'"'; + + //try to determine type/category + $catlist = array(); + $dbr = &wfGetDB(DB_SLAVE); + $cl = $dbr->tableName('categorylinks'); + $arttitle = Title::newFromText($label); + if($arttitle instanceof Title){ + $catid = $arttitle->getArticleID(); + $catres = $dbr->select($cl, 'cl_to', "cl_from = $catid", __METHOD__, array('ORDER BY' => 'cl_sortkey')); + while ($catrow = $dbr->fetchRow($catres)) $catlist[] = $catrow[0]; + $dbr->freeResult($catres); + if(sizeof($catlist) > 0) $valuestack[] = '"type" : "'.$catlist[0].'"'; + } + + //create property list of item $itemstack[] = "\t{\n\t\t\t".implode(",\n\t\t\t",$valuestack)."\n\t\t}"; $row = $res->getNext(); } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [53932] trunk/extensions/SemanticMediaWiki/includes/storage/ SMW_SQLStore2.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/53932 Revision: 53932 Author: mkroetzsch Date: 2009-07-29 13:14:08 + (Wed, 29 Jul 2009) Log Message: --- use property to determine datatype whenever possible (do not rely on datavalue object) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php === --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2009-07-29 12:54:25 UTC (rev 53931) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2009-07-29 13:14:08 UTC (rev 53932) @@ -487,7 +487,7 @@ // redirects work differently. $table = ''; $sql = 'p_id=' . $db->addQuotes($pid); - $typeid = ($value === NULL)?$property->getPropertyTypeID():$value->getTypeID(); + $typeid = $property->getPropertyTypeID(); $mode = SMWSQLStore2::getStorageMode($typeid); switch ($mode) { @@ -703,9 +703,10 @@ foreach($data->getProperties() as $property) { $propertyValueArray = $data->getPropertyValues($property); + $mode = SMWSQLStore2::getStorageMode($property->getPropertyTypeID()); foreach($propertyValueArray as $value) { if (!$value->isValid()) continue; - switch (SMWSQLStore2::getStorageMode($value->getTypeID())) { + switch ($mode) { case SMW_SQL2_REDI2: break; // handled above case SMW_SQL2_INST2: $up_inst2[] = array( ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [53933] trunk/extensions/SemanticMediaWiki/includes/articlepages/ SMW_PropertyPage.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/53933 Revision: 53933 Author: mkroetzsch Date: 2009-07-29 13:15:12 + (Wed, 29 Jul 2009) Log Message: --- typo Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php Modified: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php === --- trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php 2009-07-29 13:14:08 UTC (rev 53932) +++ trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php 2009-07-29 13:15:12 UTC (rev 53933) @@ -10,7 +10,7 @@ /** * Implementation of MediaWiki's Article that shows additional information on - * property pages. Very simliar to CategoryPage, but with different printout + * property pages. Very similar to CategoryPage, but with different printout * that also displays values for each subject with the given property. * @ingroup SMW */ ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [53977] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/53977 Revision: 53977 Author: mkroetzsch Date: 2009-07-29 22:17:47 + (Wed, 29 Jul 2009) Log Message: --- nicer display for emails (Bug 18321) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php 2009-07-29 22:17:15 UTC (rev 53976) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php 2009-07-29 22:17:47 UTC (rev 53977) @@ -19,9 +19,13 @@ */ class SMWURIValue extends SMWDataValue { + /// Value; usually a human readable version of the URI (esp. "mailto:"; might be ommitted) private $m_value = ''; + /// Only set if a link should be created in the wiki. private $m_url = ''; + /// Canonical URI for identifying the object private $m_uri = ''; + /// Distinguish different modes (emails, URL, ...) private $m_mode = ''; public function SMWURIValue($typeid) { @@ -43,7 +47,11 @@ wfLoadExtensionMessages('SemanticMediaWiki'); $value = trim($value); $this->m_url = ''; - $this->m_value = ''; + $this->m_uri = ''; + $this->m_value = $value; + if ($this->m_caption === false) { + $this->m_caption = $this->m_value; + } if ($value!='') { //do not accept empty strings switch ($this->m_mode) { case SMW_URI_MODE_URI: case SMW_URI_MODE_ANNOURI: @@ -107,6 +115,10 @@ } break; case SMW_URI_MODE_EMAIL: + if (strpos($value,'mailto:') === 0) { // accept optional "mailto" + $value = substr($value, 7); + $this->m_value = $value; + } $check = "#^([_a-zA-Z0-9-]+)((\.[_a-zA-Z0-9-]+)*)@([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*)\.([a-zA-Z]{2,6})$#u"; if (!preg_match($check, $value)) { ///TODO: introduce error-message for "bad" email @@ -116,35 +128,33 @@ $this->m_url = 'mailto:' . str_replace(array('%3A','%2F','%23','%40','%3F','%3D','%26','%25'), array(':','/','#','@','?','=','&','%'),rawurlencode($value)); $this->m_uri = $this->m_url; } - $this->m_value = $this->m_uri; } else { $this->addError(wfMsgForContent('smw_emptystring')); } - if ($this->m_caption === false) { - $this->m_caption = $this->m_value; - } return true; } protected function parseDBkeys($args) { - $this->m_value = $args[0]; - $this->m_uri = $this->m_value; + $this->m_uri = $args[0]; + $this->m_value = $this->m_uri; $this->m_caption = $this->m_value; if ($this->m_mode == SMW_URI_MODE_EMAIL) { $this->m_url = $this->m_value; - if (strpos($this->m_value,'mailto:') === 0) { // this check is just to be wary + if (strpos($this->m_uri,'mailto:') === 0) { // catch inconsistencies in DB, should usually be the case $this->m_caption = substr($this->m_value, 7); + $this->m_value = $this->m_caption; } else { // this case is only for backwards compatibility/repair; may vanish at some point - $this->m_url = 'mailto:' . $this->m_value; + $this->m_uri = 'mailto:' . $this->m_value; + $this->m_url = $this->m_uri; } } else { - $parts = explode(':', $this->m_value, 2); // try to split "schema:rest" +
[MediaWiki-CVS] SVN: [54096] trunk/extensions/SemanticMediaWiki/includes
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54096 Revision: 54096 Author: mkroetzsch Date: 2009-07-31 13:20:10 + (Fri, 31 Jul 2009) Log Message: --- Support empty output formats (equivalently: format string "-") in queries to obtain unformatted, plain outputs. This addresses Bug 19086, but more generally allows for better control in output formatting for all types. Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Linear.php trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Number.php trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Temperature.php trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Linear.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Linear.php 2009-07-31 12:45:29 UTC (rev 54095) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Linear.php 2009-07-31 13:20:10 UTC (rev 54096) @@ -103,7 +103,7 @@ $value = false; if ($this->m_unit === $this->m_mainunit) { // only try if conversion worked - if ( ($value === false) && $this->m_outformat) { // first try given output unit + if ( ($value === false) && ($this->m_outformat) && ($this->m_outformat != '-') ) { // first try given output unit $unit = $this->normalizeUnit($this->m_outformat); $printunit = $unit; if (array_key_exists($unit, $this->m_unitids)) { // find id for output unit Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Number.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Number.php 2009-07-31 12:45:29 UTC (rev 54095) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Number.php 2009-07-31 13:20:10 UTC (rev 54096) @@ -94,7 +94,7 @@ public function getShortWikiText($linked = NULL) { $this->unstub(); - if (($linked === NULL) || ($linked === false)) { + if (($linked === NULL) || ($linked === false) || ($this->m_outformat == '-') ) { return $this->m_caption; } $this->makeConversionValues(); @@ -140,11 +140,14 @@ } elseif ($i > 1) { $result .= ', '; } - $result .= smwfNumberFormat($value); + $result .= ($this->m_outformat != '-'?smwfNumberFormat($value):$value); if ($unit != '') { $result .= ' ' . $unit; } $i++; + if ($this->m_outformat == '-') { // no further conversions for plain output format + break; + } } if ($i > 1) { $result .= ')'; @@ -268,7 +271,7 @@ */ protected function makeUserValue() { $this->convertToMainUnit(); - $this->m_caption = smwfNumberFormat($this->m_value); + $this->m_caption = ($this->m_outformat != '-'?smwfNumberFormat($this->m_value):$this->m_value); if ($this->m_unit != '') { $this->m_caption .= ' ' . $this->m_unit; } Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php 2009-07-31 12:45:29 UTC (rev 54095) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php 2009-07-31 13:20:10 UTC (rev 54096) @@ -47,7 +47,7 @@ /// If the property is predefined, its internal key is stored here. Otherwise FALSE. protected $m_propert
[MediaWiki-CVS] SVN: [54099] trunk/extensions/SemanticMediaWiki/includes/ SMW_GlobalFunctions.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54099 Revision: 54099 Author: mkroetzsch Date: 2009-07-31 14:30:14 + (Fri, 31 Jul 2009) Log Message: --- prefer non-exp notation for larger numbers Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2009-07-31 13:50:22 UTC (rev 54098) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2009-07-31 14:30:14 UTC (rev 54099) @@ -536,7 +536,7 @@ //The "$value!=0" is relevant: we want to scientify numbers that are close to 0, but never 0! if ( ($decplaces > 0) && ($value != 0) ) { $absValue = abs($value); - if ($absValue >= 10) { + if ($absValue >= 1000) { $doScientific = true; } elseif ($absValue <= pow(10,-$decplaces)) { $doScientific = true; ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54121] trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob .php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54121 Revision: 54121 Author: mkroetzsch Date: 2009-07-31 20:39:38 + (Fri, 31 Jul 2009) Log Message: --- do not require that a title object is passed to job (job queue sometimes passes NULL if title creation failed for some reason) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php Modified: trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php === --- trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php 2009-07-31 20:22:02 UTC (rev 54120) +++ trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php 2009-07-31 20:39:38 UTC (rev 54121) @@ -9,9 +9,9 @@ */ /** - * SMWUpdateJob updates the semantic data in the database for a given title + * SMWUpdateJob updates the semantic data in the database for a given title * using the MediaWiki JobQueue. Update jobs are created if, when saving an article, - * it is detected that the content of other pages must be re-parsed as well (e.g. + * it is detected that the content of other pages must be re-parsed as well (e.g. * due to some type change). * * @note This job does not update the page display or parser cache, so in general @@ -23,7 +23,7 @@ */ class SMWUpdateJob extends Job { - function __construct(Title $title) { + function __construct($title) { parent::__construct( 'SMWUpdateJob', $title); } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54154] trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54154 Revision: 54154 Author: mkroetzsch Date: 2009-08-01 17:04:53 + (Sat, 01 Aug 2009) Log Message: --- +default month names, fixing Bug 17882 Modified Paths: -- trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php 2009-08-01 16:44:44 UTC (rev 54153) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php 2009-08-01 17:04:53 UTC (rev 54154) @@ -26,9 +26,9 @@ protected $m_SpecialPropertyAliases = array(); protected $m_Namespaces; protected $m_NamespaceAliases = array(); - /// Twelve strings naming the months. English is always supported in Type:Date, so - /// the default is simply empty (no labels in addition to English) - protected $m_months = array(); + /// Twelve strings naming the months. English is always supported in Type:Date, but + /// we still need the English defaults to ensure that labels are returned by getMonthLabel() + protected $m_months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); /// Twelve strings briefly naming the months. English is always supported in Type:Date, so /// the default is simply empty (no labels in addition to English) protected $m_monthsshort = array(); @@ -54,7 +54,7 @@ /** * Return all labels that are available as names for built-in datatypes. Those -* are the types that users can access via [[has type::...]] (more built-in +* are the types that users can access via [[has type::...]] (more built-in * types may exist for internal purposes but the user won't need to * know this). The returned array is indexed by (internal) type ids. */ ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54155] trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageNl. php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54155 Revision: 54155 Author: mkroetzsch Date: 2009-08-01 17:05:15 + (Sat, 01 Aug 2009) Log Message: --- added month names based on translations giving in Bug 17882 Modified Paths: -- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageNl.php Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageNl.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageNl.php 2009-08-01 17:04:53 UTC (rev 54154) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageNl.php 2009-08-01 17:05:15 UTC (rev 54155) @@ -105,4 +105,8 @@ 'Concept_talk' => SMW_NS_CONCEPT_TALK ); +protected $m_months = array('januari','februari','maart','april','mei','juni','juli','augustus','september','oktober','november','december'); + +protected $m_monthsshort = array("jan", "feb", "mar", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec"); + } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54156] trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54156 Revision: 54156 Author: mkroetzsch Date: 2009-08-01 17:07:40 + (Sat, 01 Aug 2009) Log Message: --- add some todos Modified Paths: -- trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php 2009-08-01 17:05:15 UTC (rev 54155) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php 2009-08-01 17:07:40 UTC (rev 54156) @@ -92,7 +92,9 @@ } /** -* Function looks up a month and returns the corresponding number (e.g. No +* Function looks up a month and returns the corresponding number. +* @todo Should we add functionality to ignore case here? +* @todo Should there be prefix string matching instead of two arrays for full and short names? */ function findMonth($label) { $id = array_search($label, $this->m_months); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54157] trunk/extensions/SemanticMediaWiki/includes
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54157 Revision: 54157 Author: mkroetzsch Date: 2009-08-01 17:21:33 + (Sat, 01 Aug 2009) Log Message: --- parameter $smwgMaxNonExpNumber to control when SMW will use exp notation for abbreviating numbers (Bug 13317) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2009-08-01 17:07:40 UTC (rev 54156) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2009-08-01 17:21:33 UTC (rev 54157) @@ -522,6 +522,7 @@ * scientific notation) */ function smwfNumberFormat($value, $decplaces=3) { + global $smwgMaxNonExpNumber; wfLoadExtensionMessages('SemanticMediaWiki'); $decseparator = wfMsgForContent('smw_decseparator'); @@ -536,7 +537,7 @@ //The "$value!=0" is relevant: we want to scientify numbers that are close to 0, but never 0! if ( ($decplaces > 0) && ($value != 0) ) { $absValue = abs($value); - if ($absValue >= 1000) { + if ($absValue >= $smwgMaxNonExpNumber) { $doScientific = true; } elseif ($absValue <= pow(10,-$decplaces)) { $doScientific = true; Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php 2009-08-01 17:07:40 UTC (rev 54156) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php 2009-08-01 17:21:33 UTC (rev 54157) @@ -286,6 +286,14 @@ ## ### +# The maximal number that SMW will normally display without using scientific exp +# notation. The deafult is rather large since some users have problems understanding +# exponents. Scineitfic applications may prefer a smaller value for concise display. +## +$smwgMaxNonExpNumber = 1000; +## + +### # SMW defers some tasks until after a page was edited by using the MediaWiki # job queueing system (see http://www.mediawiki.org/wiki/Manual:Job_queue). # For example, when the type of a property is changed, all affected pages will ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54158] trunk/extensions/SemanticMediaWiki/RELEASE-NOTES
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54158 Revision: 54158 Author: mkroetzsch Date: 2009-08-01 17:24:09 + (Sat, 01 Aug 2009) Log Message: --- start collecting some release notes for SMW 1.4.3 Modified Paths: -- trunk/extensions/SemanticMediaWiki/RELEASE-NOTES Modified: trunk/extensions/SemanticMediaWiki/RELEASE-NOTES === --- trunk/extensions/SemanticMediaWiki/RELEASE-NOTES2009-08-01 17:21:33 UTC (rev 54157) +++ trunk/extensions/SemanticMediaWiki/RELEASE-NOTES2009-08-01 17:24:09 UTC (rev 54158) @@ -1,5 +1,18 @@ For a documentation of all features, see http://semantic-mediawiki.org +== SMW 1.4.3 == + +See http://semantic-mediawiki.org/wiki/SMW_1.4.3 + +* Using "-" as an output format for query printouts, or leaving the formatting + string empty now leads to printout values being returned as plain, unformatted + values. Recall that the general format for printouts in #ask is as follows: + ?propertyname # format = label +* New configuration parameter $smwgMaxNonExpNumber to set the maximal number that + SMW will normally display without using scientific exp notation. Defaults to + 1000. +* Numerous bugfixes + == SMW 1.4.2 == See http://semantic-mediawiki.org/wiki/SMW_1.4.2 ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54159] trunk/extensions/SemanticMediaWiki/includes
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54159 Revision: 54159 Author: mkroetzsch Date: 2009-08-01 17:41:44 + (Sat, 01 Aug 2009) Log Message: --- Allow query parameter "headers=plain" to have unlinked printout names in result tables and lists (Bug 17376) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Table.php trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php 2009-08-01 17:24:09 UTC (rev 54158) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php 2009-08-01 17:41:44 UTC (rev 54159) @@ -137,8 +137,8 @@ } if ($first_value) { // first value in any column, print header $first_value = false; - if ( $this->mShowHeaders && ('' != $field->getPrintRequest()->getLabel()) ) { - $result .= $field->getPrintRequest()->getText(SMW_OUTPUT_WIKI, $this->mLinker) . ' '; + if ( ($this->mShowHeaders != SMW_HEADERS_HIDE) && ('' != $field->getPrintRequest()->getLabel()) ) { + $result .= $field->getPrintRequest()->getText(SMW_OUTPUT_WIKI, ($this->mShowHeaders == SMW_HEADERS_PLAIN?NULL:$this->mLinker)) . ' '; } } $result .= $text; // actual output value Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Table.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Table.php 2009-08-01 17:24:09 UTC (rev 54158) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Table.php 2009-08-01 17:41:44 UTC (rev 54159) @@ -27,10 +27,10 @@ $widthpara = ' width="100%"'; else $widthpara = ''; $result = "\n"; - if ($this->mShowHeaders) { // building headers + if ($this->mShowHeaders != SMW_HEADERS_HIDE) { // building headers $result .= "\t\n"; foreach ($res->getPrintRequests() as $pr) { - $result .= "\t\t" . $pr->getText($outputmode, $this->mLinker) . "\n"; + $result .= "\t\t" . $pr->getText($outputmode, ($this->mShowHeaders == SMW_HEADERS_PLAIN?NULL:$this->mLinker) ) . "\n"; } $result .= "\t\n"; } Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php 2009-08-01 17:24:09 UTC (rev 54158) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php 2009-08-01 17:41:44 UTC (rev 54159) @@ -6,6 +6,11 @@ * @ingroup SMWQuery */ +// constants that define how/if headers should be displayed +define('SMW_HEADERS_SHOW', 2); +define('SMW_HEADERS_PLAIN', 1); +define('SMW_HEADERS_HIDE', 0); // used to be "false" hence use "0" to support extensions that still assume this + /** * Abstract base class for SMW's novel query printing mechanism. It implements * part of the former functionality of SMWInlineQuery (everything related to @@ -37,7 +42,7 @@ protected $mFormat; // a string identifier describing a valid format protected $mLinkFirst; // should article names of the first column be linked? protected $mLinkOthers; // should article names of other columns (besides the first) be linked? - protected $mShowHeaders = true; // should the headers (property names) be printed? + protected $mShowHeaders = SMW_HEADERS_SHOW; // should the headers (property names) be printed? protected $mShowErrors = true; // should errors possibly be printed? protected $mInline; // is this query result "inline" in some page (only then a link to unshown results is created, error handling may also be affected) protected $mLinker; // Linker object as needed for making result links. Might come from some s
[MediaWiki-CVS] SVN: [54160] trunk/extensions/SemanticMediaWiki/RELEASE-NOTES
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54160 Revision: 54160 Author: mkroetzsch Date: 2009-08-01 17:45:53 + (Sat, 01 Aug 2009) Log Message: --- +remark on new "headers=plain" feature Modified Paths: -- trunk/extensions/SemanticMediaWiki/RELEASE-NOTES Modified: trunk/extensions/SemanticMediaWiki/RELEASE-NOTES === --- trunk/extensions/SemanticMediaWiki/RELEASE-NOTES2009-08-01 17:41:44 UTC (rev 54159) +++ trunk/extensions/SemanticMediaWiki/RELEASE-NOTES2009-08-01 17:45:53 UTC (rev 54160) @@ -11,6 +11,8 @@ * New configuration parameter $smwgMaxNonExpNumber to set the maximal number that SMW will normally display without using scientific exp notation. Defaults to 1000. +* The #ask parameter "headers" can now be given the value "plain" to get query + results that show the printout label (e.g. property name) but without a link. * Numerous bugfixes == SMW 1.4.2 == ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54161] trunk/extensions/SemanticMediaWiki/languages
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54161 Revision: 54161 Author: mkroetzsch Date: 2009-08-01 17:57:54 + (Sat, 01 Aug 2009) Log Message: --- added aliases for special "Modification date" property to all languages (Bug 17908) Modified Paths: -- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageAr.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageArz.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEs.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageFr.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageHe.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageIt.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageNl.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePl.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePt.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageRu.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageSk.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageZh_cn.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageZh_tw.php Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageAr.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageAr.php 2009-08-01 17:45:53 UTC (rev 54160) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageAr.php 2009-08-01 17:57:54 UTC (rev 54161) @@ -14,7 +14,7 @@ /** * Arabic language labels for important SMW labels (namespaces, datatypes,...). - * + * * @author Mahmoud Zouari mahmoudzou...@yahoo.fr http://www.cri.ensmp.fr * @author Meno25 * @ingroup SMWLanguage @@ -53,10 +53,12 @@ '_IMPO' => 'المستوردة من', '_CONV' => 'يقابل', '_SERV' => 'يوفر الخدمة', - '_PVAL' => 'يسمح بالقيمة' + '_PVAL' => 'يسمح بالقيمة', + '_MDAT' => 'Modification date' // TODO: translate ); protected $m_SpecialPropertyAliases = array( + 'Modification date' => '_MDAT', 'عرض الوحدة' => '_UNIT' ); Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageArz.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageArz.php 2009-08-01 17:45:53 UTC (rev 54160) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageArz.php 2009-08-01 17:57:54 UTC (rev 54161) @@ -53,10 +53,12 @@ '_IMPO' => 'المستوردة من', '_CONV' => 'يقابل', '_SERV' => 'يوفر الخدمة', - '_PVAL' => 'يسمح بالقيمة' + '_PVAL' => 'يسمح بالقيمة', + '_MDAT' => 'Modification date' // TODO: translate ); protected $m_SpecialPropertyAliases = array( + 'Modification date' => '_MDAT', 'عرض الوحدة' => '_UNIT' ); Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php 2009-08-01 17:45:53 UTC (rev 54160) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php 2009-08-01 17:57:54 UTC (rev 54161) @@ -73,7 +73,8 @@ '_IMPO' => 'Importiert aus', '_CONV' => 'Entspricht', '_SERV' => 'Bietet Service', - '_PVAL' => 'Erlaubt Wert' + '_PVAL' => 'Erlaubt Wert', + '_MDAT' => 'Zuletzt geändert' ); protected $m_SpecialPropertyAliases = array( @@ -87,7 +88,8 @@ 'Imported from' => '_IMPO', 'Corresponds to'=> '_CONV', 'Provides service' => '_SERV', - 'Allows value' => '_PVAL' + 'Allows value' => '_PVAL', + 'Modification date' => '_MDAT' ); protected $m_Namespaces = array( Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEs.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEs.php 2009-08-01 17:45:53 UTC (rev 54160) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEs.php 2009-08-01 17:57:54 UTC (rev 54161) @@ -65,6 +65,7 @@ '_CONV' => 'Corresponde a
[MediaWiki-CVS] SVN: [54182] trunk/extensions/SemanticMediaWiki
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54182 Revision: 54182 Author: mkroetzsch Date: 2009-08-01 18:53:45 + (Sat, 01 Aug 2009) Log Message: --- parameter $smwgMaxPropertyValues to control number of values that are shown for each page in the listing on Property pages (Bug 14506) Modified Paths: -- trunk/extensions/SemanticMediaWiki/RELEASE-NOTES trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php Modified: trunk/extensions/SemanticMediaWiki/RELEASE-NOTES === --- trunk/extensions/SemanticMediaWiki/RELEASE-NOTES2009-08-01 18:45:24 UTC (rev 54181) +++ trunk/extensions/SemanticMediaWiki/RELEASE-NOTES2009-08-01 18:53:45 UTC (rev 54182) @@ -11,6 +11,8 @@ * New configuration parameter $smwgMaxNonExpNumber to set the maximal number that SMW will normally display without using scientific exp notation. Defaults to 1000. +* New configuration parameter $smwgMaxPropertyValues to control number of values + that are shown for each page in the listing on Property pages. Defaults to 3. * The #ask parameter "headers" can now be given the value "plain" to get query results that show the printout label (e.g. property name) but without a link. * Numerous bugfixes Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php 2009-08-01 18:45:24 UTC (rev 54181) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php 2009-08-01 18:53:45 UTC (rev 54182) @@ -148,6 +148,12 @@ ## ### +# How many values should at most be displayed for a page on the Property page? +## +$smwgMaxPropertyValues = 3; // if large values are desired, consider reducing $smwgPropertyPagingLimit for unchanged performance +## + +### # Settings for inline queries ({{#ask:...}}) and for semantic queries in # general. This can especially be used to prevent overly high server-load by # complex queries. The following settings affect all queries, wherever they Modified: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php === --- trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php 2009-08-01 18:45:24 UTC (rev 54181) +++ trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php 2009-08-01 18:53:45 UTC (rev 54182) @@ -107,7 +107,7 @@ * one column and object articles/values in the other one. */ private function subjectObjectList() { - global $wgContLang; + global $wgContLang, $smwgMaxPropertyValues; $store = smwfGetStore(); $ac = count($this->articles); @@ -137,7 +137,7 @@ ' ' . $searchlink->getHTML($this->getSkin()) . ''; // Property values $ropts = new SMWRequestOptions(); - $ropts->limit = 4; + $ropts->limit = $smwgMaxPropertyValues + 1; $values = $store->getPropertyValues($this->articles[$index], $this->mProperty, $ropts); $i=0; foreach ($values as $value) { @@ -145,7 +145,7 @@ $r .= ', '; } $i++; - if ($i < 4) { + if ($i < $smwgMaxPropertyValues + 1) { $r .= $value->getLongHTMLText($this->getSkin()) . $value->getInfolinkText(SMW_OUTPUT_HTML, $this->getSkin()); } else { $searchlink = SMWInfolink::newInversePropertySearchLink('…', $this->articles[$index]->getWikiValue(), $this->mTitle->getText()); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54195] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54195 Revision: 54195 Author: mkroetzsch Date: 2009-08-02 10:28:11 + (Sun, 02 Aug 2009) Log Message: --- improvements in date parsing, fixing the remaining issues of Bug 16557 Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2009-08-02 08:31:29 UTC (rev 54194) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2009-08-02 10:28:11 UTC (rev 54195) @@ -96,6 +96,10 @@ $value = trim($value); // ignore whitespace + if ($this->m_caption === false) { + $this->m_caption = $value; + } + // if it's a number, and it's sufficiently high, so we know // it's not a year, treat it as a Julian day if (is_numeric($value) && $value > 10) { @@ -121,7 +125,7 @@ $is_yearbc = true; } $regexp = "/(\040|T){0,1}".str_replace("+", "\+", $match[0])."(\040){0,1}/u"; //delete ad/bc value and preceding and following chars, but keep some space there - $filteredvalue = preg_replace($regexp,' ', $filteredvalue); //value without ad/bc + $filteredvalue = trim(preg_replace($regexp,' ', $filteredvalue)); //value without ad/bc } //browse string for time value @@ -158,7 +162,7 @@ //split array in order to separate the date digits $array = preg_split("/[\040|.|,|\-|\/]+/u", $filteredvalue, 3); //TODO: support and - again; - // The following code segment creates a band by finding out wich role each digit of the entered date can take + // The following code segment creates a band by finding out which role each digit of the entered date can take // (date, year, month). The band starts with 1 and for each digit of the entered date a binary code with three // bits is attached. Examples: // 111 states that the digit can be interpreted as a month, a day or a year @@ -184,6 +188,7 @@ $digitcount = count($array)-1; //number of digits - 1 is used as an array index for $dateformats $found = false; foreach ($dateformats[$digitcount] as $format) { //check whether created band matches dateformats + // Note: sprintf can be used for debugging, e.g. print " checkformat: " . sprintf("%b",$format) . "\n"; if (!(~$band & $format)) { //check if $format => $band ("the detected band supports the current format") $i = 0; foreach ($this->m_formats[$format] as $globalvar) { // map format digits to internal variables @@ -202,10 +207,12 @@ $this->addError(wfMsgForContent('smw_nodatetime',$value)); return true; } elseif ( ($this->m_day > 0) && ($this->m_day > $this->m_daysofmonths[$this->m_month]) ) { //date does not exist in Gregorian calendar + ///TODO: Return a more suitable error wfLoadExtensionMessages('SemanticMediaWiki'); $this->addError(wfMsgForContent('smw_nodatetime',$value)); return true; } elseif ( ($this->m_year < -4713) && ($this->m_timeoffset != 0) ) { //no support for time offsets if year < -4713 + ///TODO: Return a more suitable error wfLoadExtensionMessages('SemanticMediaWiki'); $this->addError(wfMsgForContent('smw_nodatetime',$value)); return true; @@ -224,9 +231,6 @@ $this->JD2Date(); } - if ($this->m_caption === false) { - $this->m_caption = $value; - } return true; } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54200] trunk/extensions/SemanticMediaWiki/specials/SearchTriple/ SMW_SpecialPageProperty.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54200 Revision: 54200 Author: mkroetzsch Date: 2009-08-02 12:22:03 + (Sun, 02 Aug 2009) Log Message: --- Support retrieval of all values of a property using Special:PageProperty with empty subject (Bug 13148) Modified Paths: -- trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php Modified: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php === --- trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php 2009-08-02 12:03:24 UTC (rev 54199) +++ trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php 2009-08-02 12:22:03 UTC (rev 54200) @@ -13,7 +13,7 @@ * This special page for Semantic MediaWiki implements a * view on a object-relation pair, i.e. a page that shows * all the fillers of a property for a certain page. - * This is typically used for overflow results from other + * This is typically used for overflow results from other * dynamic output pages. * * @ingroup SMWSpecialPage @@ -65,10 +65,10 @@ wfLoadExtensionMessages('SemanticMediaWiki'); - if (('' == $type) || ('' == $from)) { // No relation or subject given. + if (('' == $type)) { // No relation or subject given. $html .= wfMsg('smw_pp_docu') . "\n"; } else { // everything is given - $wgOut->setPagetitle($subject->getFullText() . ' ' . $property->getWikiValue()); + $wgOut->setPagetitle( ($subject === NULL?'':$subject->getFullText() . ' ') . $property->getWikiValue()); $options = new SMWRequestOptions(); $options->limit = $limit+1; $options->offset = $offset; ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54202] trunk/extensions/SemanticMediaWiki/includes/storage/ SMW_SQLStore2.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54202 Revision: 54202 Author: mkroetzsch Date: 2009-08-02 12:30:30 + (Sun, 02 Aug 2009) Log Message: --- support proper numeric sorting even if no datavalue boundary is given in call of getPropertyValues() Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php === --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2009-08-02 12:29:42 UTC (rev 54201) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2009-08-02 12:30:30 UTC (rev 54202) @@ -385,11 +385,11 @@ $db->freeResult($res); break; case SMW_SQL2_ATTS2: - if ( ($requestoptions !== NULL) && ($requestoptions->boundary !== NULL) && - ($requestoptions->boundary->isNumeric()) ) { - $value_column = 'value_num'; - } else { - $value_column = 'value_xsd'; + if ( ($requestoptions !== NULL) && ($requestoptions->boundary !== NULL) ) { // the quick way to find out if this is a numeric type + $value_column = $requestoptions->boundary->isNumeric()?'value_num':'value_xsd'; + } else { // need to do more work to find out if this is a numeric type + $testval = SMWDatavalueFactory::newTypeIDValue($property->getPropertyTypeID()); + $value_column = $testval->isNumeric()?'value_num':'value_xsd'; } $sql = 'p_id=' . $db->addQuotes($pid) . $this->getSQLConditions($requestoptions,$value_column,'value_xsd'); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54203] trunk/extensions/SemanticMediaWiki/includes/storage/ SMW_SQLStore2.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54203 Revision: 54203 Author: mkroetzsch Date: 2009-08-02 12:37:49 + (Sun, 02 Aug 2009) Log Message: --- ensure that getPropertyValues returns only distinct results Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php === --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2009-08-02 12:30:30 UTC (rev 54202) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2009-08-02 12:37:49 UTC (rev 54203) @@ -361,7 +361,7 @@ case SMW_SQL2_TEXT2: $res = $db->select( 'smw_text2', 'value_blob', 'p_id=' . $db->addQuotes($pid), - 'SMW::getPropertyValues', $this->getSQLOptions($requestoptions) ); + 'SMW::getPropertyValues', $this->getSQLOptions($requestoptions) ); ///NOTE: Do not add DISTINCT here for performance reasons while($row = $db->fetchObject($res)) { $dv = SMWDataValueFactory::newPropertyObjectValue($property); $dv->setOutputFormat($outputformat); @@ -375,7 +375,7 @@ 'smw_namespace, smw_title, smw_iw', 'p_id=' . $db->addQuotes($pid) . ' AND o_id=smw_id' . $this->getSQLConditions($requestoptions,'smw_sortkey','smw_sortkey'), - 'SMW::getPropertyValues', $this->getSQLOptions($requestoptions,'smw_sortkey') ); + 'SMW::getPropertyValues', $this->getSQLOptions($requestoptions,'smw_sortkey') + array('DISTINCT') ); while($row = $db->fetchObject($res)) { $dv = SMWDataValueFactory::newPropertyObjectValue($property); $dv->setOutputFormat($outputformat); @@ -396,7 +396,7 @@ $res = $db->select( 'smw_atts2', 'value_unit, value_xsd', 'p_id=' . $db->addQuotes($pid) . $this->getSQLConditions($requestoptions,$value_column,'value_xsd'), - 'SMW::getPropertyValues', $this->getSQLOptions($requestoptions,$value_column) ); + 'SMW::getPropertyValues', $this->getSQLOptions($requestoptions,$value_column) + array('DISTINCT') ); while($row = $db->fetchObject($res)) { $dv = SMWDataValueFactory::newPropertyObjectValue($property); $dv->setOutputFormat($outputformat); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54204] trunk/extensions/SemanticMediaWiki/RELEASE-NOTES
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54204 Revision: 54204 Author: mkroetzsch Date: 2009-08-02 13:09:19 + (Sun, 02 Aug 2009) Log Message: --- mention new Special:PageProperty capability Modified Paths: -- trunk/extensions/SemanticMediaWiki/RELEASE-NOTES Modified: trunk/extensions/SemanticMediaWiki/RELEASE-NOTES === --- trunk/extensions/SemanticMediaWiki/RELEASE-NOTES2009-08-02 12:37:49 UTC (rev 54203) +++ trunk/extensions/SemanticMediaWiki/RELEASE-NOTES2009-08-02 13:09:19 UTC (rev 54204) @@ -15,6 +15,7 @@ that are shown for each page in the listing on Property pages. Defaults to 3. * The #ask parameter "headers" can now be given the value "plain" to get query results that show the printout label (e.g. property name) but without a link. +* Special:PageProperty now shows all values of a property when omitting the subject. * Numerous bugfixes == SMW 1.4.2 == ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54267] trunk/extensions/SemanticMediaWiki
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54267 Revision: 54267 Author: mkroetzsch Date: 2009-08-03 11:31:07 + (Mon, 03 Aug 2009) Log Message: --- support new built-in property to record if input errors happened on a page; final name for that property still under discussion (see mailing list) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php 2009-08-03 11:12:55 UTC (rev 54266) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php 2009-08-03 11:31:07 UTC (rev 54267) @@ -361,7 +361,8 @@ '_SUBP' => array('__sup',true), '_SUBC' => array('__suc',false), '_CONC' => array('__con',false), - '_MDAT' => array('_dat',false) + '_MDAT' => array('_dat',false), + '_ERRP' => array('_wpp',false), ); wfRunHooks( 'smwInitProperties' ); } Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php 2009-08-03 11:12:55 UTC (rev 54266) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php 2009-08-03 11:31:07 UTC (rev 54267) @@ -81,6 +81,9 @@ $result = SMWDataValueFactory::newPropertyObjectValue($property,$value,$caption); if ($storeannotation && (SMWParseData::getSMWData($parser) !== NULL)) { SMWParseData::getSMWData($parser)->addPropertyObjectValue($property,$result); + if (!$result->isValid()) { // take note of the error for storage (do this here and not in storage, thus avoiding duplicates) + SMWParseData::getSMWData($parser)->addPropertyObjectValue(SMWPropertyValue::makeProperty('_ERRP'),$property->getWikiPageValue()); + } } wfProfileOut("SMWParseData::addProperty (SMW)"); return $result; @@ -95,14 +98,14 @@ * * Optionally, this function also takes care of triggering indirect updates that might be * needed for overall database consistency. If the saved page describes a property or data type, -* the method checks whether the property type, the data type, the allowed values, or the +* the method checks whether the property type, the data type, the allowed values, or the * conversion factors have changed. If so, it triggers SMWUpdateJobs for the relevant articles, * which then asynchronously update the semantic data in the database. * * @todo Known bug/limitation: Updatejobs are triggered when a property or type * definition has changed, so that all affected pages get updated. However, if a * page uses a property but the given value caused an error, then there is no record -* of that page using the property, so that it will not be updated. To fix this, one +* of that page using the property, so that it will not be updated. To fix this, one * would need to store errors as well. * * @param $parseroutput ParserOutput object that contains the results of parsing which will @@ -144,7 +147,7 @@ $ptype = SMWPropertyValue::makeProperty('_TYPE'); $oldtype = smwfGetStore()->getPropertyValues($title, $ptype); $newtype = $semdata->getPropertyValues($ptype); - + if (!SMWParseData::equalDatavalues($oldtype, $newtype)) { $updatejobflag = true; } else { @@ -301,7 +304,7 @@ SMWParseData::storeData($output, $links_update->mTitle, true); return true; } - + /** * This method will be called whenever an article is deleted so that * semantic properties are cleared appropriately. @@ -310,7 +313,7 @@ smwfGetStore()->deleteSubject($article->getTitle()); return true; // always return true, in order not to stop M
[MediaWiki-CVS] SVN: [54270] trunk/extensions/SemanticMediaWiki/includes/ SMW_ParserExtensions.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54270 Revision: 54270 Author: mkroetzsch Date: 2009-08-03 11:39:04 + (Mon, 03 Aug 2009) Log Message: --- completely ignore empty property values instead of reporting an error (they were not valid for any datatype anyway); useful for saving some checks e.g. in templates Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php 2009-08-03 11:38:27 UTC (rev 54269) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_ParserExtensions.php 2009-08-03 11:39:04 UTC (rev 54270) @@ -118,6 +118,10 @@ if (array_key_exists(2,$semanticLink)) { $value = $semanticLink[2]; } else { $value = ''; } + if ($value == '') { // silently ignore empty values + wfProfileOut("smwfParsePropertiesCallback (SMW)"); + return ''; + } if ($property == 'SMW') { switch ($value) { ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54271] trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54271 Revision: 54271 Author: mkroetzsch Date: 2009-08-03 11:55:34 + (Mon, 03 Aug 2009) Log Message: --- re-read property values when the property datatype has changed, even for pages where only invalid values had been given to that property so far Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php 2009-08-03 11:39:04 UTC (rev 54270) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php 2009-08-03 11:55:34 UTC (rev 54271) @@ -163,6 +163,10 @@ foreach ($subjects as $subject) { $jobs[] = new SMWUpdateJob($subject->getTitle()); } + $subjects = smwfGetStore()->getPropertySubjects(SMWPropertyValue::makeProperty('_ERRP'), $prop->getWikiPageValue()); + foreach ($subjects as $subject) { + $jobs[] = new SMWUpdateJob($subject->getTitle()); + } } } elseif ($makejobs && $smwgEnableUpdateJobs && ($namespace == SMW_NS_TYPE) ) { // if it is a type we need to check if the conversion factors have been changed @@ -179,10 +183,14 @@ foreach ($proppages as $proppage) { $jobs[] = new SMWUpdateJob($proppage->getTitle()); $prop = SMWPropertyValue::makeProperty($proppage->getDBkey()); - $propsubjects = $store->getAllPropertySubjects($prop); - foreach ($propsubjects as $subj) { - $jobs[] = new SMWUpdateJob($subj->getTitle()); + $subjects = $store->getAllPropertySubjects($prop); + foreach ($propsubjects as $subject) { + $jobs[] = new SMWUpdateJob($subject->getTitle()); } + $subjects = smwfGetStore()->getPropertySubjects(SMWPropertyValue::makeProperty('_ERRP'), $prop->getWikiPageValue()); + foreach ($propsubjects as $subject) { + $jobs[] = new SMWUpdateJob($subject->getTitle()); + } } } } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54272] trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54272 Revision: 54272 Author: mkroetzsch Date: 2009-08-03 12:19:47 + (Mon, 03 Aug 2009) Log Message: --- removed @todo that was fixed with previous commit Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php 2009-08-03 11:55:34 UTC (rev 54271) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php 2009-08-03 12:19:47 UTC (rev 54272) @@ -102,12 +102,6 @@ * conversion factors have changed. If so, it triggers SMWUpdateJobs for the relevant articles, * which then asynchronously update the semantic data in the database. * -* @todo Known bug/limitation: Updatejobs are triggered when a property or type -* definition has changed, so that all affected pages get updated. However, if a -* page uses a property but the given value caused an error, then there is no record -* of that page using the property, so that it will not be updated. To fix this, one -* would need to store errors as well. -* * @param $parseroutput ParserOutput object that contains the results of parsing which will * be stored. * @param $title Title object specifying the page that should be safed. ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54353] trunk/extensions/SemanticMediaWiki/INSTALL
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54353 Revision: 54353 Author: mkroetzsch Date: 2009-08-04 09:27:43 + (Tue, 04 Aug 2009) Log Message: --- prepared instructions for SMW 1.4.3 release Modified Paths: -- trunk/extensions/SemanticMediaWiki/INSTALL Modified: trunk/extensions/SemanticMediaWiki/INSTALL === --- trunk/extensions/SemanticMediaWiki/INSTALL 2009-08-04 08:54:31 UTC (rev 54352) +++ trunk/extensions/SemanticMediaWiki/INSTALL 2009-08-04 09:27:43 UTC (rev 54353) @@ -1,4 +1,4 @@ -[[Semantic MediaWiki 1.4.2]] +[[Semantic MediaWiki 1.4.3]] Install instructions for the latest SMW version are also online in a more convenient format for reading: @@ -34,7 +34,7 @@ == Requirements == -* MediaWiki 1.11.* or greater (tested from 1.11.0 to 1.15alpha (r47833)). +* MediaWiki 1.11.* or greater (tested from 1.11.0 to 1.156alpha (r54352)). * PHP 5.x or greater installed and working * MySQL >= 4.0.14 (version required by MediaWiki) OR PostgreSQL >= 8.3 Note that Postgres support is still preliminary and might require special @@ -140,7 +140,7 @@ (Please read all of this before upgrading) -Existing SMW 1.4.1 installations and all SMW installations that already use the +Existing SMW 1.4.* installations and all SMW installations that already use the default store (SMWSQLStore2) can simply follow the above installation steps. The latter covers all sites with SMW 1.2 to 1.3 that do not use a special setting to switch back to the old store ("SMWSQLStore" or "SMWRAPStore"). In @@ -153,7 +153,7 @@ use the old store. Again, all data will immediately be available when the data upgrade has finished. -Directly after enabling SMW 1.4.2, it can potentially happen that the site +Directly after enabling SMW 1.4.3, it can potentially happen that the site shows SQL errors due to background jobs trying to access the new DB structure even before you intialised it. This can even block you from reaching SMWAdmin. In this case, either use the script SMW_setup.php from the command-line, or @@ -162,10 +162,10 @@ Especially when upgrading from SMW 1.3 or older, extensions of SMW (e.g. Semantic Forms) need to be updated to a version that is compatible with -SMW 1.4.2. See your extension's homepage for details. If you use one of the +SMW 1.4.3. See your extension's homepage for details. If you use one of the formats timeline (or eventline), icalendar, or vcard in inline queries, then you need to install/upgrade the extension SemanticResultFormats (SRF) in -version 1.4.2 or greater. The formats have been migrated to this extension +version 1.4.6 or greater. The formats have been migrated to this extension package and are enabled there by default after installation. === Changed configuration options === ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54354] trunk/extensions/SemanticMediaWiki/languages
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54354 Revision: 54354 Author: mkroetzsch Date: 2009-08-04 09:38:03 + (Tue, 04 Aug 2009) Log Message: --- final name for new special property that records input problems Modified Paths: -- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageAr.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageArz.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEs.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageFr.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageHe.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageIt.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageNl.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePl.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePt.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageRu.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageSk.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageZh_cn.php trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageZh_tw.php Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageAr.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageAr.php 2009-08-04 09:27:43 UTC (rev 54353) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageAr.php 2009-08-04 09:38:03 UTC (rev 54354) @@ -54,11 +54,13 @@ '_CONV' => 'يقابل', '_SERV' => 'يوفر الخدمة', '_PVAL' => 'يسمح بالقيمة', - '_MDAT' => 'Modification date' // TODO: translate + '_MDAT' => 'Modification date', // TODO: translate + '_ERRP' => 'Has improper value for' // TODO: translate ); protected $m_SpecialPropertyAliases = array( 'Modification date' => '_MDAT', + 'Has improper value for' => '_ERRP', 'عرض الوحدة' => '_UNIT' ); Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageArz.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageArz.php 2009-08-04 09:27:43 UTC (rev 54353) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageArz.php 2009-08-04 09:38:03 UTC (rev 54354) @@ -54,11 +54,13 @@ '_CONV' => 'يقابل', '_SERV' => 'يوفر الخدمة', '_PVAL' => 'يسمح بالقيمة', - '_MDAT' => 'Modification date' // TODO: translate + '_MDAT' => 'Modification date', // TODO: translate + '_ERRP' => 'Has improper value for' // TODO: translate ); protected $m_SpecialPropertyAliases = array( 'Modification date' => '_MDAT', + 'Has improper value for' => '_ERRP', 'عرض الوحدة' => '_UNIT' ); Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php 2009-08-04 09:27:43 UTC (rev 54353) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php 2009-08-04 09:38:03 UTC (rev 54354) @@ -74,7 +74,8 @@ '_CONV' => 'Entspricht', '_SERV' => 'Bietet Service', '_PVAL' => 'Erlaubt Wert', - '_MDAT' => 'Zuletzt geändert' + '_MDAT' => 'Zuletzt geändert', + '_ERRP' => 'Hat unpassenden Wert für' ); protected $m_SpecialPropertyAliases = array( @@ -89,7 +90,8 @@ 'Corresponds to'=> '_CONV', 'Provides service' => '_SERV', 'Allows value' => '_PVAL', - 'Modification date' => '_MDAT' + 'Modification date' => '_MDAT', + 'Has improper value for' => '_ERRP' ); protected $m_Namespaces = array( Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php 2009-08-04 09:27:43 UTC (rev 54353) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php 2009-08-04 09:38:03 UTC (rev 54354) @@ -56
[MediaWiki-CVS] SVN: [54380] trunk/extensions/SemanticMediaWiki/includes/ SMW_GlobalFunctions.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54380 Revision: 54380 Author: mkroetzsch Date: 2009-08-04 18:33:40 + (Tue, 04 Aug 2009) Log Message: --- this is SMW 1.4.3 Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2009-08-04 18:29:08 UTC (rev 54379) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2009-08-04 18:33:40 UTC (rev 54380) @@ -14,7 +14,7 @@ * @defgroup SMW Semantic MediaWiki */ -define('SMW_VERSION','1.5e-SVN'); +define('SMW_VERSION','1.4.3'); // constants for displaying the factbox define('SMW_FACTBOX_HIDDEN', 1); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54431] trunk/extensions/SemanticMediaWiki/includes/ SMW_GlobalFunctions.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54431 Revision: 54431 Author: mkroetzsch Date: 2009-08-05 06:36:47 + (Wed, 05 Aug 2009) Log Message: --- change version string back to SVN version Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2009-08-05 05:49:28 UTC (rev 54430) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2009-08-05 06:36:47 UTC (rev 54431) @@ -14,7 +14,7 @@ * @defgroup SMW Semantic MediaWiki */ -define('SMW_VERSION','1.4.3'); +define('SMW_VERSION','1.5f-SVN'); // constants for displaying the factbox define('SMW_FACTBOX_HIDDEN', 1); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54433] trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor .php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54433 Revision: 54433 Author: mkroetzsch Date: 2009-08-05 07:25:39 + (Wed, 05 Aug 2009) Log Message: --- fixing Denny's code ... (Bug 20071) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php 2009-08-05 07:10:14 UTC (rev 54432) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php 2009-08-05 07:25:39 UTC (rev 54433) @@ -306,17 +306,18 @@ static public function getResultFromQuery($query, $params, $extraprintouts, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY, $format = '') { wfProfileIn('SMWQueryProcessor::getResultFromQuery (SMW)'); - - # Query routing - # TODO: case-insensitive - $store = smwfGetStore(); # default store + // Query routing allows extensions to provide alternative stores as data sources + // The while feature is experimental and is not properly integrated with most of SMW's architecture. For instance, some query printers just fetch their own store. + ///TODO: case-insensitive global $smwgQuerySources; - if ( array_key_exists ("source", $params) and array_key_exists ($params["source"], $smwgQuerySources) ) { - $store = &new $smwgQuerySources[$params["source"]](); - $query->params = $params; + if ( array_key_exists( "source", $params ) && array_key_exists( $params["source"], $smwgQuerySources ) ) { + $store = new $smwgQuerySources[$params["source"]](); + $query->params = $params; // this is a hack + } else { + $store = smwfGetStore(); // default store } $res = $store->getQueryResult($query); - + if ( ($query->querymode == SMWQuery::MODE_INSTANCES) || ($query->querymode == SMWQuery::MODE_NONE) ) { wfProfileIn('SMWQueryProcessor::getResultFromQuery-printout (SMW)'); if ($format == '') { ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54440] trunk/extensions/SemanticMediaWiki/INSTALL
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54440 Revision: 54440 Author: mkroetzsch Date: 2009-08-05 09:28:12 + (Wed, 05 Aug 2009) Log Message: --- typo Modified Paths: -- trunk/extensions/SemanticMediaWiki/INSTALL Modified: trunk/extensions/SemanticMediaWiki/INSTALL === --- trunk/extensions/SemanticMediaWiki/INSTALL 2009-08-05 08:39:11 UTC (rev 54439) +++ trunk/extensions/SemanticMediaWiki/INSTALL 2009-08-05 09:28:12 UTC (rev 54440) @@ -162,11 +162,10 @@ Especially when upgrading from SMW 1.3 or older, extensions of SMW (e.g. Semantic Forms) need to be updated to a version that is compatible with -SMW 1.4.3. See your extension's homepage for details. If you use one of the -formats timeline (or eventline), icalendar, or vcard in inline queries, then -you need to install/upgrade the extension SemanticResultFormats (SRF) in -version 1.4.6 or greater. The formats have been migrated to this extension -package and are enabled there by default after installation. +SMW 1.4.3. See your extension's homepage for details. If used, it is suggested +to update to SemanticResultFormats (SRF) in version 1.4.6 or greater. The +formats have been migrated to this extension package and are enabled there by +default after installation. === Changed configuration options === ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54441] trunk/extensions/SemanticMediaWiki/INSTALL
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54441 Revision: 54441 Author: mkroetzsch Date: 2009-08-05 09:29:59 + (Wed, 05 Aug 2009) Log Message: --- another typo Modified Paths: -- trunk/extensions/SemanticMediaWiki/INSTALL Modified: trunk/extensions/SemanticMediaWiki/INSTALL === --- trunk/extensions/SemanticMediaWiki/INSTALL 2009-08-05 09:28:12 UTC (rev 54440) +++ trunk/extensions/SemanticMediaWiki/INSTALL 2009-08-05 09:29:59 UTC (rev 54441) @@ -34,7 +34,7 @@ == Requirements == -* MediaWiki 1.11.* or greater (tested from 1.11.0 to 1.156alpha (r54352)). +* MediaWiki 1.11.* or greater (tested from 1.11.0 to 1.16alpha (r54352)). * PHP 5.x or greater installed and working * MySQL >= 4.0.14 (version required by MediaWiki) OR PostgreSQL >= 8.3 Note that Postgres support is still preliminary and might require special ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54443] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54443 Revision: 54443 Author: mkroetzsch Date: 2009-08-05 10:06:18 + (Wed, 05 Aug 2009) Log Message: --- allow February to have 29 days in principle! Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2009-08-05 09:33:53 UTC (rev 54442) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2009-08-05 10:06:18 UTC (rev 54443) @@ -79,7 +79,7 @@ protected $m_months = array("January", "February", "March", "April" , "May" , "June" , "July" , "August" , "September" , "October" , "November" , "December"); protected $m_monthsshort = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); protected $m_formats = array( SMW_Y => array('year'), SMW_YM => array('year','month'), SMW_MY => array('month','year'), SMW_YDM => array('year','day','month'), SMW_YMD => array('year','month','day'), SMW_DMY => array('day','month','year'), SMW_MDY => array('month','day','year')); - protected $m_daysofmonths = array ( 1 => 31, 2 => 28, 3 => 31, 4 => 30, 5 => 31, 6 => 30, 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31 ); + protected $m_daysofmonths = array ( 1 => 31, 2 => 29, 3 => 31, 4 => 30, 5 => 31, 6 => 30, 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31 ); protected function parseUserValue($value) { global $smwgContLang; ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [54736] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54736 Revision: 54736 Author: mkroetzsch Date: 2009-08-10 20:35:48 + (Mon, 10 Aug 2009) Log Message: --- included patch by Temlakos: much improved timezone support Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2009-08-10 20:15:24 UTC (rev 54735) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2009-08-10 20:35:48 UTC (rev 54736) @@ -80,6 +80,21 @@ protected $m_monthsshort = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); protected $m_formats = array( SMW_Y => array('year'), SMW_YM => array('year','month'), SMW_MY => array('month','year'), SMW_YDM => array('year','day','month'), SMW_YMD => array('year','month','day'), SMW_DMY => array('day','month','year'), SMW_MDY => array('month','day','year')); protected $m_daysofmonths = array ( 1 => 31, 2 => 29, 3 => 31, 4 => 30, 5 => 31, 6 => 30, 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31 ); + // Time zone monikers and their associated offsets in hours and fractions of hours + protected $m_tz = array("A" => 1, "ACDT" => 10.5, "ACST" => 9.5, "ADT" => -3, "AEDT" => 11, + "AEST" => 10, "AKDT" => -8, "AKST" => -9, "AST" => -4, "AWDT" => 9, "AWST" => 8, + "B" => 2, "BST" => 1, "C" => 3, "CDT" => -5, "CEDT" => 2, "CEST" => 2, + "CET" => 1, "CST" => -6, "CXT" => 7, "D" => 4, "E" => 5, "EDT" => -4, + "EEDT" => 3, "EEST" => 3, "EET" => 2, "EST" => -5, "F" => 6, "G" => 7, + "GMT" => 0, "H" => 8, "HAA" => -3, "HAC" => -5, "HADT" => -9, "HAE" => -4, + "HAP" => -7, "HAR" => -6, "HAST" => -10, "HAT" => -2.5, "HAY" => -8, + "HNA" => -4, "HNC" => -6, "HNE" => -5, "HNP" => -8, "HNR" => -7, "HNT" => -3.5, + "HNY" => -9, "I" => 9, "IST" => 1, "K" => 10, "L" => 11, "M" => 12, + "MDT" => -6, "MESZ" => 2, "MEZ" => 1, "MSD" => 4, "MSK" => 3, "MST" => -7, + "N" => -1, "NDT" => -2.5, "NFT" => 11.5, "NST" => -3.5, "O" => -2, "P" => -3, + "PDT" => -7, "PST" => -8, "Q" => -4, "R" => -5, "S" => -6, "T" => -7, + "U" => -8, "UTC" => 0, "V" => -9, "W" => -10, "WDT" => 9, "WEDT" => 1, + "WEST" => 1, "WET" => 0, "WST" => 8, "X" => -11, "Y" => -12, "Z" => 0); protected function parseUserValue($value) { global $smwgContLang; @@ -128,7 +143,17 @@ $filteredvalue = trim(preg_replace($regexp,' ', $filteredvalue)); //value without ad/bc } - //browse string for time value + //browse string in advance for timezone monikers ("EST", "WET", "MESZ", etc.) + $regexptz = "/A[CEKW]?[DS]T|BST|CXT|[CEW]([DES]|E[DS])T|" . + "GMT|H(A[DS]T|[AN][ACEPRTY])|IST|M(DT|E(S)?Z|S[DKT])|N[DFS]T|P[DS]T|UTC/u"; + if(preg_match($regexptz, $filteredvalue, $match)) { + // Retrieve the offset and store it as the initial time offset value. + $this->m_timeoffset = $this->m_timeoffset + $this->m_tz[$match[0]]/24; + $regexp = "/(\040|T){0
[MediaWiki-CVS] SVN: [54919] tags/extensions/SemanticMediaWiki/REL_1_4_3/includes/ SMW_ParseData.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54919 Revision: 54919 Author: mkroetzsch Date: 2009-08-13 07:54:40 + (Thu, 13 Aug 2009) Log Message: --- make way for minor update to fix a typo Removed Paths: - tags/extensions/SemanticMediaWiki/REL_1_4_3/includes/SMW_ParseData.php Deleted: tags/extensions/SemanticMediaWiki/REL_1_4_3/includes/SMW_ParseData.php === --- tags/extensions/SemanticMediaWiki/REL_1_4_3/includes/SMW_ParseData.php 2009-08-13 07:47:59 UTC (rev 54918) +++ tags/extensions/SemanticMediaWiki/REL_1_4_3/includes/SMW_ParseData.php 2009-08-13 07:54:40 UTC (rev 54919) @@ -1,328 +0,0 @@ -matchAndRemove($text)) { - $words[] = 'SMW_NOFACTBOX'; - } - $mw = MagicWord::get('SMW_SHOWFACTBOX'); - if ($mw->matchAndRemove($text)) { - $words[] = 'SMW_SHOWFACTBOX'; - } - $output = SMWParseData::getOutput($parser); - $output->mSMWMagicWords = $words; - return $words; - } - - /** -* This function retrieves the SMW data from a given parser, and creates -* a new empty container if it is not initiated yet. -*/ - static public function getSMWdata($parser) { - $output = SMWParseData::getOutput($parser); - $title = $parser->getTitle(); - if (!isset($output) || !isset($title)) return NULL; // no parsing, create error - if (!isset($output->mSMWData)) { // no data container yet - $output->mSMWData = new SMWSemanticData(SMWWikiPageValue::makePageFromTitle($title)); - } - return $output->mSMWData; - } - - /** -* Clear all stored data for a given parser. -*/ - static public function clearStorage($parser) { - $output = SMWParseData::getOutput($parser); - $title = $parser->getTitle(); - if (!isset($output) || !isset($title)) return; - $output->mSMWData = new SMWSemanticData(SMWWikiPageValue::makePageFromTitle($title)); - } - - /** -* This method adds a new property with the given value to the storage. It is -* intended to be used on user input, and property and value are sepcified by -* strings as they might be found in a wiki. The function returns a datavalue -* object that contains the result of the operation. -*/ - static public function addProperty($propertyname, $value, $caption, $parser, $storeannotation = true) { - wfProfileIn("SMWParseData::addProperty (SMW)"); - global $smwgContLang; - // See if this property is a special one, such as e.g. "has type" - $property = SMWPropertyValue::makeUserProperty($propertyname); - $result = SMWDataValueFactory::newPropertyObjectValue($property,$value,$caption); - if ($storeannotation && (SMWParseData::getSMWData($parser) !== NULL)) { - SMWParseData::getSMWData($parser)->addPropertyObjectValue($property,$result); - if (!$result->isValid()) { // take note of the error for storage (do this here and not in storage, thus avoiding duplicates) - SMWParseData::getSMWData($parser)->addPropertyObjectValue(SMWPropertyValue::makeProperty('_ERRP'),$property->getWikiPageValue()); - } - } - wfProfileOut("SMWParseData::addProperty (SMW)"); - return $result; - } - - - /** -* This function takes care of storing the collected semantic data and takes -* care of clearing out any outdated entries for the processed page. It assume that -* parsing has happened and that all relevant data is contained in the provided parser -* output. -* -* Optionally, this function also takes care of triggering indirect updates that might be -* needed for overall database consistency. If the saved page describes a property or data type, -* the method checks whether the property type, the data type, the allowed values, or the -* conversion factors have changed. If so, it triggers SMWUpdateJobs for the relevant articles, -* which then asynchronously update the semantic data in the database. -* -* @param $parseroutput ParserOutput object that contains the results of parsing which will -* be stored. -* @param $title Title object specifying the page that should be safed. -* @param $makejobs Bool stating whether jobs should be created to trigger further updates if -* this appears to b
[MediaWiki-CVS] SVN: [54920] tags/extensions/SemanticMediaWiki/REL_1_4_3/includes/ SMW_ParseData.php
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54920 Revision: 54920 Author: mkroetzsch Date: 2009-08-13 07:55:41 + (Thu, 13 Aug 2009) Log Message: --- typo fix backport (since it is a typo with rather significant side effects) Added Paths: --- tags/extensions/SemanticMediaWiki/REL_1_4_3/includes/SMW_ParseData.php Copied: tags/extensions/SemanticMediaWiki/REL_1_4_3/includes/SMW_ParseData.php (from rev 54918, trunk/extensions/SemanticMediaWiki/includes/SMW_ParseData.php) === --- tags/extensions/SemanticMediaWiki/REL_1_4_3/includes/SMW_ParseData.php (rev 0) +++ tags/extensions/SemanticMediaWiki/REL_1_4_3/includes/SMW_ParseData.php 2009-08-13 07:55:41 UTC (rev 54920) @@ -0,0 +1,328 @@ +matchAndRemove($text)) { + $words[] = 'SMW_NOFACTBOX'; + } + $mw = MagicWord::get('SMW_SHOWFACTBOX'); + if ($mw->matchAndRemove($text)) { + $words[] = 'SMW_SHOWFACTBOX'; + } + $output = SMWParseData::getOutput($parser); + $output->mSMWMagicWords = $words; + return $words; + } + + /** +* This function retrieves the SMW data from a given parser, and creates +* a new empty container if it is not initiated yet. +*/ + static public function getSMWdata($parser) { + $output = SMWParseData::getOutput($parser); + $title = $parser->getTitle(); + if (!isset($output) || !isset($title)) return NULL; // no parsing, create error + if (!isset($output->mSMWData)) { // no data container yet + $output->mSMWData = new SMWSemanticData(SMWWikiPageValue::makePageFromTitle($title)); + } + return $output->mSMWData; + } + + /** +* Clear all stored data for a given parser. +*/ + static public function clearStorage($parser) { + $output = SMWParseData::getOutput($parser); + $title = $parser->getTitle(); + if (!isset($output) || !isset($title)) return; + $output->mSMWData = new SMWSemanticData(SMWWikiPageValue::makePageFromTitle($title)); + } + + /** +* This method adds a new property with the given value to the storage. It is +* intended to be used on user input, and property and value are sepcified by +* strings as they might be found in a wiki. The function returns a datavalue +* object that contains the result of the operation. +*/ + static public function addProperty($propertyname, $value, $caption, $parser, $storeannotation = true) { + wfProfileIn("SMWParseData::addProperty (SMW)"); + global $smwgContLang; + // See if this property is a special one, such as e.g. "has type" + $property = SMWPropertyValue::makeUserProperty($propertyname); + $result = SMWDataValueFactory::newPropertyObjectValue($property,$value,$caption); + if ($storeannotation && (SMWParseData::getSMWData($parser) !== NULL)) { + SMWParseData::getSMWData($parser)->addPropertyObjectValue($property,$result); + if (!$result->isValid()) { // take note of the error for storage (do this here and not in storage, thus avoiding duplicates) + SMWParseData::getSMWData($parser)->addPropertyObjectValue(SMWPropertyValue::makeProperty('_ERRP'),$property->getWikiPageValue()); + } + } + wfProfileOut("SMWParseData::addProperty (SMW)"); + return $result; + } + + + /** +* This function takes care of storing the collected semantic data and takes +* care of clearing out any outdated entries for the processed page. It assume that +* parsing has happened and that all relevant data is contained in the provided parser +* output. +* +* Optionally, this function also takes care of triggering indirect updates that might be +* needed for overall database consistency. If the saved page describes a property or data type, +* the method checks whether the property type, the data type, the allowed values, or the +* conversion factors have changed. If so, it triggers SMWUpdateJobs for the relevant articles, +* which then asynchronously update the semantic data in the database. +* +* @param $parseroutput ParserOutput object that contains the results of parsing which will +* be stored. +* @param $title Title object specifying the page that should be safed. +* @param $
[MediaWiki-CVS] SVN: [43607] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property. php
Revision: 43607 Author: mkroetzsch Date: 2008-11-17 16:48:12 + (Mon, 17 Nov 2008) Log Message: --- init pre-defined properties when creating from internal ID Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php 2008-11-17 16:35:52 UTC (rev 43606) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php 2008-11-17 16:48:12 UTC (rev 43607) @@ -111,6 +111,7 @@ */ protected function unstub() { if (is_array($this->m_stubdata)) { + SMWPropertyValue::initProperties(); if ($this->m_stubdata[0]{0} == '_') { // internal id, use as is (and hope it is still known) $this->m_propertyid = $this->m_stubdata[0]; } else { // possibly name of special property ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43611] trunk/extensions/SemanticMediaWiki/includes
Revision: 43611 Author: mkroetzsch Date: 2008-11-17 17:28:35 + (Mon, 17 Nov 2008) Log Message: --- Fix to print property labels correctly in query results (Bug 16304) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php 2008-11-17 17:26:26 UTC (rev 43610) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php 2008-11-17 17:28:35 UTC (rev 43611) @@ -131,6 +131,13 @@ } } + public function setCaption($caption) { + parent::setCaption($caption); + if ($this->m_wikipage instanceof SMWDataValue) { // pass caption to embedded datavalue (used for printout) + $this->m_wikipage->setCaption($caption); + } + } + /** * Return TRUE if this is a usual wiki property that is defined by a wiki page, as * opposed to a property that is pre-defined in the wiki. Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php === --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php 2008-11-17 17:26:26 UTC (rev 43610) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php 2008-11-17 17:28:35 UTC (rev 43611) @@ -39,6 +39,9 @@ if ( ($mode == SMWPrintRequest::PRINT_CCAT) && ($outputformat === '') ) { $this->m_outputformat = 'x'; // changed default for Boolean case } + if ($this->m_data instanceof SMWDataValue) { + $this->m_data->setCaption($label); + } } public function getMode() { @@ -64,7 +67,7 @@ case SMWPrintRequest::PRINT_CCAT: return $linker->makeLinkObj($this->m_data->getTitle(), htmlspecialchars($this->m_label)); case SMWPrintRequest::PRINT_PROP: - return $this->m_data->getLongHTMLText($linker); + return $this->m_data->getShortHTMLText($linker); case SMWPrintRequest::PRINT_THIS: default: return htmlspecialchars($this->m_label); } @@ -80,7 +83,7 @@ switch ($this->m_mode) { case SMWPrintRequest::PRINT_CATS: return $this->m_label; // TODO: link to Special:Categories case SMWPrintRequest::PRINT_PROP: - return $this->m_data->getLongWikiText($linked); + return $this->m_data->getShortWikiText($linked); case SMWPrintRequest::PRINT_CCAT: return '[[:' . $this->m_data->getPrefixedText() . '|' . $this->m_label . ']]'; case SMWPrintRequest::PRINT_THIS: default: return $this->m_label; ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43614] trunk/extensions/SemanticMediaWiki
Revision: 43614 Author: mkroetzsch Date: 2008-11-17 18:01:14 + (Mon, 17 Nov 2008) Log Message: --- update of Type:Date from Fabian Howahl Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-17 17:52:41 UTC (rev 43613) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-17 18:01:14 UTC (rev 43614) @@ -32,7 +32,7 @@ protected $m_jdn = ''; //numerical time representation similiar to Julian Day Number protected $m_timeoffset; //contains offset (e.g. timezone) protected $m_timeannotation; //contains am or pm - protected $m_timeisset = true; + protected $m_timeisset; protected $m_yearbc; //true if year is BC protected $m_months = array("January", "February", "March", "April" , "May" , "June" , "Juli" , "August" , "September" , "October" , "November" , "December"); protected $m_monthsshort = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); @@ -51,15 +51,16 @@ $this->m_timeoffset = 0; $this->m_timepm = false; $this->m_timeisset = false; + $this->m_timeannotation = false; $this->m_wikivalue = $value; $filteredvalue = $value; //value without time definition and further abbreviations like PM or BC //browse string for special abbreviations referring to time like am, pm if(preg_match("/([Aa]|[Pp])[Mm]/u", $filteredvalue, $match)){ - $this->m_timeannotation = strtolower($match[0]); - $regexp = "/(\040|T){0,1}".str_replace("+", "\+", $match[0])."(\040){0,1}/u"; //delete pm/am, preceding and following chars - $filteredvalue = preg_replace($regexp,'', $filteredvalue); //value without am/pm + $this->m_timeannotation = strtolower($match[0]); + $regexp = "/(\040|T){0,1}".str_replace("+", "\+", $match[0])."(\040){0,1}/u"; //delete pm/am, preceding and following chars + $filteredvalue = preg_replace($regexp,'', $filteredvalue); //value without am/pm } //browse string for special abbreviations referring to year like AD, BC @@ -78,25 +79,24 @@ //timezone handling if(preg_match("/([+\-][0-2]?[0-9](:(30|00))?)/u", $time, $match2)){ //get timezone definition - $offset = $this->normalizeTimeValue($match2[0]); - $sign = 1; - if($offset[0] == '-') $sign = -1; - $offset = substr($offset,1); - list ($offhours, $offminutes, $offseconds) = explode(':',$offset,3); - $offset = $sign * (($offhours / 24) + ($offminutes / (60*24)) + ($offseconds / (3600*24))); - $this->m_timeoffset = $this->m_timeoffset + $offset; - $time = str_replace($match2[0],'',$time); + $offset = $this->normalizeTimeValue($match2[0]); + $sign = 1; + if($offset[0] == '-') $sign = -1; + $offset = substr($offset,1); + list ($offhours, $offminutes, $offseconds) = explode(':',$offset,3); + $offset = $sign * (($offhours / 24) + ($offminutes / (60*24)) + ($offseconds / (3600*24))); + $this->m_timeoffset = $this->m_timeoffset + $offset; + $time = str_replace($match2[0],'',$time); } list($hours,$minutes,$seconds) = explode(':',$this->normalizeTimeValue($time),3); //am/pm handling - if($this->m_timeannotation != ''){ - - if(!strcmp($this->m_timeannotation,'am') && $hours == 12) $hours = 0
[MediaWiki-CVS] SVN: [43619] trunk/extensions/SemanticMediaWiki/includes
Revision: 43619 Author: mkroetzsch Date: 2008-11-17 18:46:10 + (Mon, 17 Nov 2008) Log Message: --- add support for SF special properties, improving their performance Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php 2008-11-17 18:36:03 UTC (rev 43618) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php 2008-11-17 18:46:10 UTC (rev 43619) @@ -57,11 +57,14 @@ parent::__construct($typeid); switch ($typeid) { case '_wpp' : case '__sup': - $this->m_fixNamespace = SMW_NS_PROPERTY; + $this->m_fixNamespace = SMW_NS_PROPERTY; break; case '_wpc' : case '__suc': - $this->m_fixNamespace = NS_CATEGORY; + $this->m_fixNamespace = NS_CATEGORY; break; + case '_wpf' : case '__spf': + $this->m_fixNamespace = SF_NS_FORM; + break; default: //case '_wpg': $this->m_fixNamespace = NS_MAIN; } Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2008-11-17 18:36:03 UTC (rev 43618) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2008-11-17 18:46:10 UTC (rev 43619) @@ -323,7 +323,9 @@ define('SMW_NS_PROPERTY_TALK', $smwgNamespaceIndex+3); define('SMW_NS_TYPE', $smwgNamespaceIndex+4); define('SMW_NS_TYPE_TALK', $smwgNamespaceIndex+5); - // 106 and 107 are occupied by the Semantic Forms + // 106 and 107 are occupied by the Semantic Forms, we define them here to offer some (easy but useful) support to SF + define('SF_NS_FORM',$smwgNamespaceIndex+6); + define('SF_NS_FORM_TALK', $smwgNamespaceIndex+7); define('SMW_NS_CONCEPT',$smwgNamespaceIndex+8); define('SMW_NS_CONCEPT_TALK', $smwgNamespaceIndex+9); Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php === --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2008-11-17 18:36:03 UTC (rev 43618) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2008-11-17 18:46:10 UTC (rev 43619) @@ -65,7 +65,9 @@ '_REDI' => 15, '_SUBP' => 17, '_SUBC' => 18, - '_CONC' => 19 + '_CONC' => 19, + '_SF_DF' => 20, // Semantic Form's default form property + '_SF_AF' => 21 // Semantic Form's alternate form property ); /// This array defines how various datatypes should be handled internally. This @@ -84,6 +86,7 @@ '_wpg' => SMW_SQL2_RELS2, // Page type '_wpp' => SMW_SQL2_RELS2, // Property page type '_wpc' => SMW_SQL2_RELS2, // Category page type + '_wpf' => SMW_SQL2_RELS2, // Form page type (for Semantic Forms) '_num' => SMW_SQL2_ATTS2, // Number type '_tem' => SMW_SQL2_ATTS2, // Temperature type '_dat' => SMW_SQL2_ATTS2, // Time type @@ -96,6 +99,7 @@ '__spu' => SMW_SQL2_SPEC2, // Special uri type '__sup' => SMW_SQL2_SUBS2, // Special subproperty type '__suc' => SMW_SQL2_SUBS2, // Special subcategory type + '__spf' => SMW_SQL2_SPEC2, // Special form type (for Semantic Forms) '__sin' => SMW_SQL2_INST2, // Special instance of type '__red' => SMW_SQL2_REDI2, // Special redirect type '__lin' => SMW_SQL2_SPEC2, // Special linear unit conversion type ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43620] trunk/extensions/SemanticMediaWiki/includes/ SMW_DataValueFactory.php
Revision: 43620 Author: mkroetzsch Date: 2008-11-17 18:48:49 + (Mon, 17 Nov 2008) Log Message: --- support Form custom datatypes Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php 2008-11-17 18:46:10 UTC (rev 43619) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php 2008-11-17 18:48:49 UTC (rev 43620) @@ -117,6 +117,7 @@ '_wpg' => 'SMWWikiPageValue', // Page type '_wpp' => 'SMWWikiPageValue', // Property page type TODO: make available to user space '_wpc' => 'SMWWikiPageValue', // Category page type TODO: make available to user space + '_wpf' => 'SMWWikiPageValue', // Form page type for Semantic Forms '_num' => 'SMWNumberValue', // Number type '_tem' => 'SMWTemperatureValue', // Temperature type '_dat' => 'SMWTimeValue', // Time type @@ -129,6 +130,7 @@ '__spu' => 'SMWURIValue', // Special uri type '__sup' => 'SMWWikiPageValue', // Special subproperty type '__suc' => 'SMWWikiPageValue', // Special subcategory type + '__spf' => 'SMWWikiPageValue', // Special Form page type for Semantic Forms '__sin' => 'SMWWikiPageValue', // Special instance of type '__red' => 'SMWWikiPageValue', // Special redirect type '__lin' => 'SMWLinearValue', // Special linear unit conversion type ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43635] trunk/extensions/SemanticMediaWiki/includes/storage/ SMW_SQLStore2.php
Revision: 43635 Author: mkroetzsch Date: 2008-11-17 21:04:36 + (Mon, 17 Nov 2008) Log Message: --- typo Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php === --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2008-11-17 20:23:37 UTC (rev 43634) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2008-11-17 21:04:36 UTC (rev 43635) @@ -235,7 +235,7 @@ if ($pid != false) { $property = SMWPropertyValue::makeProperty($pid); } else { // this should be rare (only if some extension uses properties of "special" types - $proprow = $db->selectRow('smw_ids', array('smw_title'), array('smw_id' => $row->id), 'SMW::getSemanticData'); + $proprow = $db->selectRow('smw_ids', array('smw_title'), array('smw_id' => $row->p_id), 'SMW::getSemanticData'); $property = SMWPropertyValue::makeProperty($proprow->smw_title); } $dv = SMWDataValueFactory::newPropertyObjectValue($property); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43638] trunk/extensions/SemanticMediaWiki/includes/storage/ SMW_SQLStore2.php
Revision: 43638 Author: mkroetzsch Date: 2008-11-17 21:22:03 + (Mon, 17 Nov 2008) Log Message: --- added remark on possible todo for even more gentle reaction to unlikely problems ... Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php === --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2008-11-17 21:18:37 UTC (rev 43637) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2008-11-17 21:22:03 UTC (rev 43638) @@ -234,8 +234,9 @@ $pid = array_search($row->p_id, SMWSQLStore2::$special_ids); if ($pid != false) { $property = SMWPropertyValue::makeProperty($pid); - } else { // this should be rare (only if some extension uses properties of "special" types + } else { // this should be rare (only if some extension uses properties of "special" types) $proprow = $db->selectRow('smw_ids', array('smw_title'), array('smw_id' => $row->p_id), 'SMW::getSemanticData'); + /// TODO: $proprow may be false (inconsistent DB but anyway); maybe check and be gentle in some way $property = SMWPropertyValue::makeProperty($proprow->smw_title); } $dv = SMWDataValueFactory::newPropertyObjectValue($property); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43704] trunk/extensions/SemanticMediaWiki
Revision: 43704 Author: mkroetzsch Date: 2008-11-19 11:40:23 + (Wed, 19 Nov 2008) Log Message: --- New user-friendly interface for controlling incremental data rebuilding from the web interface. Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_RefreshJob.php trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php Modified: trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_RefreshJob.php === --- trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_RefreshJob.php 2008-11-19 09:08:49 UTC (rev 43703) +++ trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_RefreshJob.php 2008-11-19 11:40:23 UTC (rev 43704) @@ -20,7 +20,7 @@ */ class SMWRefreshJob extends Job { - function __construct($title, $params = array('spos'=>1) ) { + function __construct($title, $params = array('spos'=>1, 'prog'=>0) ) { parent::__construct( 'SMWRefreshJob', $title, $params); } @@ -45,4 +45,12 @@ wfProfileOut('SMWRefreshJob::run (SMW)'); return true; } + + /** +* Report the estimated progress status of this job as a number between 0 and 1 (0% to 100%). +* The progress refers to the state before processing this job. +*/ + public function getProgress() { + return array_key_exists('prog',$this->params)?$this->params['prog']:0; + } } Modified: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php === --- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 09:08:49 UTC (rev 43703) +++ trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 11:40:23 UTC (rev 43704) @@ -44,7 +44,19 @@ } $this->setHeaders(); - + + / Get status of refresh job, if any / + if ($smwgAdminRefreshStore) { + $dbr =& wfGetDB( DB_SLAVE ); + $row = $dbr->selectRow( 'job', '*', array( 'job_cmd' => 'SMWRefreshJob' ), __METHOD__ ); + if ($row !== false) { // similar to Job::pop_type, but without deleting the job + $title = Title::makeTitleSafe( $row->job_namespace, $row->job_title); + $refreshjob = Job::factory( $row->job_cmd, $title, Job::extractBlob( $row->job_params ), $row->job_id ); + } else { + $refreshjob = NULL; + } + } + / Execute actions if any / $action = $wgRequest->getText( 'action' ); @@ -68,17 +80,25 @@ flush(); return; } - } elseif ($smwgAdminRefreshStore && ($action=='refreshstore')) { // not accessible via UI yet, testing - $dbw =& wfGetDB( DB_MASTER ); - // delete existing iteration jobs - $dbw->delete( 'job', array( 'job_cmd' => 'SMWRefreshJob' ), __METHOD__ ); - $affected = $dbw->affectedRows(); - $warning = ($affected > 0)?' Existing refresh jobs were stopped when the new job was created; please be patient to let refreshing finish or use the MediaWiki script runJobs.php to finish all jobs at once.':''; - // and make a new one - $title = Title::makeTitle(NS_SPECIAL, 'SMWAdmin'); - $newjob = new SMWRefreshJob($title, array('spos'=>1)); - $newjob->insert(); - $wgOut->addHTML("Added new job for refreshing the semantic data. All stored data will be rebuilt or repaired where needed.$warning"); + } elseif ($smwgAdminRefreshStore && ($action=='refreshstore')) { // managing refresh jobs for the store + $sure = $wgRequest->getText( 'rfsure' ); + if ($sure == 'yes') { + if ($refreshjob === NULL) { // careful, there might be race conditions here + $title = Title::makeTitle(NS_SPECIAL, 'SMWAdmin'); + $newjob = new SMWRefreshJob($title, array('spos'=>1)); + $newjob->insert()
[MediaWiki-CVS] SVN: [43705] trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/ SMW_SpecialSMWAdmin.php
Revision: 43705 Author: mkroetzsch Date: 2008-11-19 11:47:12 + (Wed, 19 Nov 2008) Log Message: --- extended text Modified Paths: -- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php Modified: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php === --- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 11:40:23 UTC (rev 43704) +++ trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 11:47:12 UTC (rev 43705) @@ -87,7 +87,7 @@ $title = Title::makeTitle(NS_SPECIAL, 'SMWAdmin'); $newjob = new SMWRefreshJob($title, array('spos'=>1)); $newjob->insert(); - $wgOut->addHTML("A new update process for refreshing the semantic data was started. All stored data will be rebuilt or repaired where needed."); + $wgOut->addHTML("A new update process for refreshing the semantic data was started. All stored data will be rebuilt or repaired where needed. You can follow the progress of the update on this special page."); } else { $wgOut->addHTML("There is already an update process running. Not creating another one."); } @@ -138,7 +138,7 @@ ''; if ($refreshjob !== NULL) { $prog = $refreshjob->getProgress(); - $html .= "An update is already in progress. It is normal that the update progresses only slowly. This reduces server load. To finish an update more quickly, you can use the MediaWiki maintenance script runJobs.php (use the option --maxjobs 2000 to restrict the number of updates done at once). Estimated progress of current update: " . + $html .= "An update is already in progress. It is normal that the update progresses only slowly since it only refreshes data in small chunks each time a user accesses the wiki. To finish an update more quickly, you can use the MediaWiki maintenance script runJobs.php (use the option --maxjobs 2000 to restrict the number of updates done at once). Estimated progress of current update: " . ' ' . round($prog*100,4) . '%' . '' . ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43707] trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/ SMW_SpecialSMWAdmin.php
Revision: 43707 Author: mkroetzsch Date: 2008-11-19 11:49:16 + (Wed, 19 Nov 2008) Log Message: --- minor clarification in text Modified Paths: -- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php Modified: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php === --- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 11:47:16 UTC (rev 43706) +++ trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 11:49:16 UTC (rev 43707) @@ -138,7 +138,7 @@ ''; if ($refreshjob !== NULL) { $prog = $refreshjob->getProgress(); - $html .= "An update is already in progress. It is normal that the update progresses only slowly since it only refreshes data in small chunks each time a user accesses the wiki. To finish an update more quickly, you can use the MediaWiki maintenance script runJobs.php (use the option --maxjobs 2000 to restrict the number of updates done at once). Estimated progress of current update: " . + $html .= "An update is already in progress. It is normal that the update progresses only slowly since it only refreshes data in small chunks each time a user accesses the wiki. To finish this update more quickly, you can invoke the MediaWiki maintenance script runJobs.php (use the option --maxjobs 2000 to restrict the number of updates done at once). Estimated progress of current update: " . ' ' . round($prog*100,4) . '%' . '' . ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43709] trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/ SMW_SpecialSMWAdmin.php
Revision: 43709 Author: mkroetzsch Date: 2008-11-19 11:57:40 + (Wed, 19 Nov 2008) Log Message: --- Show progress of running jobs even if web-based management of these jobs was disabled Modified Paths: -- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php Modified: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php === --- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 11:55:50 UTC (rev 43708) +++ trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 11:57:40 UTC (rev 43709) @@ -46,15 +46,13 @@ $this->setHeaders(); / Get status of refresh job, if any / - if ($smwgAdminRefreshStore) { - $dbr =& wfGetDB( DB_SLAVE ); - $row = $dbr->selectRow( 'job', '*', array( 'job_cmd' => 'SMWRefreshJob' ), __METHOD__ ); - if ($row !== false) { // similar to Job::pop_type, but without deleting the job - $title = Title::makeTitleSafe( $row->job_namespace, $row->job_title); - $refreshjob = Job::factory( $row->job_cmd, $title, Job::extractBlob( $row->job_params ), $row->job_id ); - } else { - $refreshjob = NULL; - } + $dbr =& wfGetDB( DB_SLAVE ); + $row = $dbr->selectRow( 'job', '*', array( 'job_cmd' => 'SMWRefreshJob' ), __METHOD__ ); + if ($row !== false) { // similar to Job::pop_type, but without deleting the job + $title = Title::makeTitleSafe( $row->job_namespace, $row->job_title); + $refreshjob = Job::factory( $row->job_cmd, $title, Job::extractBlob( $row->job_params ), $row->job_id ); + } else { + $refreshjob = NULL; } / Execute actions if any / @@ -132,26 +130,28 @@ '' . '' . "\n"; - if ($smwgAdminRefreshStore) { - $html .= 'Repair and Upgrade' . "\n" . - 'It is possible to restore all SMW data based on the current contents of the wiki. This can be useful to repair broken data or to refresh the data if the internal format has changed due to some software upgrade. The update is executed page by page and will not be completed immediately. The following control shows if an update is in progress and allows you to start or stop upates.' . - ''; - if ($refreshjob !== NULL) { - $prog = $refreshjob->getProgress(); - $html .= "An update is already in progress. It is normal that the update progresses only slowly since it only refreshes data in small chunks each time a user accesses the wiki. To finish this update more quickly, you can invoke the MediaWiki maintenance script runJobs.php (use the option --maxjobs 2000 to restrict the number of updates done at once). Estimated progress of current update: " . - ' ' . round($prog*100,4) . '%' . - '' . - ' ' . - ' Yes, I am sure. ' . - '' . "\n"; - } else { + $html .= 'Repair and Upgrade' . "\n" . + 'It is possible to restore all SMW data based on the current contents of the wiki. This can be useful to repair broken data or to refresh the data if the internal format has changed due to some software upgrade. The update is executed page by page and will not be completed immediately. The following shows if an update is in progress and allows you to start or stop upates (unless this feature was disabled by the site administrator).'; + if ($refreshjob !== NULL) { + $prog = $refreshjob->getProgress(); + $html .= "An update is already in progress. It is normal that the update progresses only slowly since it only refreshes data in small chunks each time a user accesses the wiki. To finish this update more quickly, you can in
[MediaWiki-CVS] SVN: [43715] trunk/extensions/SemanticMediaWiki
Revision: 43715 Author: mkroetzsch Date: 2008-11-19 14:16:28 + (Wed, 19 Nov 2008) Log Message: --- Support for complete refresh via web interface (multiple runs), simplified refresh script using new methods Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_RefreshJob.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_TestStore.php trunk/extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php Modified: trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_RefreshJob.php === --- trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_RefreshJob.php 2008-11-19 14:13:01 UTC (rev 43714) +++ trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_RefreshJob.php 2008-11-19 14:16:28 UTC (rev 43715) @@ -20,7 +20,14 @@ */ class SMWRefreshJob extends Job { - function __construct($title, $params = array('spos'=>1, 'prog'=>0) ) { + /** +* The parameters optionally specified in the second argument of this constructor +* use the following array keys: 'spos' (start index, default 1), 'prog' (progress +* indicator, default 0), 'rc' (number of runs to be done, default 1). If more than +* one run is done, then the first run will restrict to properties and types. +* The progress indication refers to the current run, not to the overall job. +*/ + function __construct($title, $params = array('spos'=>1, 'prog'=>0, 'rc'=>1) ) { parent::__construct( 'SMWRefreshJob', $title, $params); } @@ -34,13 +41,18 @@ return true; wfProfileOut('SMWRefreshJob::run (SMW)'); } + $run = array_key_exists('run',$this->params)?$this->params['run']:1; $spos = $this->params['spos']; $store = smwfGetStore(); - $progress = smwfGetStore()->refreshData($spos, 20); + $namespaces = (($this->params['rc'] > 1)&&($run==1))?array(SMW_NS_PROPERTY, SMW_NS_TYPE):false; + $progress = smwfGetStore()->refreshData($spos, 20, $namespaces); if ($spos > 0) { - $nextjob = new SMWRefreshJob($this->title, array('spos' => $spos, 'prog' => $progress)); + $nextjob = new SMWRefreshJob($this->title, array('spos' => $spos, 'prog' => $progress, 'rc'=>$this->params['rc'], 'run'=>$run)); $nextjob->insert(); + } elseif ($this->params['rc'] > $run) { // do another run from the beginning + $nextjob = new SMWRefreshJob($this->title, array('spos'=>1, 'prog'=>0, 'rc'=>$this->params['rc'], 'run'=>$run+1)); + $nextjob->insert(); } wfProfileOut('SMWRefreshJob::run (SMW)'); return true; @@ -51,6 +63,8 @@ * The progress refers to the state before processing this job. */ public function getProgress() { - return array_key_exists('prog',$this->params)?$this->params['prog']:0; + $prog = array_key_exists('prog',$this->params)?$this->params['prog']:0; + $run = array_key_exists('run',$this->params)?$this->params['run']:1; + return ($run-1+$prog)/$this->params['rc']; } } Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php === --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2008-11-19 14:13:01 UTC (rev 43714) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2008-11-19 14:16:28 UTC (rev 43715) @@ -1202,7 +1202,7 @@ return true; } - public function refreshData(&$index, $count) { + public function refreshData(&$index, $count, $namespaces = false, $usejobs = true) { $updatejobs = array(); $emptyrange = true; // was nothing found in this run? @@ -1213,8 +1213,10 @@ } $titles = Title::newFromIDs($tids); foreach ($titles as $title) { -
[MediaWiki-CVS] SVN: [43716] trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/ SMW_SpecialSMWAdmin.php
Revision: 43716 Author: mkroetzsch Date: 2008-11-19 14:32:13 + (Wed, 19 Nov 2008) Log Message: --- fixes in HTML Modified Paths: -- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php Modified: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php === --- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 14:16:28 UTC (rev 43715) +++ trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 14:32:13 UTC (rev 43716) @@ -108,21 +108,21 @@ // creating tables and converting contents from older versions $html .= '' . "\n" . '' . "\n"; - $html .= 'Preparing database for Semantic MediaWiki' . "\n" . + $html .= 'Database Installation and Upgrade' . "\n" . 'Semantic MediaWiki requires some extensions to the MediaWiki database in order to store the semantic data. The below function ensures that your database is set up properly. The changes made in this step do not affect the rest of the MediaWiki database, and can easily be undone if desired. This setup function can be executed multiple times without doing any harm, but it is needed only once on - installation or upgrade.' . "\n"; + installation or upgrade.' . "\n"; $html .= 'If the operation fails with SQL errors, the database user employed by your wiki (check your LocalSettings.php) probably does not have sufficient permissions. Either grant this user additional persmissions to create and delete - tables, temporarily enter the login of your database root in LocalSettings.php, or use the maintenance script SMW_setup.php which can use the credentials of AdminSettings.php.' . + tables, temporarily enter the login of your database root in LocalSettings.php, or use the maintenance script SMW_setup.php which can use the credentials of AdminSettings.php.' . "\n" . '' . '' . "\n"; - $html .= 'Announce your wiki' . "\n" . + $html .= 'Announce Your Wiki' . "\n" . 'SMW has a web service for announcing new semantic wiki sites. This is used to maintain a list of public sites that use SMW, mainly to help the http://semantic-mediawiki.org/wiki/SMW_Project";>SMW project to get an overview of typical uses of SMW. See the SMW homepage for http://semantic-mediawiki.org/wiki/Registry";>further information about this service.' . 'Press the following button to submit your wiki URL to that service. The service will not register wikis that are not publicly accessible, and it will only store publicly accessible information. http://semantic-mediawiki.org/wiki/Special:SMWRegistry"; method="GET">' . @@ -130,11 +130,11 @@ '' . '' . "\n"; - $html .= 'Repair and Upgrade' . "\n" . + $html .= 'Data Repair and Upgrade' . "\n" . 'It is possible to restore all SMW data based on the current contents of the wiki. This can be useful to repair broken data or to refresh the data if the internal format has changed due to some software upgrade. The update is executed page by page and will not be completed immediately. The following shows if an update is in progress and allows you to start or stop upates (unless this feature was disabled by the site administrator).'; if ($refreshjob !== NULL) { $prog = $refreshjob->getProgress(); - $html .= "An update is already in progress. It is normal that the update progresses only slowly since it only refreshes data in small chunks each time a user accesses the wiki. To finish this update more quickly, you can invoke the MediaWiki maintenance script runJobs.php (use the option --maxjobs 2000 to restrict the number of updates done at once). Estimated progress of current update: " . + $html .= "An update is
[MediaWiki-CVS] SVN: [43717] trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob .php
Revision: 43717 Author: mkroetzsch Date: 2008-11-19 14:35:43 + (Wed, 19 Nov 2008) Log Message: --- clarified error message Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php Modified: trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php === --- trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php 2008-11-19 14:32:13 UTC (rev 43716) +++ trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php 2008-11-19 14:35:43 UTC (rev 43717) @@ -50,7 +50,7 @@ $revision = Revision::newFromTitle( $this->title ); if ( !$revision ) { - $this->error = 'SMWUpdateJob: Article not found "' . $this->title->getPrefixedDBkey() . '"'; + $this->error = 'SMWUpdateJob: Page exists but no revision was found "' . $this->title->getPrefixedDBkey() . '"'; wfProfileOut('SMWUpdateJob::run (SMW)'); return false; } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43718] trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob .php
Revision: 43718 Author: mkroetzsch Date: 2008-11-19 14:39:05 + (Wed, 19 Nov 2008) Log Message: --- typo Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php Modified: trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php === --- trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php 2008-11-19 14:35:43 UTC (rev 43717) +++ trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php 2008-11-19 14:39:05 UTC (rev 43718) @@ -50,7 +50,7 @@ $revision = Revision::newFromTitle( $this->title ); if ( !$revision ) { - $this->error = 'SMWUpdateJob: Page exists but no revision was found "' . $this->title->getPrefixedDBkey() . '"'; + $this->error = 'SMWUpdateJob: Page exists but no revision was found for "' . $this->title->getPrefixedDBkey() . '"'; wfProfileOut('SMWUpdateJob::run (SMW)'); return false; } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43723] trunk/extensions/SemanticMediaWiki/includes
Revision: 43723 Author: mkroetzsch Date: 2008-11-19 15:51:15 + (Wed, 19 Nov 2008) Log Message: --- removed deprecated methods that were announced to vanish in SMW 1.4 (deprecated since at least SMW 1.2) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php 2008-11-19 15:47:05 UTC (rev 43722) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php 2008-11-19 15:51:15 UTC (rev 43723) @@ -308,30 +308,4 @@ return ($this->mInline && $results->hasFurtherResults() && ($this->mSearchlabel !== '')); } - - /** -* @deprecated Use SMWResultPrinter::getResult() in SMW >1.0. This method will last be available in SMW 1.3 and vanish thereafter. -*/ - public function getResultHTML($results, $params) { - return $this->getResult($results,$params,SMW_OUTPUT_HTML); - } - - /** -* Return HTML version of serialised results. -* @deprecated Use SMWResultPrinter::getResultText() since SMW >1.0. This method will last be available in SMW 1.3 and vanish thereafter. -*/ - protected function getHTML($res) { - return $this->getResultText($res,SMW_OUTPUT_HTML); - } - - /** -* Generate a link to further results of the given query, using syntactic encoding -* as appropriate for $outputmode. -* @deprecated Since SMW>1.1 this function no longer does anything interesting. Intelligence moved to SMWInfolink. Directly use the code of this method instead of calling it! This method will last be available in SMW 1.3 and vanish thereafter. -*/ - protected function getFurtherResultsLink($outputmode, $res, $label) { - $link = $res->getQueryLink($label); - return $link->getText($outputmode,$this->mLinker); - } - } Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php === --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php 2008-11-19 15:47:05 UTC (rev 43722) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php 2008-11-19 15:51:15 UTC (rev 43723) @@ -172,73 +172,6 @@ return $result; } - - /** -* Return URL of a page that displays those search results -* (and enables browsing results, and is accessible even without -* JavaScript enabled browsers). -* @deprecated Use SMWQueryResult::getQueryLink() in SMW >1.1. This method will last be available in SMW 1.3 and vanish thereafter. -*/ - public function getQueryURL() { - $title = Title::makeTitle(NS_SPECIAL, 'ask'); - $params['query'] = $this->m_querystring; - if ( count($this->m_query->sortkeys)>0 ) { - $psort = ''; - $porder = ''; - $first = true; - foreach ( $this->m_query->sortkeys as $sortkey => $order ) { - if ( $first ) { - $first = false; - } else { - $psort .= ','; - $porder .= ','; - } - $psort .= $sortkey; - $porder .= $order; - } - $params['sort'] = $psort; - $params['order'] = $porder; - } - return $title->getFullURL(SMWInfolink::encodeParameters($params,false)); - } - - /** -* Return titlestring of a page that displays those search results -* (and enables browsing results, and is accessible even without -* JavaScript enabled browsers). -* @deprecated use SMWQueryResult::getQueryLink() in SMW >1.1. This method will last be available in SMW 1.3 and vanish thereafter. -*/ - public function getQueryTitle($prefixed = true) { - if ($prefixed) { - $title = Title::makeTitle(NS_SPECIAL, 'ask'); - $titlestring = ':' . $title->getPrefixedText() . '/'; - } else { // useful for further processing - $titlestring = ''; - } -
[MediaWiki-CVS] SVN: [43725] trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/ SMW_SpecialSMWAdmin.php
Revision: 43725 Author: mkroetzsch Date: 2008-11-19 16:32:59 + (Wed, 19 Nov 2008) Log Message: --- make it more obvious where to find the progress bar for the refresh operation Modified Paths: -- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php Modified: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php === --- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 15:53:43 UTC (rev 43724) +++ trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-19 16:32:59 UTC (rev 43725) @@ -85,7 +85,8 @@ $title = Title::makeTitle(NS_SPECIAL, 'SMWAdmin'); $newjob = new SMWRefreshJob($title, array('spos'=>1, 'prog'=>0, 'rc'=>2)); $newjob->insert(); - $wgOut->addHTML("A new update process for refreshing the semantic data was started. All stored data will be rebuilt or repaired where needed. You can follow the progress of the update on this special page."); + $returntitle = Title::makeTitle(NS_SPECIAL, 'SMWAdmin'); + $wgOut->addHTML("A new update process for refreshing the semantic data was started. All stored data will be rebuilt or repaired where needed. Return to getFullURL()) . '">Special:SMWAdmin to follow the progress of this operation.'); } else { $wgOut->addHTML("There is already an update process running. Not creating another one."); } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43726] trunk/extensions/SemanticMediaWiki/maintenance/SMW_pingSemWeb. php
Revision: 43726 Author: mkroetzsch Date: 2008-11-19 16:39:40 + (Wed, 19 Nov 2008) Log Message: --- Removed maintenance script; the new Registry service really obsoletes this script. Removed Paths: - trunk/extensions/SemanticMediaWiki/maintenance/SMW_pingSemWeb.php Deleted: trunk/extensions/SemanticMediaWiki/maintenance/SMW_pingSemWeb.php === --- trunk/extensions/SemanticMediaWiki/maintenance/SMW_pingSemWeb.php 2008-11-19 16:32:59 UTC (rev 43725) +++ trunk/extensions/SemanticMediaWiki/maintenance/SMW_pingSemWeb.php 2008-11-19 16:39:40 UTC (rev 43726) @@ -1,147 +0,0 @@ -http://pingthesemanticweb.com. - * See http://pingthesemanticweb.com/about.php for the rational behind this. - * This script may be extended to other such services if desired. - * - * Note: if SMW is not installed in its standard path under ./extensions - * then the MW_INSTALL_PATH environment variable must be set. - * See README in the maintenance directory. - * - * Usage: - * php SMW_pingSemWeb.php [options...] - * - * -t What sites to notify, comma-separated list with possible values: - *ptsw -- http://pingthesemanticweb.com - *sind -- http://www.sindice.com - * -dWait for this many milliseconds after processing an article, useful for limiting server load. - * -s Start refreshing at given article ID, useful for partial refreshing - * -eStop refreshing at given article ID, useful for partial refreshing - * -q Be quite (no output). - * -h Define the server (without sub-path, e.g. "http://example.org"; even for "http://example.org/wiki"; - * Use "-" for reusing the server name given to "enableSemantics()" when loading SMW. If omitted, - * the value of $wgServer is used, though this may be localhost in many cases. - * - * @author Markus Krötzsch - * @todo It should be possible to ping based on pages' modification dates. - * @file - * @ingroup SMWMaintenance - */ - -$optionsWithArgs = array( 'd', 's', 'e', 'h', 't' ); // -d , -s , -e - -require_once ( getenv('MW_INSTALL_PATH') !== false -? getenv('MW_INSTALL_PATH')."/maintenance/commandLine.inc" -: dirname( __FILE__ ) . '/../../../maintenance/commandLine.inc' ); - -global $smwgIP, $wgServer; -include_once($smwgIP . '/includes/SMW_Infolink.php'); - -$dbr =& wfGetDB( DB_MASTER ); - -if ( array_key_exists( 't', $options ) ) { - $sites = explode(',',$options['t']); - $site_ptsw = false; - $site_sind = false; - foreach ($sites as $site) { - switch ($site) { - case 'ptsw': $site_ptsw = true; print "Notifying pingthesemanticweb.com. \n"; break; - case 'sind': $site_sind = true; print "Notifying www.sindice.com. \n"; break; - default: print "Unknown site parameter '$site'. Possible values are listed in the docu in this script.\n"; - } - } -} else { - print "No sites selected. Notifying all available sites!\n"; -} - -if ( array_key_exists( 'd', $options ) ) { - $delay = intval($options['d']) * 10; // sleep 100 times the given time, but do so only each 100 pages -} else { - $delay = false; -} - -if ( array_key_exists( 's', $options ) ) { - $start = intval($options['s']); -} else { - $start = 0; -} -$end = $dbr->selectField( 'page', 'max(page_id)', false, 'SMW_refreshData' ); -if ( array_key_exists( 'e', $options ) ) { - $end = min(intval($options['e']), $end); -} - -if ( array_key_exists( 'q', $options ) ) { - $verbose = false; -} else { - $verbose = true; -} - -if ( array_key_exists( 'h', $options ) ) { - $server = $options['h']; -} else { - $server = $wgServer; -} - -if ( ($server == 'http://localhost') || ($server == '') || ($server == '-') ) { - global $smwgNamespace; - $server = $smwgNamespace; - if ($server[0] == '.') { - $resolver = Title::makeTitle( NS_SPECIAL, 'URIResolver'); - $server = "http://"; . mb_substr($server, 1); - } - if ($verbose) print "Trying to construct wiki URLs with server parameter given to SMW:\n $server\nAlternatively, you can specify a publicly reachable server via the parameter -h of this script.\n\n"; -} - -$linkCache =& LinkCache::singleton(); -global $wgUser; - -if ($verbose) { - print "Notifying selected sites of all semantic data in this wiki!\n\n&quo
[MediaWiki-CVS] SVN: [43728] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43728 Author: mkroetzsch Date: 2008-11-19 17:50:49 + (Wed, 19 Nov 2008) Log Message: --- improved printout code Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-19 17:01:06 UTC (rev 43727) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-19 17:50:49 UTC (rev 43728) @@ -294,9 +294,18 @@ protected function makePrintoutValue() { global $smwgContLang; if ($this->m_printvalue === false) { - if($this->m_timeisset || !(!$this->m_timeisset && $this->m_time=="00:00:00")) $time = $this->m_time; - if((int)$this->m_day>0) $day = (int)$this->m_day; - $this->m_printvalue = $day." ".$smwgContLang->getMonthLabel($this->m_month)." ".$this->m_year." ".$time; //MediaWiki date function is not applicable any more (no support for BC Dates...) + if ($this->m_timeisset || !(!$this->m_timeisset && $this->m_time=="00:00:00")) { + $time = ' ' . $this->m_time; + } else { + $time = ''; + } + if ((int)$this->m_day>0) { + $day = (int)$this->m_day . ' '; + } else { + $day = ''; + } + //MediaWiki date function is not applicable any more (no support for BC Dates) + $this->m_printvalue = $day . $smwgContLang->getMonthLabel($this->m_month) . " " . $this->m_year . $time; } } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43729] trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter. php
Revision: 43729 Author: mkroetzsch Date: 2008-11-19 17:52:53 + (Wed, 19 Nov 2008) Log Message: --- use public variable for max recursion depth for templates that appear in queries, so admins can change it if they really want to Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php 2008-11-19 17:50:49 UTC (rev 43728) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php 2008-11-19 17:52:53 UTC (rev 43729) @@ -55,9 +55,12 @@ * parameter for further parser functions. Use only if required. */ protected $hasTemplates = false; + /// Incremented while expanding templates inserted during printout; stop expansion at some point + private static $mRecursionDepth = 0; + /// This public variable can be set to higher values to allow more recursion; do this at your own risk! + /// This can be set in LocalSettings.php, but only after enableSemantics(). + public static $maxRecursionDepth = 2; - private static $mRecursionDepth = 0; // increment while expanding templates inserted during printout; stop expansion at some point - /** * Constructor. The parameter $format is a format string * that may influence the processing details. @@ -92,7 +95,9 @@ * and wiki text is requested, then we may return wiki text with sub-queries to the caller. If the * caller parses this (which is likely) then this will again call us in parse-context and all recursion * checks catch. Only the first level of parsing is done outside and thus not counted. Thus you -* effectively can get down to level 3. +* effectively can get down to level 3. The basic maximal depth of 2 can be changed by setting the +* variable SMWResultPrinter::$maxRecursionDepth (in LocalSettings.php, after enableSemantics()). +* Do this at your own risk. */ public function getResult($results, $params, $outputmode) { global $wgParser; @@ -132,7 +137,7 @@ if ( (!$this->isHTML) && ($this->hasTemplates) ) { // preprocess embedded templates if needed if ( ($wgParser->getTitle() instanceof Title) && ($wgParser->getOptions() instanceof ParserOptions) ) { SMWResultPrinter::$mRecursionDepth++; - if (SMWResultPrinter::$mRecursionDepth <= 2) { // restrict recursion + if (SMWResultPrinter::$mRecursionDepth <= SMWResultPrinter::$maxRecursionDepth) { // restrict recursion $result = '[[SMW::off]]' . $wgParser->replaceVariables($result) . '[[SMW::on]]'; } else { $result = ''; /// TODO: explain problem (too much recursive parses) @@ -148,7 +153,7 @@ } elseif ( (!$this->isHTML) && ($outputmode == SMW_OUTPUT_HTML) ) { SMWResultPrinter::$mRecursionDepth++; // check whether we are in an existing parse, or if we should start a new parse for $wgTitle - if (SMWResultPrinter::$mRecursionDepth <= 2) { // retrict recursion + if (SMWResultPrinter::$mRecursionDepth <= SMWResultPrinter::$maxRecursionDepth) { // retrict recursion if ( ($wgParser->getTitle() instanceof Title) && ($wgParser->getOptions() instanceof ParserOptions) ) { $result = $wgParser->recursiveTagParse($result); } else { ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43732] trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline. php
Revision: 43732 Author: mkroetzsch Date: 2008-11-19 18:18:27 + (Wed, 19 Nov 2008) Log Message: --- stop using deprecated methods Modified Paths: -- trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php Modified: trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php === --- trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php 2008-11-19 18:16:35 UTC (rev 43731) +++ trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php 2008-11-19 18:18:27 UTC (rev 43732) @@ -57,10 +57,10 @@ foreach ($res->getPrintRequests() as $pr) { if ( ($pr->getMode() == SMWPrintRequest::PRINT_PROP) && ($pr->getTypeID() == '_dat') ) { if ( ($this->m_tlend == '') && ($this->m_tlstart != '') && -($this->m_tlstart != $pr->getTitle()->getDBkey()) ) { - $this->m_tlend = $pr->getTitle()->getDBkey(); - } elseif ( ($this->m_tlstart == '') && ($this->m_tlend != $pr->getTitle()->getDBkey()) ) { - $this->m_tlstart = $pr->getTitle()->getDBkey(); +($this->m_tlstart != $pr->getData()->getXSDValue()) ) { + $this->m_tlend = $pr->getData()->getXSDValue(); + } elseif ( ($this->m_tlstart == '') && ($this->m_tlend != $pr->getData()->getXSDValue()) ) { + $this->m_tlstart = $pr->getData()->getXSDValue(); } } } @@ -68,8 +68,9 @@ wfLoadExtensionMessages('SemanticMediaWiki'); // print header + $link = $res->getQueryLink(wfMsgForContent('smw_iq_altresults')); $result = "m_tlsize\">"; - $result .= '' . wfMsgForContent('smw_iq_nojs') . ' ' . $this->getFurtherResultsLink($outputmode,$res,wfMsgForContent('smw_iq_altresults')). ''; // note for people without JavaScript + $result .= '' . wfMsgForContent('smw_iq_nojs') . ' ' . $link->getText($outputmode,$this->mLinker) . ''; // note for people without JavaScript foreach ($this->m_tlbands as $band) { $result .= '' . htmlspecialchars($band) . ''; @@ -111,7 +112,7 @@ } // is this a start date? if ( ($pr->getMode() == SMWPrintRequest::PRINT_PROP) && - ($pr->getTitle()->getDBkey() == $this->m_tlstart) ) { + ($pr->getData()->getXSDValue() == $this->m_tlstart) ) { //FIXME: Timeline scripts should support XSD format explicitly. They //currently seem to implement iso8601 which deviates from XSD in cases. //NOTE: We can assume $object to be an SMWDataValue in this case. @@ -121,7 +122,7 @@ } // is this the end date? if ( ($pr->getMode() == SMWPrintRequest::PRINT_PROP) && - ($pr->getTitle()->getDBkey() == $this->m_tlend) ) { + ($pr->getData()->getXSDValue() == $this->m_tlend) ) { //NOTE: We can assume $object to be an SMWDataValue in this case. $curmeta .= '' . $object->getXSDValue() . ''; } @@ -143,7 +144,7 @@ $curdata .= $header . $objectlabel; $output = true; } -
[MediaWiki-CVS] SVN: [43739] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43739 Author: mkroetzsch Date: 2008-11-19 19:23:35 + (Wed, 19 Nov 2008) Log Message: --- +convenience methods to access date parts Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-19 18:59:21 UTC (rev 43738) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-19 19:23:35 UTC (rev 43739) @@ -288,13 +288,44 @@ } /** +* Return the year as a number or false if the value is not set. +*/ + public function getYear() { + return ($this->isValid())?$this->m_year:false; + } + + /** +* Return the month as a number (between 1 and 12) or false if the value is not set. +*/ + public function getMonth() { + return ($this->isValid())?$this->m_month:false; + } + + /** +* Return the day as a number or false if the value is not set. +*/ + public function getDay() { + return ($this->isValid())?$this->m_day:false; + } + + /** +* Return the time as a string or false if the value is not set. +* The time string has the format HH:MM:SS, without any timezone +* information. +*/ + public function getTimeString() { + return ($this->isValid())?$this->m_times:false; + } + + + /** * Build a preferred value for printout, also used as a caption when setting up values * from the store. */ protected function makePrintoutValue() { global $smwgContLang; if ($this->m_printvalue === false) { - if ($this->m_timeisset || !(!$this->m_timeisset && $this->m_time=="00:00:00")) { + if ($this->m_timeisset || ($this->m_time!="00:00:00")) { $time = ' ' . $this->m_time; } else { $time = ''; ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43769] trunk/extensions/SemanticMediaWiki
Revision: 43769 Author: mkroetzsch Date: 2008-11-20 19:52:24 + (Thu, 20 Nov 2008) Log Message: --- various fixes in Type:Date, support incomplete dates Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-20 19:05:50 UTC (rev 43768) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-20 19:52:24 UTC (rev 43769) @@ -25,15 +25,15 @@ protected $m_wikivalue; // a suitable wiki input value protected $m_xsdvalue = false; // cache for XSD value protected $m_printvalue = false; // cache for printout value - protected $m_day = false; //Gregorian day - protected $m_month = false; //Gregorian month - protected $m_year = false; //Gregorian year - protected $m_time = "00:00:00"; //time + protected $m_day = false; //Gregorian day, remains false if unspecified + protected $m_month = false; //Gregorian month, remains false if unspecified + protected $m_year = false; //Gregorian year, remains false if unspecified + protected $m_time = false; //time, remains false if unspecified protected $m_jdn = ''; //numerical time representation similiar to Julian Day Number protected $m_timeoffset; //contains offset (e.g. timezone) protected $m_timeannotation; //contains am or pm - protected $m_timeisset; protected $m_yearbc; //true if year is BC + // The following are constant (array-valued constants are not supported, hence the decalration as variable): protected $m_months = array("January", "February", "March", "April" , "May" , "June" , "Juli" , "August" , "September" , "October" , "November" , "December"); protected $m_monthsshort = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); protected $m_formats = array( SMW_Y => array('year'), SMW_YM => array('year','month'), SMW_MY => array('month','year'), SMW_YDM => array('year','day','month'), SMW_YMD => array('year','month','day'), SMW_DMY => array('day','month','year'), SMW_MDY => array('month','day','year')); @@ -43,22 +43,21 @@ global $smwgContLang; $band = false; //group of bits storing information about the possible meaning of each digit of the entered date - $this->m_day = false; + $this->m_day = false; $this->m_month = false; $this->m_year = false; $this->m_jdn = false; - $this->m_time = "00:00:00"; + $this->m_time = false; $this->m_timeoffset = 0; $this->m_timepm = false; - $this->m_timeisset = false; $this->m_timeannotation = false; - + $this->m_wikivalue = $value; $filteredvalue = $value; //value without time definition and further abbreviations like PM or BC //browse string for special abbreviations referring to time like am, pm if(preg_match("/([Aa]|[Pp])[Mm]/u", $filteredvalue, $match)){ - $this->m_timeannotation = strtolower($match[0]); + $this->m_timeannotation = strtolower($match[0]); $regexp = "/(\040|T){0,1}".str_replace("+", "\+", $match[0])."(\040){0,1}/u"; //delete pm/am, preceding and following chars $filteredvalue = preg_replace($regexp,'', $filteredvalue); //value without am/pm } @@ -75,8 +74,7 @@ //browse string for time value if(preg_match("/[0-2]?[0-9]:[0-5][0-9](:[0-5][0-9])?([+\-][0-2]?[0-9](:(30|00))?)?/u", $filteredvalue, $match)){ $time = $match[0]; - $this->m_timeisset = true; - + //timezone handling if(preg_match("/([+\-][0-2]?[0-9](:(30|00))?)/u", $time, $match2)){ //get timezone definition $offset = $this->normalizeTimeValue($match2[0]); @@ -98,7 +96,7 @@
[MediaWiki-CVS] SVN: [43774] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43774 Author: mkroetzsch Date: 2008-11-20 20:58:33 + (Thu, 20 Nov 2008) Log Message: --- Exgtended support for querying date components, support for XML Schema/ISO conformant formatting Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-20 20:50:12 UTC (rev 43773) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-20 20:58:33 UTC (rev 43774) @@ -269,13 +269,10 @@ public function getExportData() { if ($this->isValid()) { - if(!$this->m_day) $this->m_day = 1; //if day is not set assume 1 - if(!$this->m_month) $this->m_month = 1; //if month is not set assume 1 - $xml = $this->m_year.'-'.$this->normalizeValue((int)$this->m_month).'-'.$this->normalizeValue((int)$this->m_day).'T'.$this->normalizeTimeValue($this->normalizeValue((int)$this->m_time)); - $lit = new SMWExpLiteral($xml, $this, 'http://www.w3.org/2001/XMLSchema#dateTime'); - return new SMWExpData($lit); + $lit = new SMWExpLiteral($this->getXMLSchemaDate(), $this, 'http://www.w3.org/2001/XMLSchema#dateTime'); + return new SMWExpData($lit); } else { - return NULL; + return NULL; } } @@ -288,27 +285,61 @@ /** * Return the month as a number (between 1 and 12) or false if the value is not set. +* The parameter $default optionally specifies the value returned +* if the date is valid but has no explicitly specified month. It can +* also be set to FALSE to detect this situation. */ - public function getMonth() { - return ($this->isValid())?$this->m_month:false; + public function getMonth($default = 1) { + if (!$this->isValid()) return false; + return ($this->m_month != false)?$this->m_month:$default; } /** * Return the day as a number or false if the value is not set. +* The parameter $default optionally specifies the value returned +* if the date is valid but has no explicitly specified date. It can +* also be set to FALSE to detect this situation. */ - public function getDay() { - return ($this->isValid())?$this->m_day:false; + public function getDay($default = 1) { + if (!$this->isValid()) return false; + return ($this->m_day != false)?$this->m_day:$default; } /** * Return the time as a string or false if the value is not set. * The time string has the format HH:MM:SS, without any timezone * information. +* The parameter $default optionally specifies the value returned +* if the date is valid but has no explicitly specified time. It can +* also be set to FALSE to detect this situation. */ - public function getTimeString() { - return ($this->isValid())?$this->m_times:false; + public function getTimeString($default = '00:00:00') { + if (!$this->isValid()) return false; + return ($this->m_time != false)?$this->normalizeTimeValue($this->m_time):$default; } + /** +* Return a representation of this date in canonical dateTime format without timezone, as +* specified in XML Schema Part 2: Datatypes Second Edition (W3C Recommendation, 28 October 2004, +* http://www.w3.org/TR/xmlschema-2). An example would be "2008-01-02T14:30:10". BC(E) years +* are represented by a leading "-" as in "-123-01-02T14:30:10", the 2nd January of the year +* 123 BC(E) at 2:30pm and 10 seconds. +* +* If the date was not fully specified, then the function will use defaults for the omitted values. +* The boolean parameter $mindefault controls if those defaults are chosen minimally. If false, then +* the latest possible value will be chosen instead. +*/ + public function getXMLSchemaDate($mindefault = true) { + if ($this->isValid()) { + if ($mindefault) { + return $this->m_year.'-'.$this->normalizeValue($this->getMonth()).'-'.$this->normalizeValue($this->getDay()).'T'.$this->getTimeString(); + } else { + return
[MediaWiki-CVS] SVN: [43776] trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline. php
Revision: 43776 Author: mkroetzsch Date: 2008-11-20 20:59:26 + (Thu, 20 Nov 2008) Log Message: --- Use new API to get XML Schema conformant date instead of internal DB representation; smarter completion of end dates Modified Paths: -- trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php Modified: trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php === --- trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php 2008-11-20 20:58:51 UTC (rev 43775) +++ trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php 2008-11-20 20:59:26 UTC (rev 43776) @@ -116,15 +116,15 @@ //FIXME: Timeline scripts should support XSD format explicitly. They //currently seem to implement iso8601 which deviates from XSD in cases. //NOTE: We can assume $object to be an SMWDataValue in this case. - $curmeta .= '' . $object->getXSDValue() . ''; - $positions[$object->getNumericValue()] = $object->getXSDValue(); + $curmeta .= '' . $object->getXMLSchemaDate() . ''; + $positions[$object->getNumericValue()] = $object->getXMLSchemaDate(); $hastime = true; } // is this the end date? if ( ($pr->getMode() == SMWPrintRequest::PRINT_PROP) && ($pr->getData()->getXSDValue() == $this->m_tlend) ) { //NOTE: We can assume $object to be an SMWDataValue in this case. - $curmeta .= '' . $object->getXSDValue() . ''; + $curmeta .= '' . $object->getXMLSchemaDate(false) . ''; } // find title for displaying event if ( !$hastitle ) { @@ -145,7 +145,7 @@ $output = true; } if ($eventline && ($pr->getMode() == SMWPrintRequest::PRINT_PROP) && ($pr->getTypeID() == '_dat') && ('' != $pr->getLabel()) && ($pr->getData()->getXSDValue() != $this->m_tlstart) && ($pr->getData()->getXSDValue() != $this->m_tlend) ) { - $events[] = array($object->getXSDValue(), $pr->getLabel(), $object->getNumericValue()); + $events[] = array($object->getXMLSchemaDate(), $pr->getLabel(), $object->getNumericValue()); } $first_value = false; } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43777] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43777 Author: mkroetzsch Date: 2008-11-20 21:09:08 + (Thu, 20 Nov 2008) Log Message: --- use getFunctions for accessing date components to get defaults (variables might be FALSE if unspecified) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-20 20:59:26 UTC (rev 43776) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-20 21:09:08 UTC (rev 43777) @@ -376,21 +376,21 @@ //otherwise is the number of years BC and represents the elapsed days of the year as fraction of 1 protected function createJDN(){ $this->m_jdn = 0; - if($this->m_year >= -4713){ - $a = intval((14-$this->m_month)/12); + if($this->m_year >= -4713){ + $a = intval((14-$this->getMonth())/12); $y = $this->m_year + 4800 - $a; - $m = $this->m_month + 12 * $a - 3; + $m = $this->getMonth() + 12 * $a - 3; - if($this->m_time != false){//just calculate fraction if time is set - list ($hours, $minutes, $seconds) = explode(':',$this->m_time,3); + if($this->m_time != false) {//just calculate fraction if time is set + list ($hours, $minutes, $seconds) = explode(':',$this->getTimeString(),3); $time = ($hours/24) + ($minutes / (60*24)) + ($seconds / (3600*24)); $this->m_jdn += $time; } - $this->m_jdn += $this->m_day + intval((153*$m+2)/5) + 365*$y + intval($y/4) - intval($y/100) + intval($y/400) - 32045; + $this->m_jdn += $this->getDay() + intval((153*$m+2)/5) + 365*$y + intval($y/4) - intval($y/100) + intval($y/400) - 32045; } else{ - $time = 1 - (($this->m_month / 12) + ($this->m_day / 365)); + $time = 1 - (($this->getMonth() / 12) + ($this->getDay() / 365)); $this->m_jdn = $this->m_year - $time; } } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43779] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43779 Author: mkroetzsch Date: 2008-11-20 22:09:57 + (Thu, 20 Nov 2008) Log Message: --- Documentation of major features, various fixes, especially in output of BC years Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-20 21:10:27 UTC (rev 43778) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-20 22:09:57 UTC (rev 43779) @@ -5,17 +5,39 @@ */ /** - * This datavalue captures values of dates and times. - * The implementation uses a format similiar to Julian Day Number to represent time values. - * Times internally are stored as XSD-conformant strings, see - * http://www.w3.org/TR/xmlschema-2/#dateTime + * This datavalue captures values of dates and times. All dates and times refer to + * the "local time" of the server (or the wiki). A wiki may define what timezone this + * refers to by common conventions. For export, times are given without timezone + * information. However, time offsets to that local time are supported (see below). * - * This implementation might change in the future. For maximum - * compatibility, use no relative dates ("... + 10 days"), - * no dates referring to current time ("next Tuesday"), no - * weekdays in your values, and use ":" between hours, minutes, - * and seconds (i.e. no "1230" as 12:30). + * It is able to handle dates accross history with full precision for storing, and + * substantial precision for sorting and querying. The range of supported past dates + * should encompass the Beginning of Time according to most of today's theories. The + * range of supported future dates is limited more strictly, but it does also allow + * year numbers in the order of 10^9. * + * Years before common era (aka BC) can be denoted using "BC" in a date. The internal + * nummeric date model supports the year 0, and considers it to be the same as "1 BC". + * The year "0 BC" is accepted to refer to the same year, but its use is discouraged. + * According to this convention, e.g., the year "-100" is the same as "101 BC". This + * convention agrees with ISO 6801 and the remarks in XML Schema Datatypes 2nd Edition, + * (the latter uses a different convention that disallows year 0, but it explicitly + * endorses the ISO convention and announces the future use of this in XML). + * Note that the implementation currently does not support the specification of negative + * year numbers as input; negative numbers are only used internally. + * + * The implementation notices and stores whether parts of a date/time have been + * omitted (as in "2008" or "May 2007"). For all exporting and sorting purposes, + * incomplete dates are completed wiht defaults (usually using the earliest possible + * time, i.e. interpreting "2008" as "Jan 1 2008 00:00:00"). But the information + * on what was unspecified is kept internally for improving behaviour e.g. for + * outputs (defaults are not printed when querying for a value). Functions are + * provided to access the individual time components (getYear, getMonth, getDay, + * getTimeString), and those can also be used to find out what was unspecified. + * + * Time offests are supported (e.g. "1 1 2008 12:00-2:00"). As explained above, those + * refer to the local time. + * * @author Fabian Howahl * @author Markus Krötzsch * @ingroup SMWDataValues @@ -29,10 +51,9 @@ protected $m_month = false; //Gregorian month, remains false if unspecified protected $m_year = false; //Gregorian year, remains false if unspecified protected $m_time = false; //time, remains false if unspecified - protected $m_jdn = ''; //numerical time representation similiar to Julian Day Number + protected $m_jdn = ''; //numerical time representation similiar to Julian Day Number, for ancient times, a more compressed number is used (preserving ordering but not distance of time points) protected $m_timeoffset; //contains offset (e.g. timezone) protected $m_timeannotation; //contains am or pm - protected $m_yearbc; //true if year is BC // The following are constant (array-valued constants are not supported, hence the decalration as variable): protected $m_months = array("January", "February", "March", "April" , "May" , "June" , "Juli" , "August" , "September" , "October" , "November" , "December"); protected $m_monthsshort = array("Jan", "Feb", "Mar", "
[MediaWiki-CVS] SVN: [43780] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43780 Author: mkroetzsch Date: 2008-11-20 22:19:15 + (Thu, 20 Nov 2008) Log Message: --- documented that Julian calendar conversion is not supported yet Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-20 22:09:57 UTC (rev 43779) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-20 22:19:15 UTC (rev 43780) @@ -10,6 +10,12 @@ * refers to by common conventions. For export, times are given without timezone * information. However, time offsets to that local time are supported (see below). * + * There is currently no support for different calendar models or conversion between + * them. All dates are supposed to refer to Georgian calendar (or its extension to + * the past). Attention: this may change in future versions, and historical dates + * may be treated as Julian calendar dates in certain ranges. Consider historical dates + * to be experimental. + * * It is able to handle dates accross history with full precision for storing, and * substantial precision for sorting and querying. The range of supported past dates * should encompass the Beginning of Time according to most of today's theories. The ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43798] trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php
Revision: 43798 Author: mkroetzsch Date: 2008-11-21 07:47:58 + (Fri, 21 Nov 2008) Log Message: --- Remove note that feature is experimental from errors with Type:Date (in as many languages as I dare to modify without understandig a word ;) Modified Paths: -- trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php 2008-11-21 06:46:31 UTC (rev 43797) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php 2008-11-21 07:47:58 UTC (rev 43798) @@ -89,7 +89,7 @@ 'smw_service_online_maps' => " Find online maps|http://tools.wikimedia.de/~magnus/geo/geohack.php?params=\$9_\$7_\$10_\$8\n Google maps|http://maps.google.com/maps?ll=\$11\$9,\$12\$10&spn=0.1,0.1&t=k\n Mapquest|http://www.mapquest.com/maps/map.adp?searchtype=address&formtype=latlong&latlongtype=degrees&latdeg=\$11\$1&latmin=\$3&latsec=\$5&longdeg=\$12\$2&longmin=\$4&longsec=\$6&zoom=6";, // Messages for datetime parsing - 'smw_nodatetime' => 'The date "$1" was not understood (support for dates is still experimental).', + 'smw_nodatetime' => 'The date "$1" was not understood.', // Errors and notices related to queries 'smw_toomanyclosing'=> 'There appear to be too many occurrences of "$1" in the query.', @@ -893,7 +893,7 @@ 'smw_abb_west' => 'Z', 'smw_label_latitude' => 'Zeměpisná šířka:', 'smw_label_longitude' => 'Zeměpisná délka:', - 'smw_nodatetime' => 'Datum "$1" nedává smysl. Podpora datumů je stále experimentální.', + 'smw_nodatetime' => 'Datum "$1" nedává smysl.', 'smw_toomanyclosing' => 'Dotazovaný řetězec „$1“ má příliš mnoho výskytů.', 'smw_noclosingbrackets' => 'Užití „[[” ve vašem dotazu nebylo ukončeno odpovídajícími „]]”.', 'smw_misplacedsymbol' => 'Symbol „$1“ byl užitý na místě, kde nemá význam.', @@ -1056,7 +1056,7 @@ 'smw_abb_west' => 'W', 'smw_label_latitude' => 'Breite:', 'smw_label_longitude' => 'Länge:', - 'smw_nodatetime' => 'Das Datum „$1“ wurde nicht verstanden. Die Unterstützung von Kalenderdaten ist zur Zeit noch experimentell.', + 'smw_nodatetime' => 'Das Datum „$1“ wurde nicht verstanden.', 'smw_toomanyclosing' => 'In der Anfrage kommen zu viele „$1“ vor.', 'smw_noclosingbrackets' => 'Ein Vorkommen von „[[“ in der Anfrage wurde nicht durch ein entsprechendes „]]“ abgeschlossen.', 'smw_misplacedsymbol' => 'Das Symbol „$1“ wurde an einer Stelle verwendet, wo es keinen Sinn macht.', @@ -1208,7 +1208,7 @@ 'smw_abb_west' => 'U', 'smw_label_latitude' => 'Latitudo:', 'smw_label_longitude' => 'Longitudo:', - 'smw_nodatetime' => 'La dato "$1" ne estis komprenita (subteno por datoj ankoraŭ estas eksperimenta).', + 'smw_nodatetime' => 'La dato "$1" ne estis komprenita.', 'smw_badtitle' => 'Bedaŭrinde, "$1" ne estas valida paĝa titolo.', 'smw_propvalueproblem' => 'La valuto de eco "$1" ne estis komprenita.', 'exportrdf' => 'Eksportu paĝojn al RDF', @@ -1293,7 +1293,7 @@ 'smw_abb_west' => 'O', 'smw_label_latitude' => 'Latitud :', 'smw_label_longitude' => 'Longitud :', - 'smw_nodatetime' => 'La fecha "$1" no ha sido comprendida. El soporte de datos de calendario son todavía experimentales.', + 'smw_nodatetime' => 'La fecha "$1" no ha sido comprendida.', 'smw_devel_warning' => 'Esta función está aún en desarrollo y quizá aun no sea operativa. Es quizá recomendable hacer una copia de seguridad del wiki antes de utilizar esta función.', 'smw_type_header' => 'Atributos de tipo “$1”', 'smw_typearticlecount' => 'Mostrando $1 atributos usando este tipo.', @@ -1362,7 +1362,7 @@ 'smw_abb_we
[MediaWiki-CVS] SVN: [43799] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43799 Author: mkroetzsch Date: 2008-11-21 07:56:53 + (Fri, 21 Nov 2008) Log Message: --- create Julian Day Number even when container is not fully initialised, return year/month/day values also if object not valid (yet) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 07:47:58 UTC (rev 43798) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 07:56:53 UTC (rev 43799) @@ -307,44 +307,41 @@ } /** -* Return the year as a number or false if the value is not set. +* Return the year as a number. */ public function getYear() { - return ($this->isValid())?$this->m_year:false; + return $this->m_year; } /** -* Return the month as a number (between 1 and 12) or false if the value is not set. +* Return the month as a number (between 1 and 12). * The parameter $default optionally specifies the value returned * if the date is valid but has no explicitly specified month. It can * also be set to FALSE to detect this situation. */ public function getMonth($default = 1) { - if (!$this->isValid()) return false; return ($this->m_month != false)?$this->m_month:$default; } /** -* Return the day as a number or false if the value is not set. +* Return the day as a number. * The parameter $default optionally specifies the value returned * if the date is valid but has no explicitly specified date. It can * also be set to FALSE to detect this situation. */ public function getDay($default = 1) { - if (!$this->isValid()) return false; return ($this->m_day != false)?$this->m_day:$default; } /** -* Return the time as a string or false if the value is not set. -* The time string has the format HH:MM:SS, without any timezone -* information. +* Return the time as a string. The time string has the format HH:MM:SS, +* without any timezone information (see class documentaion for details +* on current timezone handling). * The parameter $default optionally specifies the value returned * if the date is valid but has no explicitly specified time. It can * also be set to FALSE to detect this situation. */ public function getTimeString($default = '00:00:00') { - if (!$this->isValid()) return false; return ($this->m_time != false)?$this->normalizeTimeValue($this->m_time):$default; } @@ -419,7 +416,6 @@ //otherwise is the number of years BC and represents the elapsed days of the year as fraction of 1 protected function createJDN(){ $this->m_jdn = 0; - if (!$this->isValid()) return; if($this->m_year >= -4713){ $a = intval((14-$this->getMonth())/12); $y = $this->m_year + 4800 - $a; @@ -431,8 +427,7 @@ $this->m_jdn += $time; } $this->m_jdn += $this->getDay() + intval((153*$m+2)/5) + 365*$y + intval($y/4) - intval($y/100) + intval($y/400) - 32045; - } - else { + } else { $time = 1 - (($this->getMonth() / 12) + ($this->getDay() / 365)); $this->m_jdn = $this->m_year - $time; } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43800] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43800 Author: mkroetzsch Date: 2008-11-21 08:34:19 + (Fri, 21 Nov 2008) Log Message: --- fixed Julian Day computation (was still checking historical years instead of astonomical ones); added documentation on Julian Day and our use of the proleptic Georgian calendar. Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 07:56:53 UTC (rev 43799) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 08:34:19 UTC (rev 43800) @@ -12,9 +12,9 @@ * * There is currently no support for different calendar models or conversion between * them. All dates are supposed to refer to Georgian calendar (or its extension to - * the past). Attention: this may change in future versions, and historical dates - * may be treated as Julian calendar dates in certain ranges. Consider historical dates - * to be experimental. + * the past, the proleptic Georgian claendar). Attention: this may change in future + * versions, and historical dates may be treated as Julian calendar dates in certain + * ranges. Consider historical dates to be experimental. * * It is able to handle dates accross history with full precision for storing, and * substantial precision for sorting and querying. The range of supported past dates @@ -57,7 +57,7 @@ protected $m_month = false; //Gregorian month, remains false if unspecified protected $m_year = false; //Gregorian year, remains false if unspecified protected $m_time = false; //time, remains false if unspecified - protected $m_jdn = ''; //numerical time representation similiar to Julian Day Number, for ancient times, a more compressed number is used (preserving ordering but not distance of time points) + protected $m_jd = ''; //numerical time representation similiar to Julian Day; for ancient times, a more compressed number is used (preserving ordering of time points) protected $m_timeoffset; //contains offset (e.g. timezone) protected $m_timeannotation; //contains am or pm // The following are constant (array-valued constants are not supported, hence the decalration as variable): @@ -73,7 +73,7 @@ $this->m_day = false; $this->m_month = false; $this->m_year = false; - $this->m_jdn = false; + $this->m_jd = false; $this->m_time = false; $this->m_timeoffset = 0; $this->m_timepm = false; @@ -194,9 +194,9 @@ //handle offset if ($this->m_timeoffset != 0) { - $this->createJDN(); - $this->m_jdn = $this->m_jdn + $this->m_timeoffset; - $this->JDN2Date(); + $this->createJD(); + $this->m_jd = $this->m_jd + $this->m_timeoffset; + $this->JD2Date(); } if ($this->m_caption === false) { @@ -276,8 +276,8 @@ } public function getNumericValue() { - $this->createJDN(); - return $this->m_jdn; + $this->createJD(); + return $this->m_jd; } public function getWikiValue(){ @@ -286,8 +286,8 @@ public function getHash() { if ($this->isValid()) { - $this->createJDN(); - return strval($this->m_jdn); + $this->createJD(); + return strval($this->m_jd); } else { return implode("\t", $this->m_errors); } @@ -307,14 +307,16 @@ } /** -* Return the year as a number. +* Return the year as a number corresponding to the year in the proleptic +* Georgian calendar and using the astronomical year numbering (0 means 1 BC). */ public function getYear() { return $this->m_year; } /** -* Return the month as a number (between 1 and 12). +* Return the month as a number (between 1 and 12) based on the proleptic +* Georgian calendar. * The parameter $default optionally specifies the value returned * if the date is valid but has no explicitly specified month. It can * also be set to FALSE to detect this situation. @@ -324,7 +326,7 @@ } /** -* Return the day as a number. +* Return the day as a number based on the proleptic Georgian calendar. * The parameter $default optionally specifie
[MediaWiki-CVS] SVN: [43801] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43801 Author: mkroetzsch Date: 2008-11-21 08:36:51 + (Fri, 21 Nov 2008) Log Message: --- Gregorian, not Georgian. Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 08:34:19 UTC (rev 43800) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 08:36:51 UTC (rev 43801) @@ -11,8 +11,8 @@ * information. However, time offsets to that local time are supported (see below). * * There is currently no support for different calendar models or conversion between - * them. All dates are supposed to refer to Georgian calendar (or its extension to - * the past, the proleptic Georgian claendar). Attention: this may change in future + * them. All dates are supposed to refer to Gregorian calendar (or its extension to + * the past, the proleptic Gregorian claendar). Attention: this may change in future * versions, and historical dates may be treated as Julian calendar dates in certain * ranges. Consider historical dates to be experimental. * @@ -308,7 +308,7 @@ /** * Return the year as a number corresponding to the year in the proleptic -* Georgian calendar and using the astronomical year numbering (0 means 1 BC). +* Gregorian calendar and using the astronomical year numbering (0 means 1 BC). */ public function getYear() { return $this->m_year; @@ -316,7 +316,7 @@ /** * Return the month as a number (between 1 and 12) based on the proleptic -* Georgian calendar. +* Gregorian calendar. * The parameter $default optionally specifies the value returned * if the date is valid but has no explicitly specified month. It can * also be set to FALSE to detect this situation. @@ -326,7 +326,7 @@ } /** -* Return the day as a number based on the proleptic Georgian calendar. +* Return the day as a number based on the proleptic Gregorian calendar. * The parameter $default optionally specifies the value returned * if the date is valid but has no explicitly specified date. It can * also be set to FALSE to detect this situation. @@ -424,7 +424,7 @@ * @note The result of this function is used only internally and should not be assumed to be the * exact JD, even for dates after 4713 BC. The reason is that the time information used in this number is * based on the local timezone of the wiki (see class documentation), and not necessarily normalized -* to Greenwhich noon. The JD computation, however, is based on proleptic Georgian calendar, and hence +* to Greenwhich noon. The JD computation, however, is based on proleptic Gregorian calendar, and hence * is precise for the current input conventions. */ protected function createJD(){ @@ -446,7 +446,7 @@ } } - /// Convert Julian Day (see createJD) back to a proleptic Georgian date. + /// Convert Julian Day (see createJD) back to a proleptic Gregorian date. protected function JD2Date() { $j = intval($this->m_jd) + 32044; $g = intval($j / 146097); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43803] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43803 Author: mkroetzsch Date: 2008-11-21 08:50:36 + (Fri, 21 Nov 2008) Log Message: --- Document proper leap year support and input conventions regarding "BC", "PM", etc. Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 08:41:06 UTC (rev 43802) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 08:50:36 UTC (rev 43803) @@ -10,6 +10,12 @@ * refers to by common conventions. For export, times are given without timezone * information. However, time offsets to that local time are supported (see below). * + * Dates can be given in many formats, using numbers, month names, and abbreviated + * month names. The preferred interpretation of ambiguous dates ("1 2 2008" or even + * "1 2 3 BC") is controlled by the language file, as is the local naming of months. + * English month names are always supported. Currently, the additions "AM", "PM", "BC", + * and "AD" are supported, but not localised to other languages. + * * There is currently no support for different calendar models or conversion between * them. All dates are supposed to refer to Gregorian calendar (or its extension to * the past, the proleptic Gregorian claendar). Attention: this may change in future @@ -42,7 +48,9 @@ * getTimeString), and those can also be used to find out what was unspecified. * * Time offests are supported (e.g. "1 1 2008 12:00-2:00"). As explained above, those - * refer to the local time. + * refer to the local time. Time offsets take leap years into account, e.g. the date + * "Feb 28 2004 23:00+2:00" is equivalent to "29 February 2004 01:00:00", while + * "Feb 28 1900 23:00+2:00" is equivalent to "1 March 1900 01:00:00". * * @author Fabian Howahl * @author Markus Krötzsch ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43805] trunk/extensions/SemanticMediaWiki
Revision: 43805 Author: mkroetzsch Date: 2008-11-21 09:22:48 + (Fri, 21 Nov 2008) Log Message: --- beautification, some documentation of open issues for date handling Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 09:01:26 UTC (rev 43804) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 09:22:48 UTC (rev 43805) @@ -52,6 +52,13 @@ * "Feb 28 2004 23:00+2:00" is equivalent to "29 February 2004 01:00:00", while * "Feb 28 1900 23:00+2:00" is equivalent to "1 March 1900 01:00:00". * + * @todo Add support for different calendar models (mainly requires to settle how this + * should be specified in various languages). + * @todo Internationalise the treatment of AD, BC, PM, AM. Add more formats (p.m. or BCE). + * @todo Try to reuse more of MediaWiki's records, e.g. to obtain month names or to + * format dates. The problem is that MW is based on SIO timestamps that don't extend to + * very ancient or future dates, and that MW uses PHP functions that are bound to UNIX time. + * * @author Fabian Howahl * @author Markus Krötzsch * @ingroup SMWDataValues Modified: trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php === --- trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php 2008-11-21 09:01:26 UTC (rev 43804) +++ trunk/extensions/SemanticMediaWiki/languages/SMW_Language.php 2008-11-21 09:22:48 UTC (rev 43805) @@ -33,7 +33,7 @@ /// the default is simply empty (no labels in addition to English) protected $m_monthsshort = array(); /// Preferred interpretations for dates with 1, 2, and 3 components. There is an array for - /// each case, and the constants define the obvious order (e.g. SMW_YDM means "first Year, + /// each case, and the constants define the obvious order (e.g. SMW_YDM means "first Year, /// then Day, then Month). Unlisted combinations will not be accepted at all. protected $m_dateformats = array(array(SMW_Y), array(SMW_MY,SMW_YM), array(SMW_DMY,SMW_MDY,SMW_YMD,SMW_YDM)); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43807] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43807 Author: mkroetzsch Date: 2008-11-21 09:47:37 + (Fri, 21 Nov 2008) Log Message: --- fix numbre formatting for large year numbers (no thousands separator, no exp notation) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 09:24:57 UTC (rev 43806) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 09:47:37 UTC (rev 43807) @@ -372,13 +372,15 @@ * If the date was not fully specified, then the function will use defaults for the omitted values. * The boolean parameter $mindefault controls if those defaults are chosen minimally. If false, then * the latest possible value will be chosen instead. +* +* @note This function may return year numbers with less or more than 4 digits. */ public function getXMLSchemaDate($mindefault = true) { if ($this->isValid()) { if ($mindefault) { - return $this->m_year.'-'.$this->normalizeValue($this->getMonth()).'-'.$this->normalizeValue($this->getDay()).'T'.$this->getTimeString(); + return number_format($this->m_year, 0, '.', '').'-'.$this->normalizeValue($this->getMonth()).'-'.$this->normalizeValue($this->getDay()).'T'.$this->getTimeString(); } else { - return $this->m_year.'-'.$this->normalizeValue($this->getMonth(12)).'-'.$this->normalizeValue($this->getDay(31)).'T'.$this->getTimeString('23:59:59'); + return number_format($this->m_year, 0, '.', '').'-'.$this->normalizeValue($this->getMonth(12)).'-'.$this->normalizeValue($this->getDay(31)).'T'.$this->getTimeString('23:59:59'); } } else { return false; @@ -394,9 +396,9 @@ if ($this->m_printvalue === false) { //MediaWiki date function is not applicable any more (no support for BC Dates) if ($this->m_year > 0) { - $this->m_printvalue = $this->m_year; + $this->m_printvalue = number_format($this->m_year, 0, '.', ''); // note: there should be no digits after the comma anyway } else { - $this->m_printvalue = -($this->m_year-1) . ' BC'; + $this->m_printvalue = number_format(-($this->m_year-1), 0, '.', '') . ' BC'; // note: there should be no digits after the comma anyway } if ($this->m_month) { $this->m_printvalue = $smwgContLang->getMonthLabel($this->m_month) . " " . $this->m_printvalue; ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43813] trunk/extensions/SemanticMediaWiki
Revision: 43813 Author: mkroetzsch Date: 2008-11-21 13:38:05 + (Fri, 21 Nov 2008) Log Message: --- updated files to SMW 1.4.0 release Modified Paths: -- trunk/extensions/SemanticMediaWiki/INSTALL trunk/extensions/SemanticMediaWiki/RELEASE-NOTES Modified: trunk/extensions/SemanticMediaWiki/INSTALL === --- trunk/extensions/SemanticMediaWiki/INSTALL 2008-11-21 13:20:27 UTC (rev 43812) +++ trunk/extensions/SemanticMediaWiki/INSTALL 2008-11-21 13:38:05 UTC (rev 43813) @@ -1,4 +1,4 @@ -[[Semantic MediaWiki 1.4d Version for Alpha-Testers!]] +[[Semantic MediaWiki 1.4.0]] Install instructions for the latest SMW version are also online in a more convenient format for reading: @@ -34,12 +34,12 @@ == Requirements == -* MediaWiki 1.11.* or greater (tested from 1.11.0 to 1.14alpha (r40427)). +* MediaWiki 1.11.* or greater (tested from 1.11.0 to 1.14alpha (r43727)). * PHP 5.x or greater installed and working * MySQL >= 4.0.14 (version required by MediaWiki) Notes: -* SMW 1.2 currently has no Postgres support. It could be done if someone cares +* SMW 1.4 currently has no Postgres support. It could be done if someone cares to support this action. * SMW uses the PHP mb_*() multibyte functions such as mb_strpos in the php_mbstring.dll extension. This is standard but not enabled by default on @@ -81,29 +81,25 @@ It is no problem to access a site by more than one servername in any case. If you have custom namespaces (such as "Portal"), read the note below. (3) In your wiki, log in as a user with admin status and go to the page -"Special:SMWAdmin" to do the final setup steps. This can also be done with -a command-line php script. See [SMW_path]/maintenance/README for details. -Please consider announcing your new site to the SMW semantic wiki list by -using the according button on "Special:SMWAdmin". +"Special:SMWAdmin" to do the final setup steps. Two steps are needed: at +first, trigger the database setup ("Database installation and upgrade"). +Afterwards, activate the automatic data update ("Data repair and upgrade"). +Note that the first step requires persmissions to alter/create database +tables, as explained in the above note. The second step takes some time; + go to Special:SMWAdmin to follow its progress. -Note that this requires persmissions to alter/create database tables, as -explained in the above note. + Both of those actions can also be accomplished with the command-line PHP + scripts SMW_setup.php and SMW_refreshData.php. Read the documentation in + [SMW_path]/maintenance/README for details on how to run such scripts. -(4) If you already have categories in your wiki, they will not immediately be -available for SMW queries. Category information becomes available if a -page in a category is edited next time. To make all information available -immediately, run the script [SMW_path]/maintenance/SMW_refreshData.php -as described in [SMW_path]/maintenance/README. - '''Remark:''' Semantic MediaWiki uses ten additional namespace indexes (see http://meta.wikimedia.org/wiki/Help:Custom_namespaces), in the range from 100 to 109. 100 and 101 are only needed if $smwgSMWBetaCompatible is set. -106 and 107 are reserved for the SemanticForms extension and not used by SMW. -If you have your own custom namespaces, you have to set the parameter -$smwgNamespaceIndex before including SMW_Settings.php. See the documentation -$within SMW_Settings.php for details. If you add more namespaces later on, -then you have to assign them to higher numbers than those used by Semantic -MediaWiki. +106 and 107 are reserved for the SemanticForms extension. If you have your own +custom namespaces, you have to set the parameter $smwgNamespaceIndex before +including SMW_Settings.php. See the documentation $within SMW_Settings.php for +details. If you add more namespaces later on, then you have to assign them to +higher numbers than those used by Semantic MediaWiki. There is currently no working Postgres support. If you need that, please contact the developers and support them in adjusting SMW appropriately. @@ -131,22 +127,9 @@ === Customising Semantic MediaWiki === -Semantic MediaWiki can be customised by a number of settings. To do so, you -can set respective parameters somewhere below the line -"include_once('extensions/SemanticMediaWiki/includes/SMW_Settings.php');" -in your LocalSetting.php. For example, one can write +Semantic MediaWiki can be customised by a number of settings. The available +options are detailed in http://semantic-mediawiki.org/wiki/Help:Configuration - include_once('extensions/SemanticMediaWiki/includes/SMW_Settings.php'); - $smwgQDefaultLimit = 20; - enableSemant
[MediaWiki-CVS] SVN: [43814] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43814 Author: mkroetzsch Date: 2008-11-21 13:38:23 + (Fri, 21 Nov 2008) Log Message: --- typos Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 13:38:05 UTC (rev 43813) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 13:38:23 UTC (rev 43814) @@ -22,17 +22,17 @@ * versions, and historical dates may be treated as Julian calendar dates in certain * ranges. Consider historical dates to be experimental. * - * It is able to handle dates accross history with full precision for storing, and + * It is able to handle dates across history with full precision for storing, and * substantial precision for sorting and querying. The range of supported past dates * should encompass the Beginning of Time according to most of today's theories. The * range of supported future dates is limited more strictly, but it does also allow * year numbers in the order of 10^9. * * Years before common era (aka BC) can be denoted using "BC" in a date. The internal - * nummeric date model supports the year 0, and considers it to be the same as "1 BC". + * numeric date model supports the year 0, and considers it to be the same as "1 BC". * The year "0 BC" is accepted to refer to the same year, but its use is discouraged. * According to this convention, e.g., the year "-100" is the same as "101 BC". This - * convention agrees with ISO 6801 and the remarks in XML Schema Datatypes 2nd Edition, + * convention agrees with ISO 6801 and the remarks in XML Schema Datatypes 2nd Edition * (the latter uses a different convention that disallows year 0, but it explicitly * endorses the ISO convention and announces the future use of this in XML). * Note that the implementation currently does not support the specification of negative @@ -40,7 +40,7 @@ * * The implementation notices and stores whether parts of a date/time have been * omitted (as in "2008" or "May 2007"). For all exporting and sorting purposes, - * incomplete dates are completed wiht defaults (usually using the earliest possible + * incomplete dates are completed with defaults (usually using the earliest possible * time, i.e. interpreting "2008" as "Jan 1 2008 00:00:00"). But the information * on what was unspecified is kept internally for improving behaviour e.g. for * outputs (defaults are not printed when querying for a value). Functions are ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43815] trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/ SMW_SpecialSMWAdmin.php
Revision: 43815 Author: mkroetzsch Date: 2008-11-21 13:40:08 + (Fri, 21 Nov 2008) Log Message: --- move "data upgrade" feature higher up, as it is needed on installation Modified Paths: -- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php Modified: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php === --- trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-21 13:38:23 UTC (rev 43814) +++ trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php 2008-11-21 13:40:08 UTC (rev 43815) @@ -112,14 +112,6 @@ '' . '' . "\n"; - $html .= '' . wfMsg('smw_smwadmin_announce') . "\n" . - '' . wfMsg('smw_smwadmin_announcedocu') . "\n" . - '' . wfMsg('smw_smwadmin_announcebutton') . "\n" . -'http://semantic-mediawiki.org/wiki/Special:SMWRegistry"; method="GET">' . -'' . -'' . -'' . "\n"; - $html .= '' . wfMsg('smw_smwadmin_datarefresh') . "\n" . '' . wfMsg('smw_smwadmin_datarefreshdocu') . "\n"; if ($refreshjob !== NULL) { @@ -144,6 +136,13 @@ '' . "\n"; } + $html .= '' . wfMsg('smw_smwadmin_announce') . "\n" . + '' . wfMsg('smw_smwadmin_announcedocu') . "\n" . + '' . wfMsg('smw_smwadmin_announcebutton') . "\n" . +'http://semantic-mediawiki.org/wiki/Special:SMWRegistry"; method="GET">' . +'' . +'' . +'' . "\n"; $html .= '' . wfMsg('smw_smwadmin_support') . "\n" . '' . wfMsg('smw_smwadmin_supportdocu') . "\n" . ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43817] trunk/extensions/SemanticMediaWiki/includes
Revision: 43817 Author: mkroetzsch Date: 2008-11-21 14:17:12 + (Fri, 21 Nov 2008) Log Message: --- updated iCalendar export to cover extended date ranges (finally, iCal import of whole historical timelines; challenge the ISO conformance of your desktop calendar! ;-); we still cut off to restrict to at most four digits in years Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php trunk/extensions/SemanticMediaWiki/includes/SMW_QP_iCalendar.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 13:55:27 UTC (rev 43816) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-21 14:17:12 UTC (rev 43817) @@ -259,7 +259,7 @@ list($this->m_year,$this->m_month,$this->m_day) = explode('/',$date,3); $this->makePrintoutValue(); $this->m_caption = $this->m_printvalue; - $this->m_wikivalue = $value; + $this->m_wikivalue = $this->m_printvalue; } public function getShortWikiText($linked = NULL) { Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_iCalendar.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_iCalendar.php 2008-11-21 13:55:27 UTC (rev 43816) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_iCalendar.php 2008-11-21 14:17:12 UTC (rev 43817) @@ -57,8 +57,8 @@ $row = $res->getNext(); while ( $row !== false ) { $wikipage = $row[0]->getNextObject(); // get the object - $startdate = ''; - $enddate = ''; + $startdate = false; + $enddate = false; $location = ''; $description = ''; foreach ($row as $field) { @@ -67,16 +67,10 @@ // could include funny things like geo, description etc. though $req = $field->getPrintRequest(); if ( (strtolower($req->getLabel()) == "start") && ($req->getTypeID() == "_dat") ) { - $value = current($field->getContent()); // save only the first - if ($value !== false) { - $startdate = $value->getXSDValue(); - } + $startdate = current($field->getContent()); // save only the first } if ( (strtolower($req->getLabel()) == "end") && ($req->getTypeID() == "_dat") ) { - $value = current($field->getContent()); // save only the first - if ($value !== false) { - $enddate = $value->getXSDValue(); - } + $enddate = current($field->getContent()); // save only the first } if (strtolower($req->getLabel()) == "location") { $value = current($field->getContent()); // save only the first @@ -98,11 +92,12 @@ $result .= "SUMMARY:" . $wikipage->getShortWikiText() . "\r\n"; $result .= "URL:$url\r\n"; $result .= "UID:$url\r\n"; - if ($startdate != "") $result .= "DTSTART:" . $this->parsedate($startdate,$enddate) . "\r\n"; - if ($enddate != "") $result .= "DTEND:" . $this->parsedate($enddate,$startdate,true) . "\r\n"; + if ($startdate != false) $result .= "DTSTART:" . $this->parsedate($startdate) . "\r\n"; + if ($enddate != false) $result .= "DTEND:" . $this->parsedate($enddate,true) . "\r\n"; if ($location != "") $result .= "LOCATION:$location\r\n";
[MediaWiki-CVS] SVN: [43818] trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php
Revision: 43818 Author: mkroetzsch Date: 2008-11-21 14:30:27 + (Fri, 21 Nov 2008) Log Message: --- use getXMLSchemaDate for exporting dates to RSS Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php 2008-11-21 14:17:12 UTC (rev 43817) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php 2008-11-21 14:30:27 UTC (rev 43818) @@ -61,7 +61,7 @@ } } elseif ( (strtolower($req->getLabel()) == "date") && ($req->getTypeID() == "_dat") ) { foreach ($field->getContent() as $entry) { - $dates[] = $entry->getXSDvalue(); + $dates[] = $entry->getXMLSchemaDate(); } } } ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43819] trunk/extensions/SemanticMediaWiki/includes/SMW_QP_vCard.php
Revision: 43819 Author: mkroetzsch Date: 2008-11-21 14:35:14 + (Fri, 21 Nov 2008) Log Message: --- use getXMLSchemaDate() now Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_vCard.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_vCard.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QP_vCard.php 2008-11-21 14:30:27 UTC (rev 43818) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QP_vCard.php 2008-11-21 14:35:14 UTC (rev 43819) @@ -102,7 +102,7 @@ if ( (strtolower($req->getLabel()) == "birthday") && ($req->getTypeID() == "_dat") ) { $value = current($field->getContent()); // save only the first if ($value !== false) { - $birthday = $value->getXSDValue(); + $birthday = $value->getXMLSchemaDate(); } } if ( (strtolower($req->getLabel()) == "homepage") && ($req->getTypeID() == "_uri") ) { ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43820] trunk/extensions/SemanticMediaWiki/includes/ SMW_GlobalFunctions.php
Revision: 43820 Author: mkroetzsch Date: 2008-11-21 14:35:47 + (Fri, 21 Nov 2008) Log Message: --- version increment, this is almost 1.4.0 Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2008-11-21 14:35:14 UTC (rev 43819) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2008-11-21 14:35:47 UTC (rev 43820) @@ -14,7 +14,7 @@ * @defgroup SMW Semantic MediaWiki */ -define('SMW_VERSION','1.4e-SVN'); +define('SMW_VERSION','1.4f-SVN'); // constants for displaying the factbox define('SMW_FACTBOX_HIDDEN', 1); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43821] trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor .php
Revision: 43821 Author: mkroetzsch Date: 2008-11-21 16:01:56 + (Fri, 21 Nov 2008) Log Message: --- fix: changed function name Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php 2008-11-21 14:35:47 UTC (rev 43820) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php 2008-11-21 16:01:56 UTC (rev 43821) @@ -784,7 +784,7 @@ } else { $innerdesc = $this->addDescription($innerdesc, new SMWThingDescription(), false); } - $this->m_errors[] = wfMsgForContent('smw_propvalueproblem', $property->getText()); + $this->m_errors[] = wfMsgForContent('smw_propvalueproblem', $property->getWikiValue()); } $properties = array_reverse($properties); foreach ($properties as $property) { ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43822] trunk/extensions/SemanticMediaWiki/includes/storage/ SMW_SQLStore2.php
Revision: 43822 Author: mkroetzsch Date: 2008-11-21 17:05:11 + (Fri, 21 Nov 2008) Log Message: --- fixed display of Subproperty of Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php === --- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2008-11-21 16:01:56 UTC (rev 43821) +++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php 2008-11-21 17:05:11 UTC (rev 43822) @@ -493,11 +493,8 @@ // redirects work differently. $table = ''; $sql = 'p_id=' . $db->addQuotes($pid); - if ($value === NULL) { - $mode = SMWSQLStore2::getStorageMode($property->getTypeID()); - } else { - $mode = SMWSQLStore2::getStorageMode($value->getTypeID()); - } + $typeid = ($value === NULL)?$property->getTypeID():$value->getTypeID(); + $mode = SMWSQLStore2::getStorageMode($typeid); switch ($mode) { case SMW_SQL2_TEXT2: @@ -507,9 +504,13 @@ $table = 'smw_conc2'; // ignore value condition in this case break; case SMW_SQL2_RELS2: case SMW_SQL2_INST2: case SMW_SQL2_SUBS2: + if ($mode!=SMW_SQL2_RELS2) $sql = ''; // no property column here + if ($mode==SMW_SQL2_SUBS2) { // this table is shared, filter the relevant case + $sql = 'smw_namespace=' . (($typeid == '__sup')?$db->addQuotes(SMW_NS_PROPERTY):$db->addQuotes(NS_CATEGORY)); + } if ($value !== NULL) { $oid = $this->getSMWPageID($value->getDBkey(),$value->getNamespace(),$value->getInterwiki()); - $sql = (($mode==SMW_SQL2_RELS2)?"$sql AND ":'') . 'o_id=' . $db->addQuotes($oid); + $sql .= ($sql?" AND ":'') . 'o_id=' . $db->addQuotes($oid); } if ( ($value === NULL) || ($oid != 0) ) { switch ($mode) { @@ -593,7 +594,8 @@ if ($table != '') { $res = $db->select( array($table,'smw_ids'), 'DISTINCT smw_title,smw_namespace,smw_sortkey', - 's_id=smw_id AND ' . $sql . $this->getSQLConditions($requestoptions,'smw_sortkey','smw_sortkey'), 'SMW::getPropertySubjects', + 's_id=smw_id' . ($sql?' AND ':'') . $sql . $this->getSQLConditions($requestoptions,'smw_sortkey','smw_sortkey'), + 'SMW::getPropertySubjects', $this->getSQLOptions($requestoptions,'smw_sortkey') ); while ($row = $db->fetchObject($res)) { $dv = SMWWikiPageValue::makePage($row->smw_title, $row->smw_namespace, $row->smw_sortkey); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43823] trunk/extensions/SemanticMediaWiki
Revision: 43823 Author: mkroetzsch Date: 2008-11-21 17:05:53 + (Fri, 21 Nov 2008) Log Message: --- Updated documentation, typos Modified Paths: -- trunk/extensions/SemanticMediaWiki/INSTALL trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php Modified: trunk/extensions/SemanticMediaWiki/INSTALL === --- trunk/extensions/SemanticMediaWiki/INSTALL 2008-11-21 17:05:11 UTC (rev 43822) +++ trunk/extensions/SemanticMediaWiki/INSTALL 2008-11-21 17:05:53 UTC (rev 43823) @@ -84,7 +84,7 @@ "Special:SMWAdmin" to do the final setup steps. Two steps are needed: at first, trigger the database setup ("Database installation and upgrade"). Afterwards, activate the automatic data update ("Data repair and upgrade"). -Note that the first step requires persmissions to alter/create database +Note that the first step requires permissions to alter/create database tables, as explained in the above note. The second step takes some time; go to Special:SMWAdmin to follow its progress. @@ -147,12 +147,12 @@ can simply follow the above installation steps. This covers all sites with SMW 1.2 to 1.3 that do not use a special setting to switch back to the old store ("SMWSQLStore" or "SMWRAPStore"). In these cases the new data upgrade feature -("will ensure that your data is refreshed to the new version. To speed up the +will ensure that your data is refreshed to the new version. To speed up the update, use MediaWiki's script runJobs.php. Older SMW versions or SMW versions that use the old store can upgrade in the same fashion, but first need to remove any setting that configures SMW to -use the old store. Again, all data will immediately be availabel when the data +use the old store. Again, all data will immediately be available when the data upgrade has finished. Directly after enabling SMW 1.4.0, it can potentially happen that the site @@ -160,7 +160,7 @@ even before you intialised it. This can even block you from reaching SMWAdmin. In this case, either use the script SMW_setup.php from the command-line, or access your database and delete all entries in the table "job". After this, no -errors should show up while accessing the special page for initalisation. +errors should show up while accessing the special page for initialisation. Extensions of SMW (e.g. Semantic Forms) need to be updated to a version that is compatible with SMW 1.4. See your extension homepage for details. If you use Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php 2008-11-21 17:05:11 UTC (rev 43822) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php 2008-11-21 17:05:53 UTC (rev 43823) @@ -364,21 +364,8 @@ ## ### -# If the following is set to true, the wiki can be completely refreshed calling -# calling the URL -# -# http://your.wiki.org/index.php/Special:SMWAdmin?action=refreshstore -# -# This will create a job that will trigger a complete refresh of the whole wiki, -# repairing all data. The refreshing will take some time and new jobs will be -# created again and again over the cause of the action. The only way to stop the -# process currently is to delete all SMW jobs from the database table "job". -# When called twice, the above *resets* the job and starts anew, so it might be -# good to disable this setting again after the job has been created (this will -# not stop the running job). -# -# This is an experimental feature that may not yet work reliably. Use at your -# own risk, and report any problems (see INSTALL on reporting bugs). +# If the following is set to true, it is possible to initiate the repairing +# or updating of all wiki data using the interface on Special:SMWAdmin. ## $smwgAdminRefreshStore = true; ## ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43827] trunk/extensions/SemanticMediaWiki/includes/ SMW_GlobalFunctions.php
Revision: 43827 Author: mkroetzsch Date: 2008-11-21 18:17:13 + (Fri, 21 Nov 2008) Log Message: --- this is 1.4.0, ready for release Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2008-11-21 18:13:46 UTC (rev 43826) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2008-11-21 18:17:13 UTC (rev 43827) @@ -14,7 +14,7 @@ * @defgroup SMW Semantic MediaWiki */ -define('SMW_VERSION','1.4f-SVN'); +define('SMW_VERSION','1.4.0'); // constants for displaying the factbox define('SMW_FACTBOX_HIDDEN', 1); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43889] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43889 Author: mkroetzsch Date: 2008-11-24 09:20:25 + (Mon, 24 Nov 2008) Log Message: --- typo Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-24 05:56:46 UTC (rev 43888) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-24 09:20:25 UTC (rev 43889) @@ -76,7 +76,7 @@ protected $m_timeoffset; //contains offset (e.g. timezone) protected $m_timeannotation; //contains am or pm // The following are constant (array-valued constants are not supported, hence the decalration as variable): - protected $m_months = array("January", "February", "March", "April" , "May" , "June" , "Juli" , "August" , "September" , "October" , "November" , "December"); + protected $m_months = array("January", "February", "March", "April" , "May" , "June" , "July" , "August" , "September" , "October" , "November" , "December"); protected $m_monthsshort = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); protected $m_formats = array( SMW_Y => array('year'), SMW_YM => array('year','month'), SMW_MY => array('month','year'), SMW_YDM => array('year','day','month'), SMW_YMD => array('year','month','day'), SMW_DMY => array('day','month','year'), SMW_MDY => array('month','day','year')); protected $m_daysofmonths = array ( 1 => 31, 2 => 28, 3 => 31, 4 => 30, 5 => 31, 6 => 30, 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31 ); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43890] trunk/extensions/SemanticMediaWiki/includes/ SMW_GlobalFunctions.php
Revision: 43890 Author: mkroetzsch Date: 2008-11-24 09:23:08 + (Mon, 24 Nov 2008) Log Message: --- version increment Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2008-11-24 09:20:25 UTC (rev 43889) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php 2008-11-24 09:23:08 UTC (rev 43890) @@ -14,7 +14,7 @@ * @defgroup SMW Semantic MediaWiki */ -define('SMW_VERSION','1.4.0'); +define('SMW_VERSION','1.5a-SVN'); // constants for displaying the factbox define('SMW_FACTBOX_HIDDEN', 1); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43899] trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor .php
Revision: 43899 Author: mkroetzsch Date: 2008-11-24 16:01:25 + (Mon, 24 Nov 2008) Log Message: --- getText() -> getWikiValue() (Bug) Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php 2008-11-24 16:01:18 UTC (rev 43898) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php 2008-11-24 16:01:25 UTC (rev 43899) @@ -755,7 +755,7 @@ $chunk = ']]'; } } else { - $printlabel = $property->getText(); + $printlabel = $property->getWikiValue(); } if ($chunk == ']]') { return new SMWPrintRequest(SMWPrintRequest::PRINT_PROP, $printlabel, $property, $printmodifier); ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
[MediaWiki-CVS] SVN: [43995] trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
Revision: 43995 Author: mkroetzsch Date: 2008-11-27 15:42:59 + (Thu, 27 Nov 2008) Log Message: --- Accept more date formats: ignore surrounding spaces, allow initial 0s in number Modified Paths: -- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php === --- trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-27 13:07:30 UTC (rev 43994) +++ trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php 2008-11-27 15:42:59 UTC (rev 43995) @@ -94,6 +94,7 @@ $this->m_timepm = false; $this->m_timeannotation = false; + $value = trim($value); // ignore whitespace $this->m_wikivalue = $value; $filteredvalue = $value; //value without time definition and further abbreviations like PM or BC @@ -178,7 +179,7 @@ $i = 0; foreach ($this->m_formats[$format] as $globalvar) { // map format digits to internal variables $globalvar = 'm_'.$globalvar; // (for searching this file) this is one of: m_year, m_month, m_day - if (!$this->$globalvar) $this->$globalvar = $array[$i]; + if (!$this->$globalvar) $this->$globalvar = intval($array[$i]); $i++; } $found = true; @@ -224,7 +225,7 @@ global $smwgContLang; if(!is_numeric($digit)){ //check for alphanumeric day or month value if(preg_match("/[0-3]?[0-9](st|nd|rd|th)/u", $digit)) { //look for day value terminated by st/nd/th - $this->m_day = substr($digit,0,strlen($digit)-2); //remove st/nd/th + $this->m_day = intval(substr($digit,0,strlen($digit)-2)); //remove st/nd/th return SMW_DAY; } $monthnumber = $smwgContLang->findMonth($digit); @@ -243,9 +244,9 @@ return SMW_MONTH; } return 0; - } elseif ($digit >= 1 && $digit <= 12) { //number can be a month, a day or a year (111) + } elseif (intval($digit) >= 1 && intval($digit) <= 12) { //number can be a month, a day or a year (111) return SMW_DAY_MONTH_YEAR; - } elseif (($digit >= 1 && $digit <= 31)) { //number can be a day or a year (011) + } elseif ((intval($digit) >= 1 && intval($digit) <= 31)) { //number can be a day or a year (011) return SMW_DAY_YEAR; } elseif (is_numeric($digit)) { //number can just be a year (011) return SMW_YEAR; ___ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs