Source for file IteratorAllGraphsDb.php

Documentation is available at IteratorAllGraphsDb.php

  1. <?php
  2. /**
  3. * ----------------------------------------------------------------------------------
  4. * Class: IteratorAllGraphsDb
  5. * ----------------------------------------------------------------------------------
  6. *
  7. * @package dataset
  8. */
  9.  
  10.  
  11. /**
  12. * Implementation of a Graph iterator.
  13. *
  14. * This Iterator should be used in a for-loop like:
  15. * for($iterator = $dataset->listGraphs(); $iterator->valid(); $iterator->next())
  16. * {
  17. * $currentResource=$iterator->current();
  18. * };
  19. *
  20. * <BR><BR>History:
  21. * <LI>05-03-2005 : First version of this class.</LI>
  22. *
  23. * @version V0.9.1
  24. * @author Daniel Westphal <mail at d-westphal dot de>
  25. *
  26. *
  27. * @package dataset
  28. * @access public
  29. ***/
  30. class IteratorAllGraphsDb
  31. {
  32. /**
  33. * Holds a reference to the associated DB resultSet
  34. * @var $dbResultSets ADODB result
  35. * @access private
  36. */
  37. var $dbResultSet;
  38. /**
  39. * Holds a reference to the associated datasetDb
  40. * @var datasetDb
  41. * @access private
  42. */
  43. var $datasetDb;
  44. /**
  45. * The current position
  46. * @var integer
  47. * @access private
  48. */
  49. var $key;
  50. /**
  51. * The current NamedGraph
  52. * @var obejct NamedGraph
  53. * @access private
  54. */
  55. var $current;
  56. /**
  57. * Constructor.
  58. *
  59. *
  60. * @param ADODBResultSet
  61. * @param DatasetDb
  62. * @access public
  63. */
  64. function IteratorAllGraphsDb(&$dbResultSet,&$datasetDb)
  65. {
  66. $this->dbResultSet=& $dbResultSet;
  67. $this->datasetDb=& $datasetDb;
  68. $this->current = $this->dbResultSet->fields[0];
  69. }
  70. /**
  71. * Resets iterator list to start
  72. *
  73. * @access public
  74. */
  75. function rewind()
  76. {
  77. //not supported
  78. }
  79. /**
  80. * Says if there are additional items left in the list
  81. *
  82. * @return boolean
  83. * @access public
  84. */
  85. function valid()
  86. {
  87. return (!$this->dbResultSet->EOF);
  88. }
  89. /**
  90. * Moves Iterator to the next item in the list
  91. *
  92. * @access public
  93. */
  94. function next()
  95. {
  96. $this->dbResultSet->moveNext();
  97. $this->current = $this->dbResultSet->fields[0];
  98. }
  99. /**
  100. * Returns the current item
  101. *
  102. * @return mixed
  103. * @access public
  104. */
  105. function &current()
  106. {
  107. return ($this->datasetDb->getNamedGraph($this->current));
  108. }
  109. /**
  110. * Returns the key of the current item
  111. *
  112. * @return integer
  113. * @access public
  114. */
  115. function key()
  116. {
  117. return $this->dbResultSet->_currentRow;
  118. }
  119. }
  120. ?>

Documentation generated on Thu, 7 Jul 2005 13:41:45 +0200 by phpDocumentor 1.3.0RC3