1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 
<?php
namespace Omeka\Api\Representation;

/**
 * Provide shared functionality for resource classes and properties.
 */
abstract class AbstractVocabularyMemberRepresentation extends AbstractEntityRepresentation
{
    /**
     * {@inheritDoc}
     */
    public function getJsonLd()
    {
        return [
            'o:local_name' => $this->localName(),
            'o:label' => $this->label(),
            'o:comment' => $this->comment(),
            'o:term' => $this->term(),
            'o:vocabulary' => $this->vocabulary()->getReference(),
        ];
    }

    /**
     * Return this member's vocabulary representation.
     *
     * @return VocabularyRepresentation
     */
    public function vocabulary()
    {
        return $this->getAdapter('vocabularies')
            ->getRepresentation($this->resource->getVocabulary());
    }

    /**
     * Return this member's local name.
     *
     * @return string
     */
    public function localName()
    {
        return $this->resource->getLocalName();
    }

    /**
     * Return this member's label.
     *
     * @return string
     */
    public function label()
    {
        return $this->resource->getLabel();
    }

    /**
     * Return this member's comment.
     *
     * @return string
     */
    public function comment()
    {
        return $this->resource->getComment();
    }

    /**
     * Return this member's term (QName).
     *
     * @return string
     */
    public function term()
    {
        return $this->vocabulary()->prefix() . ':' . $this->localName();
    }

    /**
     * Return this member's full URI
     *
     * @return string
     */
    public function uri()
    {
        return $this->vocabulary()->namespaceUri() . $this->localName();
    }
}