source: Dev/trunk/rdfapi/rdql/RdqlEngine.php @ 12

Last change on this file since 12 was 12, checked in by basvannuland, 14 years ago

Added RAP RDF API
Added RDF reader writer for save and load survey

File size: 2.0 KB
Line 
1<?php
2
3// ----------------------------------------------------------------------------------
4// Class: RdqlEngine
5// ----------------------------------------------------------------------------------
6
7/**
8 * Some general methods common for RdqlMemEngine and RdqlDbEngine
9 *
10 * @version  $Id: RdqlEngine.php 268 2006-05-15 05:28:09Z tgauss $
11 * @author   Radoslaw Oldakowski <radol@gmx.de>
12 *
13 * @package rdql
14 * @access public
15 */
16
17Class RdqlEngine extends Object{
18
19       
20
21/**
22 * Prints a query result as HTML table.
23 * You can change the colors in the configuration file.
24 *
25 * @param array $queryResult [][?VARNAME] = object Node
26 * @access private
27 */
28 function writeQueryResultAsHtmlTable($queryResult) {
29          // Import Package Utility
30         include_once(RDFAPI_INCLUDE_DIR.PACKAGE_UTILITY);
31
32   if (current($queryResult[0]) == NULL) {
33      echo 'no match<br>';
34      return;
35   }
36
37   $rdfUtil = new RDFUtil();
38        echo '<table border="1" cellpadding="3" cellspacing="0"><tr><td><b>No.</b></td>';
39   foreach ($queryResult[0] as $varName => $value)
40     echo "<td align='center'><b>$varName</b></td>";
41     echo '</tr>';
42
43   foreach ($queryResult as $n => $var) {
44
45               
46     echo '<tr><td width="20" align="right">' .($n + 1) .'.</td>';
47     foreach ($var as $varName => $value) {
48       echo INDENTATION . INDENTATION . '<td bgcolor="';
49           echo $rdfutil->chooseColor($value);
50       echo '">';
51       echo '<p>';
52
53       $lang  = NULL;
54       $dtype = NULL;
55       if (is_a($value, 'Literal')) {
56           if ($value->getLanguage() != NULL)
57               $lang = ' <b>(xml:lang="' . $value->getLanguage() . '") </b> ';
58                   if ($value->getDatatype() != NULL)
59                          $dtype = ' <b>(rdf:datatype="' . $value->getDatatype() . '") </b> ';
60       }
61           echo  $rdfutil->getNodeTypeName($value) .$value->getLabel() . $lang . $dtype .'</p>';
62     }
63     echo '</tr>';
64   }
65   echo '</table>';
66 }
67 
68} // end: Class RdqlEngine
69
70?>
Note: See TracBrowser for help on using the repository browser.