You are here

function taxonomy_xml_rdf_document in Taxonomy import/export via XML 6.2

Same name and namespace in other branches
  1. 5.2 rdf_format.inc \taxonomy_xml_rdf_document()
  2. 5 rdf_format.inc \taxonomy_xml_rdf_document()
  3. 6 rdf_format.inc \taxonomy_xml_rdf_document()
  4. 7 rdf_utils.inc \taxonomy_xml_rdf_document()

Set up an RDF document preamble. Returns a document, also sets the passed handle to the RDF node that content should land in

2 calls to taxonomy_xml_rdf_document()
taxonomy_xml_rdf_create in ./rdf_format.inc
Return an XML/RDF document representing this vocab
taxonomy_xml_rdf_export_term in ./rdf_format.inc
Return a term as RDF. Header and all

File

./rdf_format.inc, line 954
Include routines for RDF parsing and taxonomy/term creation. @author dman http://coders.co.nz

Code

function taxonomy_xml_rdf_document() {
  $dom = new domdocument('1.0', 'UTF-8');
  $dom
    ->appendchild($dom
    ->createcomment(xmlentities("\n    This file was created by Drupal taxonomy_xml import/export tool.\n    http://drupal.org/project/taxonomy_xml\n\n    The RDF schema in this file is intended to match the RDF predicate\n    mapping rules defined in Drupal 7 (unless overridden)\n    Almost entirely SKOS, with a little RDF thrown in.\n    ")));
  $dom
    ->appendchild($dom
    ->createprocessinginstruction('xml-stylesheet', 'href="render-taxonomy-rdf.xsl" type="text/xsl"'));
  $domcontainer = $dom
    ->createelementns(TAXONOMY_XML_RDF_NS, 'rdf:RDF');
  $dom
    ->appendchild($domcontainer);
  taxonomy_xml_rdf_add_namespace($domcontainer, TAXONOMY_XML_RDFS_NS, 'rdfs');
  taxonomy_xml_rdf_add_namespace($domcontainer, TAXONOMY_XML_OWL_NS, 'owl');
  taxonomy_xml_rdf_add_namespace($domcontainer, TAXONOMY_XML_DC_NS, 'dc');
  taxonomy_xml_rdf_add_namespace($domcontainer, TAXONOMY_XML_SKOS_NS, 'skos');

  // Invoke additional module support hooks may need to add namespaces.
  $hook = 'taxonomy_xml_rdf_document_setup';
  foreach (module_implements($hook) as $module) {
    $function = $module . '_' . $hook;
    $function($domcontainer);
  }
  return $domcontainer;
}