summaryrefslogtreecommitdiffstats
path: root/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php')
-rw-r--r--core/vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php29
1 files changed, 16 insertions, 13 deletions
diff --git a/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php b/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php
index 6bc7f62..22001e9 100644
--- a/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php
+++ b/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Result.php
@@ -5,7 +5,7 @@
*
* LICENSE
*
- * Copyright (c) 2009-2012 Nicholas J Humfrey. All rights reserved.
+ * Copyright (c) 2009-2013 Nicholas J Humfrey. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -31,16 +31,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* @package EasyRdf
- * @copyright Copyright (c) 2009-2012 Nicholas J Humfrey
+ * @copyright Copyright (c) 2009-2013 Nicholas J Humfrey
* @license http://www.opensource.org/licenses/bsd-license.php
- * @version $Id$
*/
/**
* Class for returned for SPARQL SELECT and ASK query responses.
*
* @package EasyRdf
- * @copyright Copyright (c) 2009-2012 Nicholas J Humfrey
+ * @copyright Copyright (c) 2009-2013 Nicholas J Humfrey
* @license http://www.opensource.org/licenses/bsd-license.php
*/
class EasyRdf_Sparql_Result extends ArrayIterator
@@ -152,13 +151,13 @@ class EasyRdf_Sparql_Result extends ArrayIterator
* This method is intended to be a debugging aid and will
* return a pretty-print view of the query result.
*
- * @param bool $html Set to true to format the dump using HTML
+ * @param string $format Either 'text' or 'html'
*/
- public function dump($html = true)
+ public function dump($format = 'html')
{
if ($this->type == 'bindings') {
$result = '';
- if ($html) {
+ if ($format == 'html') {
$result .= "<table class='sparql-results' style='border-collapse:collapse'>";
$result .= "<tr>";
foreach ($this->fields as $field) {
@@ -170,9 +169,13 @@ class EasyRdf_Sparql_Result extends ArrayIterator
foreach ($this as $row) {
$result .= "<tr>";
foreach ($this->fields as $field) {
- $result .= "<td style='border:solid 1px #000;padding:4px;".
- "vertical-align:top'>".
- $row->$field->dumpValue($html)."</td>";
+ if (isset($row->$field)) {
+ $result .= "<td style='border:solid 1px #000;padding:4px;".
+ "vertical-align:top'>".
+ $row->$field->dumpValue($format)."</td>";
+ } else {
+ $result .= "<td>&nbsp;</td>";
+ }
}
$result .= "</tr>";
}
@@ -188,7 +191,7 @@ class EasyRdf_Sparql_Result extends ArrayIterator
foreach ($this as $row) {
$textRow = array();
foreach ($row as $k => $v) {
- $textRow[$k] = $v->dumpValue(false);
+ $textRow[$k] = $v->dumpValue('text');
$width = strlen($textRow[$k]);
if ($colWidths[$k] < $width) {
$colWidths[$k] = $width;
@@ -224,7 +227,7 @@ class EasyRdf_Sparql_Result extends ArrayIterator
return $result;
} elseif ($this->type == 'boolean') {
$str = ($this->boolean ? 'true' : 'false');
- if ($html) {
+ if ($format == 'html') {
return "<p>Result: <span style='font-weight:bold'>$str</span></p>";
} else {
return "Result: $str";
@@ -375,7 +378,7 @@ class EasyRdf_Sparql_Result extends ArrayIterator
if ($this->type == 'boolean') {
return $this->boolean ? 'true' : 'false';
} else {
- return $this->dump(false);
+ return $this->dump('text');
}
}
}