http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97471
Revision: 97471
Author: mkroetzsch
Date: 2011-09-19 11:34:37 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
eliminated a number of undefined variable--related FIXMEs, secured some sites
where further changes will be needed if the code should be used later (RDF
collection export is not currently relevant in SMW)
Modified Paths:
--------------
trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php
trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer_RDFXML.php
trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer_Turtle.php
trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase.php
trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase4Store.php
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SqlStore2IdCache.php
Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php
2011-09-19 11:33:07 UTC (rev 97470)
+++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryParser.php
2011-09-19 11:34:37 UTC (rev 97471)
@@ -305,8 +305,7 @@
foreach ( $propertynames as $name ) {
if ( $typeid != '_wpg' ) { // non-final property in
chain was no wikipage: not allowed
- // FIXME: $prevname is undefined
- $this->m_errors[] = wfMsgForContent(
'smw_valuesubquery', $prevname );
+ $this->m_errors[] = wfMsgForContent(
'smw_valuesubquery', $name );
return null; ///TODO: read some more chunks and
try to finish [[ ]]
}
Modified:
trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer_RDFXML.php
===================================================================
---
trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer_RDFXML.php
2011-09-19 11:33:07 UTC (rev 97470)
+++
trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer_RDFXML.php
2011-09-19 11:34:37 UTC (rev 97471)
@@ -169,8 +169,9 @@
}
/**
- * Add a serialization of the given SMWExpLiteral to the output,
- * assuming that an opening property tag is alerady there.
+ * Add to the output a serialization of a property assignment where an
+ * SMWExpLiteral is the object. It is assumed that a suitable subject
+ * block has already been openend.
*
* @param $expResourceProperty SMWExpNsResource the property to use
* @param $expLiteral SMWExpLiteral the data value to use
@@ -186,8 +187,9 @@
}
/**
- * Add a serialization of the given SMWExpResource to the output,
- * assuming that an opening property tag is alerady there.
+ * Add to the output a serialization of a property assignment where an
+ * SMWExpResource is the object. It is assumed that a suitable subject
+ * block has already been openend.
*
* @param $expResourceProperty SMWExpNsResource the property to use
* @param $expResource SMWExpResource the data value to use
@@ -219,6 +221,9 @@
* @param $expResource array of (SMWExpResource or SMWExpData)
* @param $indent string specifying a prefix for indentation (usually a
sequence of tabs)
* @param $isClassTypeProp boolean whether the resource must be
declared as a class
+ *
+ * @bug The $isClassTypeProp parameter is not properly taken into
account.
+ * @bug Individual resources are not serialised properly.
*/
protected function serializeExpCollection( SMWExpNsResource
$expResourceProperty, array $collection, $indent, $isClassTypeProp ) {
$this->post_ns_buffer .= $indent . '<' .
$expResourceProperty->getQName() . " rdf:parseType=\"Collection\">\n";
@@ -226,11 +231,12 @@
if ( $expElement instanceof SMWExpData ) {
$this->serializeNestedExpData( $expElement,
$indent );
} else {
- $this->serializeExpResource(
$expResourceProperty, $expElement, $indent );
+ // FIXME: the below is not the right thing to
do here
+ //$this->serializeExpResource(
$expResourceProperty, $expElement, $indent );
}
if ( $isClassTypeProp ) {
// FIXME: $expResource is undefined
- $this->requireDeclaration( $expResource,
SMW_SERIALIZER_DECL_CLASS );
+ //$this->requireDeclaration( $expResource,
SMW_SERIALIZER_DECL_CLASS );
}
}
$this->post_ns_buffer .= "$indent</" .
$expResourceProperty->getQName() . ">\n";
Modified:
trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer_Turtle.php
===================================================================
---
trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer_Turtle.php
2011-09-19 11:33:07 UTC (rev 97470)
+++
trunk/extensions/SemanticMediaWiki/includes/export/SMW_Serializer_Turtle.php
2011-09-19 11:34:37 UTC (rev 97471)
@@ -182,8 +182,7 @@
$this->post_ns_buffer .= " )";
} else {
if ( $class_type_prop ) {
- // FIXME: $object is
undefined
-
$this->requireDeclaration( $object, SMW_SERIALIZER_DECL_CLASS );
+
$this->requireDeclaration( $value->getSubject(), SMW_SERIALIZER_DECL_CLASS );
}
if ( count(
$value->getProperties() ) > 0 ) { // resource with data: serialise
$this->post_ns_buffer
.= "\n";
Modified:
trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase.php
2011-09-19 11:33:07 UTC (rev 97470)
+++ trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase.php
2011-09-19 11:34:37 UTC (rev 97471)
@@ -430,8 +430,7 @@
*/
public function doUpdate( $sparql ) {
if ( $this->m_updateEndpoint == '' ) {
- // FIXME: $error is undefined
- throw new SMWSparqlDatabaseError(
SMWSparqlDatabaseError::ERROR_NOSERVICE, $sparql, 'not specified', $error );
+ throw new SMWSparqlDatabaseError(
SMWSparqlDatabaseError::ERROR_NOSERVICE, $sparql, 'not specified' );
}
curl_setopt( $this->m_curlhandle, CURLOPT_URL,
$this->m_updateEndpoint );
curl_setopt( $this->m_curlhandle, CURLOPT_POST, true );
@@ -465,8 +464,7 @@
*/
public function doHttpPost( $payload ) {
if ( $this->m_dataEndpoint == '' ) {
- // FIXME: $error is undefined
- throw new SMWSparqlDatabaseError(
SMWSparqlDatabaseError::ERROR_NOSERVICE, "SPARQL POST with data: $payload",
'not specified', $error );
+ throw new SMWSparqlDatabaseError(
SMWSparqlDatabaseError::ERROR_NOSERVICE, "SPARQL POST with data: $payload",
'not specified' );
}
curl_setopt( $this->m_curlhandle, CURLOPT_URL,
$this->m_dataEndpoint );
curl_setopt( $this->m_curlhandle, CURLOPT_POST, true );
Modified:
trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase4Store.php
===================================================================
---
trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase4Store.php
2011-09-19 11:33:07 UTC (rev 97470)
+++
trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlDatabase4Store.php
2011-09-19 11:34:37 UTC (rev 97471)
@@ -97,8 +97,7 @@
*/
public function doHttpPost( $payload ) {
if ( $this->m_dataEndpoint == '' ) {
- // FIXME: $error is undefined
- throw new SMWSparqlDatabaseError(
SMWSparqlDatabaseError::ERROR_NOSERVICE, "SPARQL POST with data: $payload",
'not specified', $error );
+ throw new SMWSparqlDatabaseError(
SMWSparqlDatabaseError::ERROR_NOSERVICE, "SPARQL POST with data: $payload",
'not specified' );
}
curl_setopt( $this->m_curlhandle, CURLOPT_URL,
$this->m_dataEndpoint );
curl_setopt( $this->m_curlhandle, CURLOPT_POST, true );
Modified:
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php
===================================================================
---
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php
2011-09-19 11:33:07 UTC (rev 97470)
+++
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SparqlStoreQueryEngine.php
2011-09-19 11:34:37 UTC (rev 97471)
@@ -527,6 +527,7 @@
$filter = '';
$namespaces = $weakConditions = $orderVariables = array();
$singletonMatchElement = null;
+ $singletonMatchElementName = '';
$hasSafeSubconditions = false;
foreach ( $subDescriptions as $subDescription ) {
$subCondition = $this->buildSparqlCondition(
$subDescription, $joinVariable, null );
@@ -544,7 +545,7 @@
if ( $matchElement instanceof SMWExpNsResource
) {
$namespaces[$matchElement->getNamespaceId()] = $matchElement->getNamespace();
}
- // FIXME: $singletonMatchElementName is
undefined
+
if ( ( $singletonMatchElement !== null ) &&
( $singletonMatchElementName !==
$matchElementName ) ) {
return new SMWSparqlFalseCondition();
Modified:
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SqlStore2IdCache.php
===================================================================
---
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SqlStore2IdCache.php
2011-09-19 11:33:07 UTC (rev 97470)
+++
trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SqlStore2IdCache.php
2011-09-19 11:34:37 UTC (rev 97471)
@@ -48,8 +48,7 @@
$this->m_data[$hashKey] = $row->smw_id;
return $row->smw_id;
} else {
- // FIXME: $index is undefined
- $index->data[$hashKey] = 0;
+ $this->m_data[$hashKey] = 0;
return 0;
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs