$taxon->rankString = 'Kingdom'; print_r($taxon); aud_document($taxon, $taxon->guid, $operation); $taxon = new stdclass(); $taxon->docType = 'taxonConcept'; $taxon->guid = '8edaf6f6-d5f7-45b0-ac82-ef7de21b47d9'; $taxon->parent = 'ec21b060-78e8-4a37-9e62-b8bef532b001'; $taxon->nameString = 'UNIRAMIA'; $taxon->nameStringHtml = 'UNIRAMIA'; $taxon->rankString = 'Subphylum'; print_r($taxon); aud_document($taxon, $taxon->guid, $operation); $taxon = new stdclass(); $taxon->docType = 'taxonConcept'; $taxon->guid = 'ec21b060-78e8-4a37-9e62-b8bef532b001'; $taxon->parent = '4647863b-760d-4b59-aaa1-502c8cdf8d3c'; $taxon->nameString = 'ARTHROPODA'; $taxon->nameStringHtml = 'ARTHROPODA'; $taxon->rankString = 'Phylum'; print_r($taxon); aud_document($taxon, $taxon->guid, $operation); $taxon = new stdclass(); $taxon->docType = 'taxonConcept'; $taxon->guid = '9482d422-aed5-4059-ba23-7cd8dfca6fbf'; $taxon->parent = 'ec21b060-78e8-4a37-9e62-b8bef532b001'; $taxon->nameString = 'CHELICERATA'; $taxon->nameStringHtml = 'CHELICERATA'; $taxon->rankString = 'Subphylum'; print_r($taxon); aud_document($taxon, $taxon->guid, $operation);
function couchdb_import($reference) { global $couch; global $config; // Make object Mendeley-like (?) //print_r($reference); $obj = new stdclass(); foreach ($reference as $k => $v) { //echo $k; switch ($k) { case 'abstract': case 'authors': case 'issue': case 'pdf': case 'title': case 'urls': case 'volume': case 'year': $obj->{${k}} = $v; break; case 'secondary_title': $obj->publication_outlet = $v; break; case 'biostor': case 'doi': case 'hdl': case 'isbn': case 'issn': case 'pmid': $obj->identifiers->{${k}} = $v; break; case 'hdl': $obj->identifiers->hdl = $v; break; case 'spage': $obj->pages = $v; if (isset($reference->epage)) { $obj->pages .= '-' . $reference->epage; } break; case 'genre': switch ($v) { case 'article': $obj->type = "Journal Article"; break; case 'book': $obj->type = "Book"; break; } break; case 'keywords': foreach ($v as $kw) { //cd6d423e-011b-4a46-b370-ceb5c535772 if (preg_match('/[a-z0-9]{8}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{4}\\-[a-z0-9]{11}/', $kw)) { $obj->id = $kw; } } break; default: break; } } $obj->docType = 'publication'; // Get thumbnail & geo from BioStor if (isset($obj->identifiers->biostor)) { $url = 'http://biostor.org/reference/' . $obj->identifiers->biostor . '.json'; $json = get($url); $biostor = json_decode($json); if (isset($biostor->thumbnails)) { $obj->thumbnail = $biostor->thumbnails[0]; $obj->identifiers->bhl = $biostor->bhl_pages[0]; } $obj->pageIdentifiers = $biostor->bhl_pages; if (isset($biostor->geometry)) { $obj->geometry = $biostor->geometry; } } print_r($obj); //$operation = 'update'; $operation = 'add'; //$operation = 'delete'; // To do: Handle case where missing keyword means we don't have a AFD identifier if (isset($obj->id)) { aud_document($obj, $obj->id, $operation); } }