Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki-CVS

SVN: [111237] trunk/extensions/SemanticMediaWiki/includes

 

 

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded


mkroetzsch at svn

Feb 11, 2012, 7:01 AM

Post #1 of 1 (12 views)
Permalink
SVN: [111237] trunk/extensions/SemanticMediaWiki/includes

https://www.mediawiki.org/wiki/Special:Code/MediaWiki/111237

Revision: 111237
Author: mkroetzsch
Date: 2012-02-11 15:01:01 +0000 (Sat, 11 Feb 2012)
Log Message:
-----------
Support use of inverse properties when using SPARQL backend.

Modified Paths:
--------------
trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php

Modified: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php 2012-02-11 14:46:15 UTC (rev 111236)
+++ trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php 2012-02-11 15:01:01 UTC (rev 111237)
@@ -233,7 +233,7 @@
static public function getResourceElementForProperty( SMWDIProperty $diProperty, $helperProperty = false ) {
$diWikiPage = $diProperty->getDiWikiPage();
if ( is_null( $diWikiPage ) ) {
- throw new Exception( 'SMWExporter::getResourceElementForProperty() can only be used for user-defined properties.' );
+ throw new Exception( 'SMWExporter::getResourceElementForProperty() can only be used for non-inverse, user-defined properties.' );
} elseif ( $helperProperty ) {
return self::getResourceElementForWikiPage( $diWikiPage, 'aux' );
} else {

Modified: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php 2012-02-11 14:46:15 UTC (rev 111236)
+++ trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php 2012-02-11 15:01:01 UTC (rev 111237)
@@ -691,17 +691,20 @@
if ( $diProperty->isInverse() ) { // don't check if this really makes sense
$subjectName = $objectName;
$objectName = '?' . $joinVariable;
+ $diNonInverseProperty = new SMWDIProperty( $diProperty->getKey(), false );
} else {
$subjectName = '?' . $joinVariable;
+ $diNonInverseProperty = $diProperty;
}

//*** Build the condition ***//
$typeId = $diProperty->findPropertyTypeID();
$diType = SMWDataValueFactory::getDataItemId( $typeId );
+ // for types that use helper properties in encoding values, refer to this helper property:
if ( SMWExporter::hasHelperExpElement( $diType ) ) {
- $propertyExpElement = SMWExporter::getResourceElementForProperty( $diProperty, true );
+ $propertyExpElement = SMWExporter::getResourceElementForProperty( $diNonInverseProperty, true );
} else {
- $propertyExpElement = SMWExporter::getResourceElementForProperty( $diProperty );
+ $propertyExpElement = SMWExporter::getResourceElementForProperty( $diNonInverseProperty );
}
$propertyName = SMWTurtleSerializer::getTurtleNameForExpElement( $propertyExpElement );
if ( $propertyExpElement instanceof SMWExpNsResource ) {


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS [at] lists
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.