Source for file RdqlEngine.php

Documentation is available at RdqlEngine.php

  1. <?php
  2.  
  3. // ----------------------------------------------------------------------------------
  4. // Class: RdqlEngine
  5. // ----------------------------------------------------------------------------------
  6.  
  7. /**
  8. * Some general methods common for RdqlMemEngine and RdqlDbEngine
  9. *
  10. * <BR><BR>History:<UL>
  11. * <LI>07-27-2003 : First version of this class</LI>
  12. *
  13. * @version V0.9.3
  14. * @author Radoslaw Oldakowski <radol@gmx.de>
  15. *
  16. * @package rdql
  17. * @access public
  18. */
  19.  
  20. Class RdqlEngine extends Object{
  21.  
  22.  
  23. /**
  24. * Prints a query result as HTML table.
  25. * You can change the colors in the configuration file.
  26. *
  27. * @param array $queryResult [][?VARNAME] = object Node
  28. * @access private
  29. */
  30. function writeQueryResultAsHtmlTable($queryResult) {
  31. // Import Package Utility
  32. include_once(RDFAPI_INCLUDE_DIR.PACKAGE_UTILITY);
  33.  
  34. if (current($queryResult[0]) == NULL) {
  35. echo ''no match<br>'';
  36. return;
  37. }
  38.  
  39. echo ''<table border="1" cellpadding="3" cellspacing="0"><tr><td><b>No.</b></td>'';
  40. foreach ($queryResult[0] as $varName => $value)
  41. echo "<td align=''center''><b>$varName</b></td>";
  42. echo ''</tr>'';
  43.  
  44. foreach ($queryResult as $n => $var) {
  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. } // end: Class RdqlEngine
  68.  
  69. ?>

Documentation generated on Fri, 13 Jan 2006 07:49:13 +0100 by phpDocumentor 1.3.0RC4