From: <fu...@us...> - 2007-11-15 13:29:06
|
Revision: 549 http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=549&view=rev Author: fusel2k Date: 2007-11-15 05:29:04 -0800 (Thu, 15 Nov 2007) Log Message: ----------- [fix] removed leading char ? or $ from Variable Identifier in Ouput to meet the W3 Standard http://www.w3.org/TR/rdf-sparql-XMLres/ [fix] changed ouput of empty results (the same as if there were results except <results> <results/> is empty now, only containing an short comment. Modified Paths: -------------- trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/XML.php Modified: trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/XML.php =================================================================== --- trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/XML.php 2007-11-15 10:20:18 UTC (rev 548) +++ trunk/rdfapi-php/api/sparql/SparqlEngineDb/ResultRenderer/XML.php 2007-11-15 13:29:04 UTC (rev 549) @@ -126,22 +126,28 @@ if (in_array('*', $arResultVars)) { $arResultVars = array_keys($this->sg->arVarAssignments); } + + foreach ($arResultVars as $var) { + $strVarXML = " <variable name=\"" . substr((string)$var,1) . "\"/>\n"; + } + + $strHeadXml = $this->getHead($strVarXML); - $strHeadXml = $this->getHead( - " <variable name=\"" - . implode( - "\"/>\n <variable name=\"", - $arResultVars - ) - . "\"/>\n" - ); - $arResult = array(); foreach ($arRecordSets as $dbRecordSet) { //work around bug in adodb: // ADORecordSet_empty does not implement php5 iterators if ($dbRecordSet->RowCount() <= 0) { - return array(); + + return + $strHeadXml + . ' <results ordered="' + . self::getSpokenBoolean($arSM['order by'] !== null) + . '" distinct="' + . self::getSpokenBoolean($strResultForm == 'select distinct') + . '">' . "\n" + . ' <!-- empty result -->' . PHP_EOL + . " </results>\n"; } foreach ($dbRecordSet as $row) { @@ -184,7 +190,7 @@ $strCode .= " <result>\n"; foreach ($arSet as $strVarName => $strValue) { if ($strValue !== null) { - $strCode .= ' <binding name="' . $strVarName . '">' + $strCode .= ' <binding name="' . substr($strVarName,1) . '">' . $strValue . "</binding>\n"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |