You are here

function taxonomy_xml_rdfs_add_vocab in Taxonomy import/export via XML 7

Create a vocabulary definition (just the def, not its terms) and insert it into the given document element.

Parameters

$domcontainer: an XML dom document, modified by ref.

$vocabulary: a vocab object

1 call to taxonomy_xml_rdfs_add_vocab()
taxonomy_xml_rdfs_create in ./rdfs_format.inc
Return an XML/RDF document representing this vocab

File

./rdfs_format.inc, line 103

Code

function taxonomy_xml_rdfs_add_vocab(DomDocument &$domcontainer, $vocabulary) {
  $dom = $domcontainer->ownerDocument;

  // Describe the vocabulary itself.
  $vocabnode = $dom
    ->createelementns(TAXONOMY_XML_OWL_NS, 'owl:Ontology');
  $domcontainer
    ->appendchild($vocabnode);

  // If this was a cannonic vocab, we would use a full URI as identifiers.
  $vocabnode
    ->setattributens(TAXONOMY_XML_RDF_NS, 'rdf:ID', 'vocabulary-' . $vocabulary->vid);
  $vocabnode
    ->setattributens(TAXONOMY_XML_RDF_NS, 'rdf:about', url('taxonomy_xml/' . $vocabulary->vid . '/rdf', array(
    'absolute' => TRUE,
  )));
  $vocabnode
    ->appendchild($dom
    ->createelementns(TAXONOMY_XML_RDFS_NS, 'rdfs:label', xmlentities($vocabulary->name)));
  if ($vocabulary->description) {
    $vocabnode
      ->appendchild($dom
      ->createelementns(TAXONOMY_XML_RDFS_NS, 'rdfs:comment', xmlentities($vocabulary->description)));
  }
  $vocabnode
    ->appendchild($dom
    ->createelementns(TAXONOMY_XML_OWL_NS, 'owl:versionInfo', xmlentities(format_date(REQUEST_TIME, 'long'))));
}