Source for file GraphPattern.php

Documentation is available at GraphPattern.php

  1. <?php
  2. // ---------------------------------------------
  3. // class: GraphPattern
  4. // ---------------------------------------------
  5.  
  6. /**
  7. * A graph pattern which consists of triple patterns, optional
  8. * or union graph patterns and filters.
  9. *
  10. * <BR><BR>History:<UL>
  11. * <LI>08.09.2005: Initial version</LI>
  12. *
  13. * @author Tobias Gauss <tobias.gauss@web.de>
  14. * @version 0.9.3
  15. *
  16. * @package sparql
  17. */
  18.  
  19. Class GraphPattern extends Object{
  20.  
  21. /**
  22. * Graphname. 0 if its in the default graph.
  23. */
  24. private $graphname;
  25.  
  26. /**
  27. * @var array The TriplePattern.
  28. */
  29. private $triplePattern;
  30.  
  31. /**
  32. * @var array A List of Constraints.
  33. */
  34. private $constraint = array();
  35.  
  36. /**
  37. * @var int Pointer to optional patterns.
  38. */
  39. private $optional;
  40.  
  41. /**
  42. * @var int Pointer to union patterns.
  43. */
  44. private $union;
  45.  
  46. /**
  47. * @var boolean TRUE if the pattern is open- FALSE if closed.
  48. */
  49. public $open;
  50.  
  51. /**
  52. * @var boolean TRUE if the GraphPattern is a construct pattern.
  53. */
  54. public $isConstructPattern;
  55.  
  56.  
  57. /**
  58. * @var int The GraphPatterns id.
  59. */
  60. public $patternId;
  61.  
  62.  
  63. /**
  64. * Constructor
  65. */
  66. public function GraphPattern(){
  67. $this->open = true ;
  68. $this->isConstructPattern = false;
  69. $this->constraint = false;
  70. $this->triplePattern = false;
  71. }
  72.  
  73. /**
  74. * Returns the graphname.
  75. *
  76. * @return String
  77. */
  78. public function getGraphname(){
  79. return $this->graphname;
  80. }
  81.  
  82. /**
  83. * Returns the triple pattern of the graph pattern.
  84. *
  85. * @return Array
  86. */
  87. public function getTriplePattern(){
  88. return $this->triplePattern;
  89. }
  90.  
  91. /**
  92. * Returns a constraint if there is one false if not.
  93. *
  94. * @return Constraint
  95. */
  96. public function getConstraint(){
  97. return $this->constraint;
  98. }
  99.  
  100. /**
  101. * Returns a pointer to an optional graph pattern.
  102. *
  103. * @return integer
  104. */
  105. public function getOptional(){
  106. return $this->optional;
  107. }
  108.  
  109. /**
  110. * Returns a pointer to a union graph pattern.
  111. *
  112. * @return integer
  113. */
  114. public function getUnion(){
  115. return $this->union;
  116. }
  117.  
  118. /**
  119. * Sets the graphname.
  120. *
  121. * @param String $name
  122. * @return void
  123. */
  124. public function setGraphname($name){
  125. $this->graphname = $name;
  126. }
  127. /**
  128. * Adds a List of QueryTriples to the GraphPattern.
  129. *
  130. * @param array $trpP
  131. * @return void
  132. */
  133. public function addTriplePattern($trpP){
  134. $this->triplePattern = $trpP;
  135. }
  136.  
  137. /**
  138. * Adds a Constraint to the GraphPattern.
  139. *
  140. * @param Constraint $cons
  141. * @return void
  142. */
  143. public function addConstraint($cons){
  144. $this->constraint[] = $cons;
  145. }
  146. /**
  147. * Adds a pointer to an optional graphPattern.
  148. *
  149. * @param integer $pattern
  150. * @return void
  151. */
  152. public function addOptional($pattern){
  153. $this->optional = &$pattern;
  154. }
  155.  
  156. /**
  157. * Adds a pointer to a union graphPattern.
  158. *
  159. * @param integer $pattern
  160. * @return void
  161. */
  162. public function addUnion($pattern){
  163. $this->union = &$pattern;
  164. }
  165.  
  166.  
  167. /**
  168. * Sets the GraphPatterns Id.
  169. *
  170. * @param integer $id
  171. * @return void
  172. */
  173. public function setId($id){
  174. $this->patternId = $id;
  175. }
  176.  
  177. /**
  178. * Returns the GraphPatterns id.
  179. *
  180. * @return integer
  181. */
  182. public function getId(){
  183. return $this->patternId;
  184. }
  185.  
  186. }
  187. // end class: GraphPattern.php
  188. ?>

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