Defines RDF terms corresponding to Drupal entity types.
Expanded class hierarchy of EntitySchema
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;
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntitySchema:: |
protected | property | The entity type that this term identifies. | |
EntitySchema:: |
public static | property |
The URI pattern for entity site schema terms. Overrides SchemaTermBase:: |
1 |
EntitySchema:: |
public | function |
Implements \Drupal\rdf\SiteSchema\SchemaTermInterface::getGraph(). Overrides SchemaTermInterface:: |
|
EntitySchema:: |
public | function |
Overrides \Drupal\rdf\SiteSchema\SchemaTermBase::getProperties(). Overrides SchemaTermBase:: |
1 |
EntitySchema:: |
public | function |
Implements \Drupal\rdf\SiteSchema\SchemaTermInterface::getUri(). Overrides SchemaTermInterface:: |
1 |
EntitySchema:: |
public | function |
Constructor. Overrides SchemaTermBase:: |
1 |
SchemaTermBase:: |
protected | property | The schema in which this term is defined. |