Source for file ResAlt.php

Documentation is available at ResAlt.php

  1. <?PHP
  2. // ----------------------------------------------------------------------------------
  3. // Class: ResAlt
  4. // ----------------------------------------------------------------------------------
  5.  
  6. /**
  7. * This interface defines methods for accessing RDF Alternative resources.
  8. * These methods operate on the RDF statements contained in a model.
  9. *
  10. * <BR><BR>History:<UL>
  11. * <LI>10-01-2004 : First version of this class.</LI>
  12. *
  13. * @version V0.9.3
  14. * @author Daniel Westphal <mail at d-westphal dot de>
  15. *
  16. * @package resModel
  17. * @access public
  18. ***/
  19. class ResAlt extends ResContainer
  20. {
  21. /**
  22. * Constructor
  23. * You can supply a URI
  24. *
  25. * @param string $uri
  26. * @access public
  27. */
  28. function ResAlt($uri = null)
  29. {
  30. parent::ResContainer($uri);
  31. $this->containerType=new ResResource(RDF_NAMESPACE_URI.RDF_ALT);
  32. }
  33. /**
  34. * Return the default value for this resource
  35. *
  36. * @return object ResResource/ResLiteral
  37. * @access public
  38. */
  39. function getDefault()
  40. {
  41. //get the first memeber
  42. $statements=$this->listProperties($this->_getMembershipPropertyWithIndex(1));
  43. if(isset($statements[0]))
  44. {
  45. //return the value
  46. return $statements[0]->getObject();
  47. } else
  48. {
  49. return null;
  50. }
  51. }
  52. /**
  53. * Set the default value of this container.
  54. *
  55. * @param object ResResource/ResLiteral $object
  56. * @access public
  57. */
  58. function setDefault($object)
  59. {
  60. //remember the old default value
  61. $oldDefaultObject=$this->getDefault();
  62. //if there wasn''t a default value before
  63. if($oldDefaultObject === null)
  64. {
  65. //add the new value
  66. $this->addProperty($this->_getMembershipPropertyWithIndex(1),$object);
  67. } else
  68. {
  69. //remove the old value
  70. $this->removeAll($this->_getMembershipPropertyWithIndex(1));
  71. //set the new value
  72. $this->addProperty($this->_getMembershipPropertyWithIndex(1),$object);
  73. //add the old default value at the end
  74. $this->add($oldDefaultObject);
  75. }
  76. }
  77. }
  78. ?>

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