You are here

private function EasyRdfConverter::getProperties in Schema.org configuration tool (RDF UI) 8

Recursive function to extract properties.

Parameters

string $uri: URI of schema type.

Return value

array|null Array of properties of the type and all parent types.

1 call to EasyRdfConverter::getProperties()
EasyRdfConverter::getTypeProperties in src/EasyRdfConverter.php
Extracts properties of a given type.

File

src/EasyRdfConverter.php, line 186

Class

EasyRdfConverter
Extracts details of RDF resources from an RDFa document.

Namespace

Drupal\rdfui

Code

private function getProperties($uri) {
  $resource = array(
    "type" => "uri",
    "value" => $uri,
  );
  $property_list = $this->graph
    ->resourcesMatching("http://schema.org/domainIncludes", $resource);
  $options = array();
  foreach ($property_list as $value) {

    // Omit deprecated properties.
    if ($value
      ->get("schema:supersededBy")) {
      continue;
    }
    $options[$value
      ->shorten()] = $value
      ->get("rdfs:label")
      ->getValue();
  }
  $parents = $this->graph
    ->all($uri, "rdfs:subClassOf");
  foreach ($parents as $value) {
    $options += $this
      ->getProperties($value
      ->getUri());
  }
  return $options;
}