Index: trunk/extensions/SemanticMediaWiki/includes/sparql/SMW_SparqlResultWrapper.php |
— | — | @@ -76,6 +76,27 @@ |
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
| 80 | + * Check if the result is what one would get for a SPARQL ASK query |
| 81 | + * that returned true. Returns false in all other cases (including |
| 82 | + * the case that the results do not look at all like the result of |
| 83 | + * an ASK query). |
| 84 | + * |
| 85 | + * @return boolean |
| 86 | + */ |
| 87 | + public function isBooleanTrue() { |
| 88 | + if ( count( $this->m_data ) == 1 ) { |
| 89 | + $row = reset( $this->m_data ); |
| 90 | + $expElement = reset( $row ); |
| 91 | + if ( ( count( $row ) == 1 ) && ( $expElement instanceof SMWExpLiteral ) && |
| 92 | + ( $expElement->getLexicalForm() == 'true' ) && |
| 93 | + ( $expElement->getDatatype() == 'http://www.w3.org/2001/XMLSchema#boolean' ) ) { |
| 94 | + return true; |
| 95 | + } |
| 96 | + } |
| 97 | + return false; |
| 98 | + } |
| 99 | + |
| 100 | + /** |
80 | 101 | * Reset iterator to position 0. Standard method of Iterator. |
81 | 102 | */ |
82 | 103 | public function rewind() { |