Source for file Blanknode.php

Documentation is available at Blanknode.php

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

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