<?php
/**
 * This file is part of the set of generic classes available for implementations
 * of the DDR Simple API to speed up implementation. It contains a generic
 * implementation of the {@link PropertyName} interface.
 * 
 * @author Sylvain Lequeux
 * @author Francois Daoust <fd@w3.org>
 * @package AskPythia
 * @subpackage Implementation
 * @version $Revision: 1.9 $
 * @license http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html W3C Software Notice and License
 * @copyright Copyright (c) 2009, W3C (MIT, ERCIM, Keio) 
 */

/**
 * Include the {@link PropertyName} interface description.
 */
require_once(dirname(__FILE__).'/../../interface/propertyName.php');
/**
 * Include the {@link SystemException} class description.
 */
require_once(dirname(__FILE__).'/../../interface/systemException.php');

/**
 * A basic {@link PropertyName} holds the IRI of the vocabulary associated with
 * a property and its local name within that vocabulary. 
 * 
 * @author Sylvain Lequeux
 * @author Francois Daoust <fd@w3.org>
 * @package AskPythia
 * @subpackage Implementation
 * @link http://www.w3.org/TR/DDR-Simple-API/ Device Description Repository Simple API
 * @version $Revision: 1.9 $
 * @license http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html W3C Software Notice and License
 * @copyright Copyright (c) 2009, W3C (MIT, ERCIM, Keio)
 */
class BasicPropertyName implements PropertyName{
	/**
	 * @var string The name of the property.
	 * @access private
	 */
	private $name;
	/**
	 * @var string The IRI of the vocabulary the property belongs to.
	 * @access private
	 */
	private $namespace;
	
	/**
	 * Builds a property name using the given namespace and local name.
	 * 
	 * @param string $namepace The IRI of the vocabulary the property belongs to.
	 * @param string $name The local name of the property within the vocabulary.
	 * @exception SystemException One of the arguments is null. 
	 * @access public
	 */
	public function __construct($namespace, $name){//$namepace => $namespace
		if (!isset($namespace)){
			throw new SystemException(
				"Namespace cannot be null.",
				SystemException::$ILLEGAL_ARGUMENT);
		}
		if (!isset($name)){
			throw new SystemException(
				"Local property name cannot be null.",
				SystemException::$ILLEGAL_ARGUMENT);
		}
		$this->namespace = $namespace;
		$this->name = $name;
	}
	
	public function getLocalPropertyName(){
		return $this->name;
	}
	
	public function getNamespace(){
		return $this->namespace;
	}
}

?>