class EntitySchema

Defines RDF terms corresponding to Drupal entity types.

Hierarchy

Expanded class hierarchy of EntitySchema

2 files declare their use of EntitySchema
BundleSchema.php in drupal/core/modules/rdf/lib/Drupal/rdf/SiteSchema/BundleSchema.php
Contains BundleSchema.
SiteSchema.php in drupal/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SiteSchema.php
Contains SiteSchema.

File

drupal/core/modules/rdf/lib/Drupal/rdf/SiteSchema/EntitySchema.php, line 16
Contains EntitySchema.

Namespace

Drupal\rdf\SiteSchema
View source
class EntitySchema extends SchemaTermBase {

  /**
   * The URI pattern for entity site schema terms.
   *
   * @var string
   */
  public static $uriPattern = '{entity_type}';

  /**
   * The entity type that this term identifies.
   *
   * @var string
   */
  protected $entityType;

  /**
   * Constructor.
   *
   * @param \Drupal\rdf\SiteSchema\SiteSchema $site_schema
   *   The schema the term is defined in.
   * @param string $entity_type
   *   The entity type.
   */
  public function __construct($site_schema, $entity_type) {
    parent::__construct($site_schema);
    $this->entityType = $entity_type;
  }

  /**
   * Implements \Drupal\rdf\SiteSchema\SchemaTermInterface::getGraph().
   *
   * @todo Loop through all fields and add their RDF descriptions.
   */
  public function getGraph() {
    $graph = array();
    $graph[$this
      ->getUri()] = $this
      ->getProperties();
    return $graph;
  }

  /**
   * Implements \Drupal\rdf\SiteSchema\SchemaTermInterface::getUri().
   */
  public function getUri() {
    $path = str_replace('{entity_type}', $this->entityType, static::$uriPattern);
    return $this->siteSchema
      ->getUri() . '/' . $path;
  }

  /**
   * Overrides \Drupal\rdf\SiteSchema\SchemaTermBase::getProperties().
   */
  public function getProperties() {
    $properties = parent::getProperties();
    $properties[RdfConstants::RDF_TYPE] = RdfConstants::RDFS_CLASS;
    return $properties;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntitySchema::$entityType protected property The entity type that this term identifies.
EntitySchema::$uriPattern public static property The URI pattern for entity site schema terms. Overrides SchemaTermBase::$uriPattern 1
EntitySchema::getGraph public function Implements \Drupal\rdf\SiteSchema\SchemaTermInterface::getGraph(). Overrides SchemaTermInterface::getGraph
EntitySchema::getProperties public function Overrides \Drupal\rdf\SiteSchema\SchemaTermBase::getProperties(). Overrides SchemaTermBase::getProperties 1
EntitySchema::getUri public function Implements \Drupal\rdf\SiteSchema\SchemaTermInterface::getUri(). Overrides SchemaTermInterface::getUri 1
EntitySchema::__construct public function Constructor. Overrides SchemaTermBase::__construct 1
SchemaTermBase::$siteSchema protected property The schema in which this term is defined.