tripal_pub.api.inc 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. <?php
  2. /**
  3. * @file
  4. * The Tripal Pub API
  5. *
  6. * @defgroup tripal_pub_api Publication Module API
  7. * @ingroup tripal_api
  8. */
  9. /*
  10. * Retrieves a list of publications as an associated array where
  11. * keys correspond directly with Tripal Pub CV terms.
  12. *
  13. * @param remote_db
  14. * The name of the remote publication database to query. These names should
  15. * match the name of the databases in the Chado 'db' table. Currently
  16. * supported databass include
  17. * 'PMID': PubMed
  18. *
  19. * @param search_array
  20. * An associate array containing the search criteria. The following key
  21. * are expected
  22. * 'remote_db': Specifies the name of the remote publication database
  23. * 'num_criteria': Specifies the number of criteria present in the search array
  24. * 'days': The number of days to include in the search starting from today
  25. * 'criteria': An associate array containing the search critiera. There should
  26. * be no less than 'num_criteria' elements in this array.
  27. *
  28. * The following keys are expected in the 'criteria' array
  29. * 'search_terms': A list of terms to search on, separated by spaces.
  30. * 'scope': The fields to search in the remote database. Valid values
  31. * include: 'title', 'abstract', 'author' and 'any'
  32. * 'operation': The logical operation to use for this criteria. Valid
  33. * values include: 'AND', 'OR' and 'NOT'.
  34. * @param $num_to_retrieve
  35. * The number of records to retrieve. In cases with large numbers of
  36. * records to retrieve, the remote database may limit the size of each
  37. * retrieval.
  38. * @param $pager_id
  39. * Optional. This function uses the 'tripal_pager_callback' function
  40. * to page a set of results. This is helpful when generating results to
  41. * be view online. The pager works identical to the pager_query function
  42. * of drupal. Simply provide a unique integer value for this argument. Each
  43. * form on a single page should have a unique $pager_id.
  44. * @param $page
  45. * Optional. If this function is called where the
  46. * page for the pager cannot be set using the $_GET variable, use this
  47. * argument to specify the page to retrieve.
  48. *
  49. * @return
  50. * Returns an array of pubs where each element is
  51. * an associative array where the keys are Tripal Pub CV terms.
  52. *
  53. * @ingroup tripal_pub_api
  54. */
  55. function tripal_pub_get_remote_search_results($remote_db, $search_array,
  56. $num_to_retrieve, $pager_id = 0, $page = 0) {
  57. // construct the callback function using the remote database name
  58. $callback = 'tripal_pub_remote_search_' . strtolower($remote_db);
  59. // manually set the $_GET['page'] parameter to trick the pager
  60. // into giving us the requested page
  61. if (is_int($page) and $page > 0) {
  62. $_GET['page'] = $page;
  63. }
  64. // now call the callback function to get the rsults
  65. $pubs = array();
  66. if (function_exists($callback)) {
  67. $pubs = call_user_func($callback, $search_array, $num_to_retrieve, $pager_id);
  68. }
  69. return $pubs;
  70. }
  71. /*
  72. * @ingroup tripal_pub_api
  73. */
  74. function tripal_pub_update_publications($do_contact = FALSE) {
  75. // get a persistent connection
  76. $connection = tripal_db_persistent_chado();
  77. if (!$connection) {
  78. print "A persistant connection was not obtained. Loading will be slow\n";
  79. }
  80. // if we cannot get a connection then let the user know the loading will be slow
  81. tripal_db_start_transaction();
  82. if ($connection) {
  83. print "\nNOTE: Loading of publications is performed using a database transaction. \n" .
  84. "If the load fails or is terminated prematurely then the entire set of \n" .
  85. "insertions/updates is rolled back and will not be found in the database\n\n";
  86. }
  87. // get a list of all publications that have
  88. // supported databases
  89. $sql = "
  90. SELECT DB.name as db_name, DBX.accession
  91. FROM pub P
  92. INNER JOIN pub_dbxref PDBX ON P.pub_id = PDBX.pub_id
  93. INNER JOIN dbxref DBX ON DBX.dbxref_id = PDBX.dbxref_id
  94. INNER JOIN db DB ON DB.db_id = DBX.db_id
  95. ORDER BY DB.name, P.pub_id
  96. ";
  97. $results = chado_query($sql);
  98. $num_to_retrieve = 100;
  99. $i = 0; // count the number of IDs. When we hit $num_to_retrieve we'll do the query
  100. $curr_db = ''; // keeps track of the current current database
  101. $ids = array(); // the list of IDs for the database
  102. $search = array(); // the search array passed to the search function
  103. // iterate through the pub IDs
  104. while ($pub = db_fetch_object($results)) {
  105. $accession = $pub->accession;
  106. $remote_db = $pub->db_name;
  107. // here we need to only update publications for databases we support
  108. $supported_dbs = variable_get('tripal_pub_supported_dbs', array());
  109. if(!in_array($remote_db, $supported_dbs)) {
  110. continue;
  111. }
  112. // if we're switching databases then reset the search array
  113. if($remote_db != $curr_db) {
  114. // if we had a previous DB then do the update.
  115. if ($curr_db) {
  116. $search['num_criteria'] = $i - 1;
  117. $pubs = tripal_pub_get_remote_search_results($remote_db, $search, $i, 0);
  118. tripal_pub_add_publications($pubs, $do_contact, TRUE);
  119. }
  120. $curr_db = $remote_db;
  121. $search = array(
  122. 'remote_db' => $remote_db,
  123. 'criteria' => array(),
  124. );
  125. $ids = array();
  126. $i = 0;
  127. }
  128. // if we've hit the maximum number to retrieve then do the search
  129. if($i == $num_to_retrieve) {
  130. $search['num_criteria'] = $i - 1;
  131. $pubs = tripal_pub_get_remote_search_results($remote_db, $search, $i, 0);
  132. tripal_pub_add_publications($pubs, $do_contact, TRUE);
  133. $search['criteria'] = array();
  134. $i = 0;
  135. }
  136. // add each accession to the search criteria
  137. $search['criteria'][] = array(
  138. 'search_terms' => $accession,
  139. 'scope' => 'id',
  140. 'operation' => 'OR'
  141. );
  142. $i++;
  143. }
  144. // now update any remaining in the search criteria array
  145. $search['num_criteria'] = $i - 1;
  146. $pubs = tripal_pub_get_remote_search_results($remote_db, $search, $i, 0);
  147. tripal_pub_add_publications($pubs, $do_contact, TRUE);
  148. // transaction is complete
  149. tripal_db_commit_transaction();
  150. print "Transaction Complete\n";
  151. // sync the newly added publications with Drupal
  152. print "Syncing publications with Drupal...\n";
  153. tripal_pub_sync_pubs();
  154. // if the caller wants to create contacts then we should sync them
  155. if ($do_contact) {
  156. print "Syncing contacts with Drupal...\n";
  157. tripal_contact_sync_contacts();
  158. }
  159. print "Done.\n";
  160. }
  161. /*
  162. * @ingroup tripal_pub_api
  163. */
  164. function tripal_pub_import_publications() {
  165. $num_to_retrieve = 100;
  166. $pager_id = 0;
  167. $page = 0;
  168. $num_pubs = 0;
  169. // get a persistent connection
  170. $connection = tripal_db_persistent_chado();
  171. if (!$connection) {
  172. print "A persistant connection was not obtained. Loading will be slow\n";
  173. }
  174. // if we cannot get a connection then let the user know the loading will be slow
  175. tripal_db_start_transaction();
  176. if ($connection) {
  177. print "\nNOTE: Loading of publications is performed using a database transaction. \n" .
  178. "If the load fails or is terminated prematurely then the entire set of \n" .
  179. "insertions/updates is rolled back and will not be found in the database\n\n";
  180. }
  181. // get all of the loaders
  182. $sql = "SELECT * FROM {tripal_pub_import} WHERE disabled = 0";
  183. $results = db_query($sql);
  184. $do_contact = FALSE;
  185. while ($import = db_fetch_object($results)) {
  186. print "Importing: " . $import->name . "\n";
  187. // keep track if any of the importers want to create contacts from authors
  188. if ($import->do_contact == 1) {
  189. $do_contact = TRUE;
  190. }
  191. $criteria = unserialize($import->criteria);
  192. $remote_db = $criteria['remote_db'];
  193. do {
  194. // retrieve the pubs for this page. We'll retreive 10 at a time
  195. $pubs = tripal_pub_get_remote_search_results($remote_db, $criteria, $num_to_retrieve, $pager_id, $page);
  196. tripal_pub_add_publications($pubs, $import->do_contact);
  197. $page++;
  198. }
  199. // continue looping until we have a $pubs array that does not have
  200. // our requested numer of records. This means we've hit the end
  201. while (count($pubs) == $num_to_retrieve);
  202. }
  203. // transaction is complete
  204. tripal_db_commit_transaction();
  205. print "Transaction Complete\n";
  206. // sync the newly added publications with Drupal
  207. print "Syncing publications with Drupal...\n";
  208. tripal_pub_sync_pubs();
  209. // if any of the importers wanted to create contacts from the authors then sync them
  210. if($do_contact) {
  211. print "Syncing contacts with Drupal...\n";
  212. tripal_contact_sync_contacts();
  213. }
  214. print "Done.\n";
  215. }
  216. /*
  217. *
  218. */
  219. function tripal_pub_add_publications($pubs, $do_contact, $update = FALSE) {
  220. // iterate through the publications and add each one
  221. foreach ($pubs as $pub) {
  222. // add the publication to Chado and sync it with Chado
  223. $pub_id = tripal_pub_add_publication($pub, $do_contact, $update);
  224. if (is_numeric($pub_id)){
  225. // add the publication cross reference (e.g. to PubMed)
  226. if ($pub_id and $pub['Publication Dbxref']) {
  227. $pub_dbxref = tripal_pub_add_pub_dbxref($pub_id, $pub['Publication Dbxref']);
  228. }
  229. $num_pubs++;
  230. print "Success: " . $pub['Publication Dbxref'] . "\n";
  231. }
  232. elseif($pub_id) {
  233. print "Skipped: " . $pub['Publication Dbxref'] . "\n";
  234. }
  235. else {
  236. print "Failed: " . $pub['Publication Dbxref'] . "\n";
  237. }
  238. }
  239. }
  240. /*
  241. *
  242. */
  243. function tripal_pub_add_pub_dbxref($pub_id, $pub_dbxref) {
  244. // break apart the dbxref
  245. $dbname = '';
  246. $accession = '';
  247. if(preg_match('/^(.*?):(.*?)$/', $pub_dbxref, $matches)) {
  248. $dbname = $matches[1];
  249. $accession = $matches[2];
  250. }
  251. else {
  252. return FALSE;
  253. }
  254. // check to see if the pub_dbxref record already exist
  255. $values = array(
  256. 'dbxref_id' => array(
  257. 'accession' => $accession,
  258. 'db_id' => array(
  259. 'name' => $dbname,
  260. ),
  261. ),
  262. 'pub_id' => $pub_id,
  263. );
  264. $options = array('statement_name' => 'sel_pubdbxref_dbpu');
  265. $results = tripal_core_chado_select('pub_dbxref', array('*'), $values, $options);
  266. // if the pub_dbxref record exist then we don't need to re-add it.
  267. if(count($results) > 0) {
  268. return $results[0];
  269. }
  270. // make sure our database already exists
  271. $db = tripal_db_add_db($dbname);
  272. // get the database cross-reference
  273. $dbxvalues = array(
  274. 'accession' => $accession,
  275. 'db_id' => $db->db_id,
  276. );
  277. $dbxoptions = array('statement_name' => 'sel_dbxref_acdb');
  278. $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $dbxvalues, $dbxoptions);
  279. // if the accession doesn't exist then add it
  280. if(count($results) == 0){
  281. $dbxref = tripal_db_add_dbxref($db->db_id, $accession);
  282. }
  283. else {
  284. $dbxref = $results[0];
  285. }
  286. // now add the record
  287. $options = array('statement_name' => 'ins_pubdbxref_dbpu');
  288. $results = tripal_core_chado_insert('pub_dbxref', $values, $options);
  289. if (!$results) {
  290. watchdog('tripal_pub', "Cannot add publication dbxref: %db:%accession.",
  291. array('%db' => $dbname, '%accession' => $accession). WATCHDOG_ERROR);
  292. return FALSE;
  293. }
  294. return $results;
  295. }
  296. /*
  297. *
  298. */
  299. function tripal_pub_add_publication($pub_details, $do_contact, $update = FALSE) {
  300. $pub_id = 0;
  301. // first try to find the publication using the accession number. It will have
  302. // one if the pub has already been loaded for the publication database
  303. if ($pub_details['Publication Dbxref']) {
  304. if(preg_match('/^(.*?):(.*?)$/', $pub_details['Publication Dbxref'], $matches)) {
  305. $dbname = $matches[1];
  306. $accession = $matches[2];
  307. $values = array(
  308. 'dbxref_id' => array (
  309. 'accession' => $accession,
  310. 'db_id' => array(
  311. 'name' => $dbname
  312. ),
  313. ),
  314. );
  315. $options = array('statement_name' => 'sel_pubdbxref_db');
  316. $results = tripal_core_chado_select('pub_dbxref', array('pub_id'), $values, $options);
  317. if(count($results) == 1) {
  318. $pub_id = $results[0]->pub_id;
  319. }
  320. elseif(count($results) > 1) {
  321. watchdog('tripal_pub', "There are two publications with this accession: %db:%accession. Cannot determine which to update.",
  322. array('%db' => $dbname, '%accession' => $accession), WATCHDOG_ERROR);
  323. return FALSE;
  324. }
  325. }
  326. // If we found the publication and we do not want to do the update then
  327. // return true to indicate the publication has been added
  328. if (!$update and $pub_id) {
  329. return TRUE;
  330. }
  331. }
  332. // if we couldn't find a publication by the accession (which means it doesn't
  333. // yet exist or it has been added using a different publication database) then
  334. // try to find it using the title and publication year.
  335. elseif ($pub_details['Title']) {
  336. $values = array();
  337. $values['title'] = $pub_details['Title'];
  338. $stmnt_suffix = 'ti';
  339. if ($pub_details['Year']) {
  340. $values['pyear'] = $pub_details['Year'];
  341. $stmnt_suffix .= 'py';
  342. }
  343. $options = array('statement_name' => 'sel_pub_');
  344. $results = tripal_core_chado_select('pub', array('*'), $values, $options);
  345. if (count($results) == 1) {
  346. $pub_id = $results[0]->pub_id;
  347. }
  348. elseif (count($results) > 1) {
  349. watchdog('tripal_pub', "The publication with the same title is present multiple times. Cannot ".
  350. "determine which to use. Title: %title", array('%title' => $pub_details['Title']), WATCHDOG_ERROR);
  351. return FALSE;
  352. }
  353. // If we found the publication and we do not want to do the update then
  354. // return true to indicate the publication has been added
  355. if (!$update and $pub_id) {
  356. return TRUE;
  357. }
  358. }
  359. // if we couldn't find the publication using the database accession or the title/year then add it
  360. if(!$pub_id) {
  361. // get the publication type (use the first publication type, any others will get stored as properties)
  362. $pub_type = tripal_cv_get_cvterm_by_name($pub_details['Publication Type'][0], NULL, 'tripal_pub');
  363. if (!$pub_type) {
  364. watchdog('tripal_pub', "Cannot find publication type: '%type'",
  365. array('%type' => $pub_details['Publication Type'][0]), WATCHDOG_ERROR);
  366. return FALSE;
  367. }
  368. // if the publication does not exist then create it.
  369. $values = array(
  370. 'title' => $pub_details['Title'],
  371. 'volume' => $pub_details['Volume'],
  372. 'series_name' => $pub_details['Journal Name'],
  373. 'issue' => $pub_details['Issue'],
  374. 'pyear' => $pub_details['Year'],
  375. 'pages' => $pub_details['Pages'],
  376. 'uniquename' => $pub_details['Citation'],
  377. 'type_id' => $pub_type->cvterm_id,
  378. );
  379. $options = array('statement_name' => 'ins_pub_tivoseispypaunty');
  380. $pub = tripal_core_chado_insert('pub', $values, $options);
  381. if (!$pub) {
  382. watchdog('tripal_pub', "Cannot insert the publication with title: %title",
  383. array('%title' => $pub_details['Title']), WATCHDOG_ERROR);
  384. return FALSE;
  385. }
  386. $pub_id = $pub['pub_id'];
  387. }
  388. // before we add any new properties we need to remove those that are there if this
  389. // is an update. The only thing we don't want to remove are the 'Publication Dbxref'
  390. if($update) {
  391. $sql = "
  392. DELETE FROM {pubprop}
  393. WHERE
  394. pub_id = %d AND
  395. NOT type_id in (
  396. SELECT cvterm_id
  397. FROM {cvterm}
  398. WHERE name = 'Publication Dbxref'
  399. )
  400. ";
  401. chado_query($sql, $pub_id);
  402. }
  403. foreach ($pub_details as $key => $value) {
  404. // get the cvterm by name or synonym
  405. $cvterm = tripal_cv_get_cvterm_by_name($key, NULL, 'tripal_pub');
  406. if (!$cvterm) {
  407. $cvterm = tripal_cv_get_cvterm_by_synonym($key, NULL, 'tripal_pub');
  408. }
  409. if (!$cvterm) {
  410. watchdog('tripal_pub', "Cannot find term: '%prop'. Skipping.", array('%prop' => $key), WATCHDOG_ERROR);
  411. continue;
  412. }
  413. // skip details that won't be stored as properties
  414. if ($key == 'Author List') {
  415. tripal_pub_add_authors($pub_id, $value, $do_contact);
  416. continue;
  417. }
  418. if ($key == 'Title' or $key == 'Volume' or $key == 'Journal Name' or $key == 'Issue' or
  419. $key == 'Year' or $key == 'Pages') {
  420. continue;
  421. }
  422. $success = 0;
  423. if (is_array($value)) {
  424. foreach ($value as $subkey => $subvalue) {
  425. // if the key is an integer then this array is a simple list and
  426. // we will insert using the primary key. Otheriwse, use the new key
  427. if(is_int($subkey)) {
  428. $success = tripal_core_insert_property('pub', $pub_id, $key, 'tripal_pub', $subvalue, FALSE);
  429. }
  430. else {
  431. $success = tripal_core_insert_property('pub', $pub_id, $subkey, 'tripal_pub', $subvalue, FALSE);
  432. }
  433. }
  434. }
  435. else {
  436. $success = tripal_core_insert_property('pub', $pub_id, $key, 'tripal_pub', $value, TRUE);
  437. }
  438. if (!$success) {
  439. watchdog('tripal_pub', "Cannot add property '%prop' to publication. Skipping.",
  440. array('%prop' => $key), WATCHDOG_ERROR);
  441. continue;
  442. }
  443. }
  444. return $pub_id;
  445. }
  446. /*
  447. *
  448. */
  449. function tripal_pub_add_authors($pub_id, $authors, $do_contact) {
  450. $rank = 0;
  451. // first remove any of the existing pubauthor entires
  452. $sql = "DELETE FROM {pubauthor} WHERE pub_id = %d";
  453. chado_query($sql, $pub_id);
  454. // iterate through the authors and add them to the pubauthors and contact
  455. // tables of chado, then link them through the custom pubauthors_contact table
  456. foreach ($authors as $author) {
  457. // skip invalid author entires
  458. if ($author['valid'] == 'N') {
  459. continue;
  460. }
  461. // remove the 'valid' property as we don't have a CV term for it
  462. unset($author['valid']);
  463. // construct the contact.name field using the author information
  464. $name = '';
  465. $type = 'Person';
  466. if ($author['Given Name']) {
  467. $name .= $author['Given Name'];
  468. }
  469. if ($author['Surname']) {
  470. $name .= ' ' . $author['Surname'];
  471. }
  472. if ($author['Suffix']) {
  473. $name .= ' ' . $author['Suffix'];
  474. }
  475. if ($author['Collective']) {
  476. $name = $author['Collective'];
  477. $type = 'Collective';
  478. }
  479. $name = trim($name);
  480. // add an entry to the pubauthors table
  481. $values = array(
  482. 'pub_id' => $pub_id,
  483. 'rank' => $rank,
  484. 'surname' => $author['Surname'] ? $author['Surname'] : $author['Collective'],
  485. 'givennames' => $author['Given Name'],
  486. 'suffix' => $author['Suffix'],
  487. );
  488. $options = array('statement_name' => 'ins_pubauthor_idrasugisu');
  489. $pubauthor = tripal_core_chado_insert('pubauthor', $values, $options);
  490. // if the user wants us to create a contact for each author then do it.
  491. if ($do_contact) {
  492. // Add the contact
  493. $contact = tripal_contact_add_contact($name, '', $type, $author);
  494. // if we have succesfully added the contact and the pubauthor entries then we want to
  495. // link them together
  496. if ($contact and $pubauthor) {
  497. // link the pubauthor entry to the contact
  498. $values = array(
  499. 'pubauthor_id' => $pubauthor['pubauthor_id'],
  500. 'contact_id' => $contact['contact_id'],
  501. );
  502. $options = array('statement_name' => 'ins_pubauthorcontact_puco');
  503. $pubauthor_contact = tripal_core_chado_insert('pubauthor_contact', $values, $options);
  504. if (!$pubauthor_contact) {
  505. watchdog('tripal_pub', "Cannot link pub authro and contact.", array(), WATCHDOG_ERROR);
  506. }
  507. }
  508. }
  509. $rank++;
  510. }
  511. }
  512. /**
  513. * Retrieve properties of a given type for a given pub
  514. *
  515. * @param $pub_id
  516. * The pub_id of the properties you would like to retrieve
  517. * @param $property
  518. * The cvterm name of the properties to retrieve
  519. *
  520. * @return
  521. * An pub chado variable with the specified properties expanded
  522. *
  523. * @ingroup tripal_pub_api
  524. */
  525. function tripal_pub_get_property($pub_id, $property) {
  526. return tripal_core_get_property('pub', $pub_id, $property, 'tripal');
  527. }
  528. /**
  529. * Insert a given property
  530. *
  531. * @param $pub_id
  532. * The pub_id of the property to insert
  533. * @param $property
  534. * The cvterm name of the property to insert
  535. * @param $value
  536. * The value of the property to insert
  537. * @param $update_if_present
  538. * A boolean indicated whether to update the record if it's already present
  539. *
  540. * @return
  541. * True of success, False otherwise
  542. *
  543. * @ingroup tripal_pub_api
  544. */
  545. function tripal_pub_insert_property($pub_id, $property, $value, $update_if_present = 0) {
  546. return tripal_core_insert_property('pub', $pub_id, $property, 'tripal_pub', $value, $update_if_present);
  547. }
  548. /**
  549. * Update a given property
  550. *
  551. * @param $pub_id
  552. * The pub_id of the property to update
  553. * @param $property
  554. * The cvterm name of the property to update
  555. * @param $value
  556. * The value of the property to update
  557. * @param $insert_if_missing
  558. * A boolean indicated whether to insert the record if it's absent
  559. *
  560. * Note: The property will be identified using the unique combination of the $pub_id and $property
  561. * and then it will be updated with the supplied value
  562. *
  563. * @return
  564. * True of success, False otherwise
  565. *
  566. * @ingroup tripal_pub_api
  567. */
  568. function tripal_pub_update_property($pub_id, $property, $value, $insert_if_missing = 0) {
  569. return tripal_core_update_property('pub', $pub_id, $property, 'tripal_pub', $value, $insert_if_missing);
  570. }
  571. /**
  572. * Delete a given property
  573. *
  574. * @param $pub_id
  575. * The pub_id of the property to delete
  576. * @param $property
  577. * The cvterm name of the property to delete
  578. *
  579. * Note: The property will be identified using the unique combination of the $pub_id and $property
  580. * and then it will be deleted
  581. *
  582. * @return
  583. * True of success, False otherwise
  584. *
  585. * @ingroup tripal_pub_api
  586. */
  587. function tripal_pub_delete_property($pub_id, $property) {
  588. return tripal_core_delete_property('pub', $pub_id, $property, 'tripal');
  589. }