r86607 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86606‎ | r86607 | r86608 >
Date:09:02, 21 April 2011
Author:mkroetzsch
Status:deferred
Tags:
Comment:
improved move method; added namespaces for page-exists SPARQL query
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStore.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStore.php
@@ -28,6 +28,8 @@
2929 }
3030
3131 public function changeTitle( Title $oldtitle, Title $newtitle, $pageid, $redirid = 0 ) {
 32+ parent::changeTitle( $oldtitle, $newtitle, $pageid, $redirid );
 33+
3234 $oldWikiPage = SMWDIWikiPage::newFromTitle( $oldtitle );
3335 $newWikiPage = SMWDIWikiPage::newFromTitle( $newtitle );
3436 $oldExpResource = SMWExporter::getDataItemExpElement( $oldWikiPage );
@@ -36,16 +38,17 @@
3739 $newUri = SMWTurtleSerializer::getTurtleNameForExpElement( $newExpResource );
3840
3941 $sparqlDatabase = smwfGetSparqlDatabase();
40 - $sparqlDatabase->insertDelete( "$newUri ?p ?o", "$oldUri ?p ?o" ); /// FIXME this moves properties that are not correct, reparse this page
 42+ //$sparqlDatabase->insertDelete( "$newUri ?p ?o", "$oldUri ?p ?o" ); // this moves properties that are not correct, reparse this page
4143 $sparqlDatabase->insertDelete( "?s ?p $newUri", "?s ?p $oldUri" );
4244 if ( $oldtitle->getNamespace() == SMW_NS_PROPERTY ) {
4345 $sparqlDatabase->insertDelete( "?s $newUri ?o", "?s $oldUri ?o" );
4446 }
45 -
 47+ $newUpdate = new SMWUpdateJob( $newtitle );
 48+ $newUpdate->run();
4649 if ( $redirid != 0 ) { // update/create redirect page data
47 - /// FIXME reparse this page
 50+ $oldUpdate = new SMWUpdateJob( $oldtitle );
 51+ $oldUpdate->run();
4852 }
49 - parent::changeTitle( $oldtitle, $newtitle, $pageid, $redirid );
5053 }
5154
5255 public function doDataUpdate( SMWSemanticData $data ) {
@@ -120,8 +123,12 @@
121124 $resourceUri = SMWTurtleSerializer::getTurtleNameForExpElement( $expNsResource );
122125 $rediUri = SMWTurtleSerializer::getTurtleNameForExpElement( SMWExporter::getSpecialPropertyResource( '_REDI' ) );
123126 $skeyUri = SMWTurtleSerializer::getTurtleNameForExpElement( SMWExporter::getSpecialPropertyResource( '_SKEY' ) );
124 - $sparqlResult = smwfGetSparqlDatabase()->select( '*', "$resourceUri $skeyUri ?s OPTIONAL { $resourceUri $skeyUri ?s }", array( 'LIMIT' => 1 ) );
125127
 128+ $sparqlResult = smwfGetSparqlDatabase()->select( '*',
 129+ "$resourceUri $skeyUri ?s OPTIONAL { $resourceUri $skeyUri ?s }",
 130+ array( 'LIMIT' => 1 ),
 131+ array( $expNsResource->getNamespaceId() => $expNsResource->getNamespace() ) );
 132+
126133 $firstRow = $sparqlResult->current();
127134 if ( $firstRow === false ) {
128135 $exists = false;

Status & tagging log