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. @version  $Id: fsource_resModel__resModelResAlt.php.html 443 2007-06-01 16:25:38Z cax $
  11. @author Daniel Westphal <mail at d-westphal dot de>
  12. *
  13. @package     resModel
  14. @access    public
  15. ***/
  16. class ResAlt extends ResContainer 
  17. {
  18.     
  19.     /**
  20.     * Constructor
  21.     * You can supply a URI
  22.     *
  23.     * @param string $uri 
  24.     * @access    public
  25.     */    
  26.     function ResAlt($uri null)
  27.     {
  28.         parent::ResContainer($uri);
  29.         $this->containerType=new ResResource(RDF_NAMESPACE_URI.RDF_ALT);
  30.     }
  31.     
  32.     /**
  33.     *  Return the default value for this resource
  34.     *
  35.        * @return    object ResResource/ResLiteral 
  36.        * @access    public
  37.        */
  38.     function getDefault()
  39.     {
  40.         //get the first memeber
  41.         $statements=$this->listProperties($this->_getMembershipPropertyWithIndex(1));
  42.         if(isset($statements[0]))
  43.         {
  44.             //return the value
  45.             return $statements[0]->getObject();
  46.         else 
  47.         {
  48.             return null;
  49.         }
  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, 1 Jun 2007 16:51:21 +0200 by phpDocumentor 1.3.2