http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88337
Revision: 88337
Author: mkroetzsch
Date: 2011-05-17 18:19:05 +0000 (Tue, 17 May 2011)
Log Message:
-----------
Added a property parameter to SMWValueDescriptions, so that they can serialize
properly (now that they do not have type information associated anymore).
Modified Paths:
--------------
trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php
trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php
2011-05-17 18:13:53 UTC (rev 88336)
+++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php
2011-05-17 18:19:05 UTC (rev 88337)
@@ -440,7 +440,7 @@
} else {
$value = SMWDataValueFactory::newTypeIDValue(
'_wpg', $chunk );
if ( $value->isValid() ) {
- $result = $this->addDescription(
$result, new SMWValueDescription( $value->getDataItem() ), false );
+ $result = $this->addDescription(
$result, new SMWValueDescription( $value->getDataItem(), null ), false );
}
}
Modified:
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php
===================================================================
---
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php
2011-05-17 18:13:53 UTC (rev 88336)
+++
trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php
2011-05-17 18:19:05 UTC (rev 88337)
@@ -35,14 +35,14 @@
$desc = new SMWConceptDescription( $this->mTitle );
if ( $this->from != '' ) {
- $dv = SMWWikiPageValue::makePage( $this->from,
NS_MAIN ); // make a dummy wiki page as boundary
- $fromdesc = new SMWValueDescription( $dv,
SMW_CMP_GEQ );
+ $diWikiPage = new SMWDIWikiPage( $this->from,
NS_MAIN, '' ); // make a dummy wiki page as boundary
+ $fromdesc = new SMWValueDescription(
$diWikiPage, null, SMW_CMP_GEQ );
$desc = new SMWConjunction( array( $desc,
$fromdesc ) );
$order = 'ASC';
} elseif ( $this->until != '' ) {
- $dv = SMWWikiPageValue::makePage( $this->until,
NS_MAIN ); // make a dummy wiki page as boundary
- $fromdesc = new SMWValueDescription( $dv,
SMW_CMP_LEQ );
- $neqdesc = new SMWValueDescription( $dv,
SMW_CMP_NEQ ); // do not include boundary in this case
+ $diWikiPage = new SMWDIWikiPage( $this->until,
NS_MAIN, '' ); // make a dummy wiki page as boundary
+ $fromdesc = new SMWValueDescription(
$diWikiPage, null, SMW_CMP_LEQ );
+ $neqdesc = new SMWValueDescription(
$diWikiPage, null, SMW_CMP_NEQ ); // do not include boundary in this case
$desc = new SMWConjunction( array( $desc,
$fromdesc, $neqdesc ) );
$order = 'DESC';
} else {
Modified:
trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php
2011-05-17 18:13:53 UTC (rev 88336)
+++ trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php
2011-05-17 18:19:05 UTC (rev 88337)
@@ -362,6 +362,10 @@
* value is not used elsewhere when calling this method. The function
can
* return SMWThingDescription to not impose any condition, e.g. if
parsing
* failed. Error messages of this SMWDataValue object are propagated.
+ *
+ * @note Descriptions of values need to know their property to be able
to
+ * create a parsable wikitext version of a query condition again. Thus
it
+ * might be necessary to call setProperty() before using this method.
*
* @param string $value
*/
@@ -375,7 +379,7 @@
if ( !$this->isValid() ) {
return new SMWThingDescription();
} else {
- return new SMWValueDescription( $this->getDataItem(),
$comparator );
+ return new SMWValueDescription( $this->getDataItem(),
$this->m_property, $comparator );
}
}
Modified:
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php
2011-05-17 18:13:53 UTC (rev 88336)
+++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php
2011-05-17 18:19:05 UTC (rev 88337)
@@ -373,10 +373,12 @@
protected $m_dataItem;
protected $m_comparator;
+ protected $m_property;
- public function __construct( SMWDataItem $dataItem, $comparator =
SMW_CMP_EQ ) {
+ public function __construct( SMWDataItem $dataItem, $property,
$comparator = SMW_CMP_EQ ) {
$this->m_dataItem = $dataItem;
$this->m_comparator = $comparator;
+ $this->m_property = $property;
}
/// @deprecated Use getDataItem() and
SMWDataValueFactory::newDataItemValue() if needed. Vanishes before SMW 1.7
@@ -394,7 +396,7 @@
public function getQueryString( $asvalue = false ) {
$comparator = SMWQueryLanguage::getStringForComparator(
$this->m_comparator );
- $dataValue = SMWDataValueFactory::newDataItemValue(
$this->m_dataItem );
+ $dataValue = SMWDataValueFactory::newDataItemValue(
$this->m_dataItem, $this->m_property );
if ( $asvalue ) {
return $comparator . $dataValue->getWikiValue();
} else { // this only is possible for values of Type:Page
Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
2011-05-17 18:13:53 UTC (rev 88336)
+++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
2011-05-17 18:19:05 UTC (rev 88337)
@@ -813,7 +813,7 @@
foreach ( $data->getPropertyValues( $property ) as $di
) {
if ( $di instanceof SMWDIError ) { // error
values, ignore
continue;
- }
+ }
// redirects were treated above
///TODO check needed if subject is null (would
happen if a user defined proptable with !idsubject was used on an internal
object -- currently this is not possible
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs