function taxonomy_xml_parse_lsid in Taxonomy import/export via XML 6.2
Same name and namespace in other branches
- 6 taxonomy_xml.module \taxonomy_xml_parse_lsid()
- 7 services/lsid.taxonomy_service.inc \taxonomy_xml_parse_lsid()
Helper function to check if a given string looks like an LSID. If so, it returns it in an array of componant bits. If not, returns NULL.
LSID is a "Life Sciences Identifier" GUID used to identify Taxonomic concepts. It's not great, and it's probably not going to carry on living, but it's out there in metadata and web services.
For convenience, it also returns a namespaced 'type' so we can quickly see what 'type' of resource the LSID is referring to. eg an LSID starting with 'urn:lsid:ubio.org:classificationbank' is the type of entity that Drupal will call a term, and TCS would call a TaxonConcept.
2 calls to taxonomy_xml_parse_lsid()
- taxonomy_xml_convert_triples_to_sorted_objects in ./
rdf_format.inc - Compile triple statements into information objects again.
- taxonomy_xml_rdf_shortname in ./
rdf_format.inc - Return the shorthand label of a potentially long RDF URI
File
- ./
taxonomy_xml.module, line 1995 - This module makes it possible to import and export taxonomies as XML documents.
Code
function taxonomy_xml_parse_lsid($id) {
$bits = split(":", $id);
if (count($bits) < 5) {
return NULL;
}
$lsid = array(
'urn' => $bits[0],
'schema' => $bits[1],
'authority' => $bits[2],
'namespace' => $bits[3],
'identifier' => $bits[4],
'version' => @$bits[5],
# optional
'type' => implode(':', array(
$bits[0],
$bits[1],
$bits[2],
$bits[3],
)),
);
if (count($bits) > 4 && $lsid['urn'] == 'urn' && $lsid['schema'] == 'lsid') {
return $lsid;
}
return NULL;
}