Source for file Blanknode.php

Documentation is available at Blanknode.php

  1. <?php
  2.  
  3. // ----------------------------------------------------------------------------------
  4. // Class: BlankNode
  5. // ----------------------------------------------------------------------------------
  6.  
  7.  
  8.  
  9.  
  10.  
  11. /**
  12. * An RDF blank node.
  13. * In model theory, blank nodes are considered to be drawn from some set of
  14. * 'anonymous' entities which have no label but are unique to the graph.
  15. * For serialization they are labeled with a URI or a _:X identifier.
  16. *
  17. * <BR><BR>History:<UL>
  18. * <LI>07-27-2003 : BlankNode can now receive both MemModel and DbModel as parameter
  19. * <LI>02-21-2003 : getLabel() added.</LI>
  20. * <LI>09-10-2002 : First version of this class.</LI>
  21. * </UL>
  22. *
  23. * @version V0.9.1
  24. * @authors Chris Bizer <chris@bizer.de>,
  25. * Radoslaw Oldakowski <radol@gmx.de>
  26. *
  27. * @package model
  28. * @todo nothing
  29. * @access public
  30. *
  31. */
  32. class BlankNode extends Resource {
  33. /**
  34. * Constructor
  35. * You can supply a label or You supply a model and a unique ID is gernerated
  36. *
  37. * @param mixed $namespace_or_uri_or_model
  38. * @param string $localName
  39. * @access public
  40. * @todo nothing
  41. */
  42. function BlankNode($namespace_or_uri_or_model , $localName = NULL) {
  43. if (is_a($namespace_or_uri_or_model, 'Model')) {
  44. // generate identifier
  45. $id = $namespace_or_uri_or_model->getUniqueResourceURI(BNODE_PREFIX);
  46. $this->uri = $id;
  47.  
  48. } else {
  49. // set identifier
  50. if ($localName == NULL) {
  51. $this->uri = $namespace_or_uri_or_model;
  52. } else {
  53. $this->uri = $namespace_or_uri_or_model . $localName;
  54. }
  55. }
  56. }
  57.  
  58. /**
  59. * Returns the ID of the blank node.
  60. * @return string
  61. * @access public
  62. */
  63. function getID() {
  64. return $this->uri;
  65. }
  66.  
  67. /**
  68. * Returns the ID of the blank node.
  69. * @return string
  70. * @access public
  71. */
  72. function getLabel() {
  73. return $this->uri;
  74. }
  75.  
  76. /**
  77. * Dumps bNode.
  78. *
  79. * @access public
  80. * @return string
  81. */
  82. function toString() {
  83.  
  84. return 'bNode("' . $this->uri . '")';
  85. }
  86. /**
  87. * Checks if two blank nodes are equal.
  88. * Two blank nodes are equal, if they have the same temporary ID
  89. *
  90. * @access public
  91. * @param object resource $that
  92. * @return boolean
  93. */
  94. function equals ($that) {
  95. if ($this == $that) {
  96. return true;
  97. }
  98. if (($that == NULL) or !(is_a($that, 'BlankNode'))) {
  99. return false;
  100. }
  101. if ($this->getURI() == $that->getURI()) {
  102. return true;
  103. }
  104. return false;
  105. }
  106.  
  107. } // end: BlankNode
  108.  
  109.  
  110. ?>

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