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.  *
  15.  * @version  $Id: fsource_model__modelBlanknode.php.html 443 2007-06-01 16:25:38Z cax $
  16.  * @authors Chris Bizer <chris@bizer.de>,
  17.  *           Radoslaw Oldakowski <radol@gmx.de>
  18.  *
  19.  * @package model
  20.  * @access    public
  21.  *
  22.  */ 
  23.  class BlankNode extends Resource {
  24.   
  25.    /**
  26.     * Constructor
  27.     * You can supply a label or You supply a model and a unique ID is gernerated.
  28.     *
  29.     * @param    mixed    $namespace_or_uri_or_model 
  30.      * @param     string $localName 
  31.     * @access    public
  32.     */
  33.     function BlankNode($namespace_or_uri_or_model $localName NULL{
  34.         
  35.         if (is_a($namespace_or_uri_or_model'Model')) {
  36.             // generate identifier
  37.             $id $namespace_or_uri_or_model->getUniqueResourceURI(BNODE_PREFIX);
  38.             
  39.             $this->uri $id;
  40.  
  41.         else {
  42.             // set identifier
  43.             if ($localName == NULL{
  44.                 $this->uri $namespace_or_uri_or_model;
  45.               else {
  46.                 $this->uri $namespace_or_uri_or_model $localName;
  47.               }
  48.          }
  49.     }
  50.  
  51.   /**
  52.    * Returns the ID of the blank node.
  53.    *
  54.    * @return     string 
  55.    * @access    public
  56.    */    
  57.   function getID({
  58.               return $this->uri;
  59.    }
  60.  
  61.   /**
  62.    * Returns the ID of the blank node.
  63.    *
  64.    * @return     string 
  65.    * @access    public
  66.    */    
  67.   function getLabel({
  68.           return $this->uri;
  69.    }
  70.  
  71.   /**
  72.    * Dumps bNode.
  73.    *
  74.    * @access    public
  75.    * @return    string 
  76.    */  
  77.   function toString({
  78.  
  79.         return 'bNode("' $this->uri '")';
  80.   }
  81.     
  82.   /**
  83.    * Checks if two blank nodes are equal.
  84.    * Two blank nodes are equal, if they have the same temporary ID.
  85.    *
  86.    * @access    public
  87.    * @param        object    resource $that 
  88.    * @return    boolean 
  89.    */  
  90.    function equals ($that{
  91.     
  92.         if ($this == $that{
  93.           return true;
  94.         }
  95.         if (($that == NULLor !(is_a($that'BlankNode'))) {
  96.           return false;
  97.         }
  98.             
  99.         if ($this->getURI(== $that->getURI()) {
  100.           return true;
  101.         }
  102.     
  103.         return false;
  104.     }
  105.  
  106. // end: BlankNode 
  107.  
  108.  
  109. ?>

Documentation generated on Fri, 1 Jun 2007 16:48:33 +0200 by phpDocumentor 1.3.2