Model/Tag.php
author cavaliet
Mon, 24 Oct 2011 19:08:04 +0200
changeset 12 81cc9274c20a
parent 11 5f038a505cd7
child 14 673b2766024e
permissions -rwxr-xr-x
Update Tag alias.

<?php
/*
 * This file is part of the WikiTagBundle package.
 *
 * (c) IRI <http://www.iri.centrepompidou.fr/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
 namespace IRI\Bundle\WikiTagBundle\Model;
 
 use IRI\Bundle\WikiTagBundle\Utils\WikiTagUtils;

abstract class Tag implements TagInterface {
    
    public static $TAG_URL_STATUS_DICT = array('null_result'=>0,'redirection'=>1,'homonyme'=>2,'match'=>3);
     
    /**
     * @var integer $id
     */
    protected $id;

    /**
     * @var string $label
     */
    protected $label;

    /**
     * @var string $normalizedLabel
     */
    protected $normalizedLabel;

    /**
     * @var string $originalLabel
     */
    protected $originalLabel;

    /**
     * @var string $alias
     */
    protected $alias;

    /**
     * @var string $wikipediaUrl
     */
    protected $wikipediaUrl;

    /**
     * @var bigint $wikipediaPageId
     */
    protected $wikipediaPageId;

    /**
     * @var smallint $urlStatus
     */
    protected $urlStatus;

    /**
     * @var string $dbpediaUri
     */
    protected $dbpediaUri;

    /**
     * @var integer $popularity
     */
    protected $popularity = 0;

    /**
     * @var object $category
     */
    protected $category;


    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set label
     *
     * @param string $label
     */
    public function setLabel($label)
    {
        $this->label = $label;
        $this->normalizedLabel = WikiTagUtils::normalizeTag($label);
    }

    /**
     * Get label
     *
     * @return string
     */
    public function getLabel()
    {
        return $this->label;
    }

    /**
     * Set normalizedLabel
     *
     * @param string $normalizedLabel
     */
    public function setNormalizedLabel($normalizedLabel)
    {
        $this->normalizedLabel = $normalizedLabel;
    }

    /**
     * Get normalizedLabel
     *
     * @return string
     */
    public function getNormalizedLabel()
    {
        return $this->normalizedLabel;
    }

    /**
     * Set originalLabel
     *
     * @param string $originalLabel
     */
    public function setOriginalLabel($originalLabel)
    {
        $this->originalLabel = $originalLabel;
    }

    /**
     * Get originalLabel
     *
     * @return string
     */
    public function getOriginalLabel()
    {
        return $this->originalLabel;
    }

    /**
     * Set alias
     *
     * @param string $alias
     */
    public function setAlias($alias)
    {
        $this->alias = $alias;
    }

    /**
     * Get alias
     *
     * @return string
     */
    public function getAlias()
    {
        return $this->alias;
    }

    /**
     * Set wikipediaUrl
     *
     * @param string $wikipediaUrl
     */
    public function setWikipediaUrl($wikipediaUrl)
    {
        $this->wikipediaUrl = $wikipediaUrl;
    }

    /**
     * Get wikipediaUrl
     *
     * @return string
     */
    public function getWikipediaUrl()
    {
        return $this->wikipediaUrl;
    }

    /**
     * Set wikipediaPageId
     *
     * @param bigint $wikipediaPageId
     */
    public function setWikipediaPageId($wikipediaPageId)
    {
        $this->wikipediaPageId = $wikipediaPageId;
    }

    /**
     * Get wikipediaPageId
     *
     * @return bigint
     */
    public function getWikipediaPageId()
    {
        return $this->wikipediaPageId;
    }

    /**
     * Set urlStatus
     *
     * @param smallint $urlStatus
     */
    public function setUrlStatus($urlStatus)
    {
        $this->urlStatus = $urlStatus;
    }

    /**
     * Get urlStatus
     *
     * @return smallint
     */
    public function getUrlStatus()
    {
        return $this->urlStatus;
    }
    
    /**
    * Get UrlStatusText
    *
    * @return string
    */
    public function getUrlStatusText()
    {
        switch ($this->getUrlStatus()) {
            case 0:
                return "null_result";
            case 1:
                return "redirection";
            case 2:
                return "homonyme";
            case 3:
                return "match";
        }
    }
    

    /**
     * Set dbpediaUri
     *
     * @param string $dbpediaUri
     */
    public function setDbpediaUri($dbpediaUri)
    {
        $this->dbpediaUri = $dbpediaUri;
    }

    /**
     * Get dbpediaUri
     *
     * @return string
     */
    public function getDbpediaUri()
    {
        return $this->dbpediaUri;
    }

    /**
     * Set popularity
     *
     * @param integer $popularity
     */
    public function setPopularity($popularity)
    {
        $this->popularity = $popularity;
    }

    /**
     * Get popularity
     *
     * @return integer
     */
    public function getPopularity()
    {
        return $this->popularity;
    }

    /**
    * Set category
    *
    * @param object $category
    */
    public function setCategory($category)
    {
        $this->category = $category;
    }
    
    /**
     * Get category
     *
     * @return object
     */
    function getCategory()
    {
        return $this->category;
    }
    
    /**
     * Set category to Null
     *
     */
    function nullCategory()
    {
        return $this->setCategory(NULL);
    }
    
     
 }