Source for file RdqlEngine.php

Documentation is available at RdqlEngine.php

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

Documentation generated on Fri, 17 Dec 2004 16:17:28 +0100 by phpDocumentor 1.3.0RC3