Snips of TCS import function for Taxonomy XML for future reference
<?php
// commented out below from TCS, possibly of interest
// $term = (object) array(
// 'predicates' => array(),
// );
// $term->id = $concept->getAttribute('id');
// $term->uri = $url;
// $term->name = $termname->textContent;
// $term->namerefs[] = $termname->getAttribute('ref');
// Find ALL its relationships. Store them in an array for later linking
// $relationships = $xp->query("${prefix}TaxonRelationships/${prefix}TaxonRelationship", $concept);
// $term->relationships array is here for other storage mechanisms (term_relations) to investigate and serialize if they can
// $term->relationships[$reltype][$reftarget] = $reftarget ;
// $term->predicates[$reltype][$reftarget] = $reftarget ;
// OBO has extra metadata fields which Drupal by itself will not store.
// IF we want to save that data, it must be massaged into saveable fields
// by another module eg the new experimental eol.module
// that grabs the data on hook_node_presave() and saves it using taxonomy_enhancer.
//
// This import module will attempt to NOT make any judgements at this
// stage about how that data shall be stored.
//
// Let other hooks do their own logic with the data on save.
// $term->xml = $xmldoc->saveXML($concept);
#dpm(simplexml_import_dom($concept));
#dpm(array("found a taxonConcept ". $term->name ." " . $term->id, $term));
// Add this term to our list, indexed as best we can.
// $terms[$term->id] = $term;
// Index this thing as a duplicate handle so we can find it easily if asked for the URL
// if ($url && (count($concepts) == 1)) {
// $terms[$url] = &$terms[$term->id];
// }
// The first placeholder term definitions are set up.
// They may want to refer to each other, So now scan the refs for known referees
// and actually create them so we have tids to link.
//
// $terms list may also include pre-existing terms, included for cross-reference and linking
?>
Comments
Post new comment