Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php |
— | — | @@ -374,7 +374,7 @@ |
375 | 375 | $sparql = smwfGetSparqlDatabase()->getSparqlForSelect( '?' . self::RESULT_VARIABLE, |
376 | 376 | $condition, $options, $namespaces ); |
377 | 377 | } |
378 | | - $sparql = str_replace( array( '[',':' ), array( '[', ':' ), $sparql ); |
| 378 | + $sparql = str_replace( array( '[',':',' ' ), array( '[', ':', ' ' ), $sparql ); |
379 | 379 | $entries['SPARQL Query'] = "<pre>$sparql</pre>"; |
380 | 380 | |
381 | 381 | return SMWStore::formatDebugOutput( 'SMWSparqlStore', $entries, $query ); |
— | — | @@ -772,7 +772,6 @@ |
773 | 773 | */ |
774 | 774 | protected function buildValueCondition( SMWValueDescription $description, $joinVariable, $orderByProperty ) { |
775 | 775 | $dataItem = $description->getDataItem(); |
776 | | - $expElement = SMWExporter::getDataItemExpElement( $dataItem ); |
777 | 776 | |
778 | 777 | $comparator = ''; |
779 | 778 | switch ( $description->getComparator() ) { |
— | — | @@ -790,18 +789,21 @@ |
791 | 790 | |
792 | 791 | $namespaces = array(); |
793 | 792 | if ( $comparator == '=' ) { |
| 793 | + $expElement = SMWExporter::getDataItemExpElement( $dataItem ); |
794 | 794 | $result = new SMWSparqlSingletonCondition( $expElement ); |
| 795 | + $this->addOrderByDataForProperty( $result, $joinVariable, $orderByProperty, $dataItem->getDIType() ); |
795 | 796 | } else { |
| 797 | + $expElement = SMWExporter::getDataItemExpElement( $dataItem ); |
| 798 | + $result = new SMWSparqlFilterCondition( '', array() ); |
| 799 | + $this->addOrderByData( $result, $joinVariable, $dataItem->getDIType() ); |
| 800 | + $orderVariable = $result->orderByVariable; |
796 | 801 | $valueName = SMWTurtleSerializer::getTurtleNameForExpElement( $expElement ); |
797 | 802 | if ( $expElement instanceof SMWExpNsResource ) { |
798 | | - $namespaces[$expElement->getNamespaceId()] = $expElement->getNamespace(); |
| 803 | + $result->namespaces[$expElement->getNamespaceId()] = $expElement->getNamespace(); |
799 | 804 | } |
800 | | - $filter = "?$joinVariable $comparator $valueName"; |
801 | | - $result = new SMWSparqlFilterCondition( $filter, $namespaces ); |
| 805 | + $result->filter = "?$orderVariable $comparator $valueName"; |
802 | 806 | } |
803 | 807 | |
804 | | - $this->addOrderByDataForProperty( $result, $joinVariable, $orderByProperty, $dataItem->getDIType() ); |
805 | | - |
806 | 808 | return $result; |
807 | 809 | } |
808 | 810 | |