function taxonomy_xml_shortname in Taxonomy import/export via XML 7
Return the shorthand label of a potentially long RDF URI
EG, for http://www.w3.org/1999/02/22-rdf-syntax-ns#Property return 'Property' ... for sanity
Also flatten LSIDs - which are used like URIs but just are NOT as useful
4 calls to taxonomy_xml_shortname()
- taxonomy_xml_absorb_vocabulary_definitions in ./
taxonomy_xml.process.inc - Create Vocabulary definitions.
- taxonomy_xml_canonicize_predicates in ./
taxonomy_xml.process.inc - Convert aliased predicates into common ones.
- taxonomy_xml_mesh_parse in formats/
mesh_format.inc - Reads a XML file and creates the term definitions found in it.
- taxonomy_xml_rdf_make_term in formats/
rdf_format.inc - Create the placeholder and fill in the values for this term.
File
- ./
taxonomy_xml.module, line 836 - Make it possible to import and export taxonomies as XML documents.
Code
function taxonomy_xml_shortname($uri) {
// For LSID simplification, flatten assorted RDF-LSID-Predicates (from any authority) into their simple name
if (function_exists('taxonomy_xml_parse_lsid') && ($lsid = taxonomy_xml_parse_lsid($uri)) && $lsid['namespace'] == 'predicates') {
return $lsid['identifier'];
}
$parts = parse_url($uri);
$shortname = !empty($parts['fragment']) ? $parts['fragment'] : (!empty($parts['query']) ? $parts['query'] : basename($parts['path']));
// The proper method for guessing simple names is probably documented elsewhere.
// ... this does the trick for now.
return $shortname;
}