protected function EasyRdf_Parser_Rdfa::generateList

1 call to EasyRdf_Parser_Rdfa::generateList()
EasyRdf_Parser_Rdfa::processNode in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Rdfa.php

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Rdfa.php, line 77

Class

EasyRdf_Parser_Rdfa
Class to parse RDFa 1.1 with no external dependancies.

Code

protected function generateList($subject, $property, $list) {
  $current = $subject;
  $prop = $property;

  // Output a blank node for each item in the list
  foreach ($list as $item) {
    $newNode = $this->graph
      ->newBNodeId();
    $this
      ->addTriple($current, $prop, array(
      'type' => 'bnode',
      'value' => $newNode,
    ));
    $this
      ->addTriple($newNode, 'rdf:first', $item);
    $current = $newNode;
    $prop = 'rdf:rest';
  }

  // Finally, terminate the list
  $this
    ->addTriple($current, $prop, array(
    'type' => 'uri',
    'value' => EasyRdf_Namespace::expand('rdf:nil'),
  ));
}