Location: PHPKode > scripts > RDF API > rdf-api/model/BlankNode.php
<?php

// ----------------------------------------------------------------------------------
// Class: BlankNode
// ----------------------------------------------------------------------------------


/**
 * An RDF blank node. 
 * In model theory, blank nodes are considered to be drawn from some set of 
 * 'anonymous' entities which have no label but are unique to the graph.
 * For serialization they are labeled with a URI or a _:X identifier.
 * 
 * History:
 * 09-10-2002                : First version of this class.
 *
 * @version  V0.1
 * @author Chris Bizer <hide@address.com>
 *
 * @package model
 * @todo nothing
 * @access	public
 *
 */ 
 class BlankNode extends Resource {
  
   /**
    * Constructor
	* You can supply a label or You supply a model and a unique ID is gernerated
    *
    * @param	mixed	$namespace_or_uri_or_model
 	* @param	string	$localName
	* @access	public
    */
    function BlankNode($namespace_or_uri_or_model , $localName = NULL) {
		
		if (is_a($namespace_or_uri_or_model, "Model")) {
			// generate identifier
			$id = $namespace_or_uri_or_model->getUniqueResourceURI(BNODE_PREFIX);
			
			$this->uri = $id;
		} else { 
			// set identifier
			if ($localName == NULL) {
				$this->uri = $namespace_or_uri_or_model;
		  	} else {
				$this->uri = $namespace_or_uri_or_model . $localName;
	  	    }
		 }
    }

  /**
   * Returns the ID of the blank node.
   * @return 	string
   * @access	public  
   */	
  function getID() {
  			return $this->uri;
   }
	
  /**
   * Checks if two blank nodes are equal.
   * Two blank nodes are equal, if they have the same temporary ID
   *
   * @access	public 
   * @param		object	resource $that
   * @return	boolean 
   */  
   function equals ($that) {
	
	    if ($this == $that) {
	      return true;
	    }
	    if (($that == NULL) or !(is_a($that, "BlankNode"))) {
	      return false;
	    }
	    	
		if ($this->getURI() == $that->getURI()) {
	      return true;
	    }
	
	    return false;
	}
	
  /**
   * Dumps bNode.
   *
   * @access	public 
   * @return	string 
   */  
  function toString() {
	$dump = "bNode(\"" . $this->uri ."\")";
    return $dump;
  }
} // end: BlankNode 


?>
Return current item: RDF API