You are here

function taxonomy_xml_rdf_shortname in Taxonomy import/export via XML 6

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

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

1 call to taxonomy_xml_rdf_shortname()
taxonomy_xml_convert_triples_to_sorted_objects in ./rdf_format.inc
Compile triple statements into information objects again.

File

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

Code

function taxonomy_xml_rdf_shortname($uri) {

  // For LSID simplification, flatten assorted RDF-LSID-Predicates (from any authority) into their simple name
  if (($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;
}