You are here

public function EasyRdfConverter::getRangeDataTypes in Schema.org configuration tool (RDF UI) 8

Gets data types in range of the property.

Parameters

string $uri: URI of the resource (eg: schema:name).

Return value

array|null Array containing URIs of the datatype, if not null.

File

src/EasyRdfConverter.php, line 260

Class

EasyRdfConverter
Extracts details of RDF resources from an RDFa document.

Namespace

Drupal\rdfui

Code

public function getRangeDataTypes($uri) {
  if (empty($uri)) {
    \Drupal::messenger()
      ->addStatus($this
      ->t("Invalid URI"));
    return NULL;
  }
  $range_datatypes = $this->graph
    ->allResources($uri, "schema:rangeIncludes");
  if (!empty($range_datatypes)) {
    $range_datatype_uris = array();
    foreach ($range_datatypes as $type) {
      array_push($range_datatype_uris, $type
        ->getUri());
    }
    return $range_datatype_uris;
  }
  return NULL;
}