You are here

function rdfx_add_resource in RDF Extensions 7.2

Adds a resource object.

1 call to rdfx_add_resource()
rdfx_add_statement in ./rdfx.module
Adds an RDF statement between the entity and the property. These statements can have either resource or literal objects.

File

./rdfx.module, line 259
Extends the RDF API of Drupal core to support more RDF seralizations formats other RDF capabilities.

Code

function rdfx_add_resource(&$index, $uri, $property, EntityMetadataWrapper $wrapper, $name) {
  if ($id = $property
    ->getIdentifier()) {
    $predicates = rdfx_get_predicates($wrapper, $name);
    $type = $property
      ->type();
    $entities = entity_load($type, array(
      $id,
    ));
    $entity = $entities[$id];
    $object_uri = rdfx_resource_uri($type, $entity);
    foreach ($predicates as $predicate) {
      $index[$uri][$predicate][] = $object_uri;
    }
  }
}