protected function EasyRdf_Parser_Rdfa::generateList in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Rdfa.php \EasyRdf_Parser_Rdfa::generateList()
1 call to EasyRdf_Parser_Rdfa::generateList()
- EasyRdf_Parser_Rdfa::processNode in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Rdfa.php
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Parser/ Rdfa.php, line 76
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'),
));
}