You are here

function taxonomy_xml_add_vocab_as_rdf in Taxonomy import/export via XML 6

Same name and namespace in other branches
  1. 5.2 rdf_format.inc \taxonomy_xml_add_vocab_as_rdf()
  2. 5 rdf_format.inc \taxonomy_xml_add_vocab_as_rdf()
  3. 6.2 rdf_format.inc \taxonomy_xml_add_vocab_as_rdf()

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_add_vocab_as_rdf()
taxonomy_xml_rdf_create in ./rdf_format.inc
Return an XML/RDF document representing this vocab

File

./rdf_format.inc, line 572
Include routines for RDF parsing and taxonomy/term creation.

Code

function taxonomy_xml_add_vocab_as_rdf(&$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(time(), 'large'))));
}