function taxonomy_xml_add_vocab_as_rdf in Taxonomy import/export via XML 5
Same name and namespace in other branches
- 5.2 rdf_format.inc \taxonomy_xml_add_vocab_as_rdf()
- 6.2 rdf_format.inc \taxonomy_xml_add_vocab_as_rdf()
- 6 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 526 - 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', NULL, NULL, TRUE));
$vocabnode
->appendchild($dom
->createelementns(TAXONOMY_XML_RDFS_NS, 'rdfs:label', htmlentities($vocabulary->name)));
if ($vocabulary->description) {
$vocabnode
->appendchild($dom
->createelementns(TAXONOMY_XML_RDFS_NS, 'rdfs:comment', htmlentities($vocabulary->description)));
}
$vocabnode
->appendchild($dom
->createelementns(TAXONOMY_XML_OWL_NS, 'owl:versionInfo', htmlentities(format_date(time(), 'large'))));
}