{"id":210513,"date":"2011-09-28T08:00:00","date_gmt":"2011-09-28T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/wp-nasaads-query-importer\/"},"modified":"2023-06-27T18:07:00","modified_gmt":"2023-06-27T18:07:00","slug":"wp-nasaads-query-importer","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/wp-nasaads-query-importer\/","title":{"rendered":"WP Nasa\/ADS Query Importer"},"content":{"rendered":"<p><a href=\"https:\/\/ui.adsabs.harvard.edu\/\" rel=\"nofollow ugc\">The SAO\/NASA Astrophysics Data System (ADS)<\/a> (NASA ADS) is a digital library portal for researchers in astronomy and physics. Complex literature searches can be performed such that compiling a list of relevant papers for a specific topic can be done easily. This plugin provides an interface to the <a href=\"http:\/\/adsabs.github.io\/help\/api\/\" rel=\"nofollow ugc\">NASA ADS API<\/a> in order to include lists of records in your posts using shortcodes.<\/p>\n<p>With this plugin you are able to<br \/>\n\u2013 easily include simple ADS queries without having to learn the NASA ADS API.<br \/>\n\u2013 include complex ADS queries by providing the full GET method URL (see the <em>Shortcodes<\/em> section below).<br \/>\n\u2013 customize the format and the displayed information of the returned list of records at the shortcode level if needed.<\/p>\n<p>Note: this code is not backward compatible with version 0.3 and older.<\/p>\n<h4>Shortcodes<\/h4>\n<p>The shortcode <code>wp_nasaads_query_importer<\/code> can be used to query the NASA ADS and output the returned list of records. It can be inserted into any post with or without providing enclosed content:<br \/>\n<strong>[wp_nasaads_query_importer <em>attributes<\/em>]<\/strong><br \/>\nor<br \/>\n<strong>[wp_nasaads_query_importer <em>attributes<\/em>] <em>format<\/em> [\/wp_nasaads_query_importer]<\/strong><\/p>\n<p>Here, <em>attributes<\/em> are the shortcode\u2019s attributes and it is mandatory to either provide<br \/>\n\u2013 at least one of the query attributes described below,<br \/>\n\u2013 the <em>library<\/em> attribute (and combined optionally with query attributes),<br \/>\n\u2013 or the <em>query<\/em> attribute.<\/p>\n<p>In case of enclosed content the <em>format<\/em> is used to format the list of the records. See the <em>Format<\/em> section below.<\/p>\n<p>Please note that for all of the following query attributes the <a href=\"http:\/\/adsabs.github.io\/help\/search\/search-syntax\" rel=\"nofollow ugc\">NASA ADS search syntax<\/a> is applied, i.e., the shortcode\u2019s attribute values are submitted unaltered to the API (with the exception of <em>author<\/em> and <em>title<\/em> as described below). This enables more complex searches, for instance when combined with logical operators like AND, OR, or NOT (read the search syntax for details).<\/p>\n<ul>\n<li><strong>author<\/strong>: search for certain author(s). In case a single author is given the name of the author, i.e., the attribute\u2019s value will be submitted with surrounding double quotes (e.g., <code>Hawking, S.<\/code> will be submitted as <code>\"Hawking, S.\"<\/code>).  Technically, a value is considered to be a single author if the string contains no AND, OR, double quotes or parentheses. If you need to include double quotes in the author field, please use single quotes around the attribute\u2019s value (see the examples below).<\/li>\n<li><strong>aff<\/strong>: search for author\u2019s affiliations which contain the given string.<\/li>\n<li><strong>bibstem<\/strong>: search for articles published in specific journal(s) given by the acronym(s) of the journal(s).<\/li>\n<li><strong>year<\/strong>: search for articles published in a certain year given in the format <code>YYYY<\/code>. Articles within a certain period can be searched by <code>YYYY-YYYY<\/code> or <code>YYYY TO YYYY<\/code>.<\/li>\n<li><strong>title<\/strong>: search for articles whose title contains the given string. The title will be submitted with surrounding double quotes under the same conditions as described for the <em>author<\/em> attribute.<\/li>\n<li><strong>property<\/strong>: filter the records on specific properties like <code>refereed<\/code>. Read the <em>Properties<\/em> section of the search syntax for a list of all available properties.<\/li>\n<\/ul>\n<p>Showing the records within an <a href=\"http:\/\/adsabs.github.io\/help\/libraries\/creating-libraries\" rel=\"nofollow ugc\">ADS user library<\/a> is supported by the<\/p>\n<ul>\n<li><strong>library<\/strong> attribute: the ID of the user-library.<\/li>\n<\/ul>\n<p>For more complex ADS searches, which are not supported by using the attributes of the shortcode, you may specify the<br \/>\n\u2013 <strong>query<\/strong> attribute: the GET method\u2019s URL to the API without the base path, i.e., https:\/\/api.adsabs.harvard.edu\/v1\/  is added automatically to the URL.<\/p>\n<p>Finally,the following optional attributes can be used to control the output:<br \/>\n\u2013 <strong>sort<\/strong>: sort the list of records. The value has to be in the format <code>field+direction<\/code> where <code>field<\/code> is the record field name to sort on and <code>direction<\/code> is either <code>desc<\/code> or <code>asc<\/code>. The default is <code>date desc,bibcode desc<\/code>.<br \/>\n\u2013 <strong>max_rec<\/strong>: the maximum number of records to show. The default is set to <code>25<\/code>.<br \/>\n\u2013 <strong>max_authors<\/strong>: the maximum number of authors to print, which is set to <code>3<\/code> by default. The remaining number of authors are appended to the printed author list.<br \/>\n\u2013 <strong>notify_empty_list<\/strong>: overrides the global plugin option \u201cNotify empty list\u201d. Possible values are <code>true<\/code> or <code>false<\/code>. The default is <code>true<\/code>.<br \/>\n\u2013 <strong>show_num_rec<\/strong>: overrides the global plugin option \u201cShow number of records\u201d. Allowed values are <code>never<\/code>, <code>always<\/code>, or <code>depends<\/code> (read the description in the plugin\u2019s settings page for details). The default is set to <code>depends<\/code>.<\/p>\n<h4>Format<\/h4>\n<p>How the list of records is formatted and inserted into your post can be defined in the plugin option \u201cContent template\u201d for all shortcodes. In case a shortcode is inserted into a post with enclosed content, i.e., <code>[wp_nasaads_query_importer] ...  [\/wp_nasaads_query_importer]<\/code> then the content within the shortcode tags is used as the template and, thus, overrides the plugin\u2019s global option.<\/p>\n<p>The template is applied to each record in the list and may contain HTML entities to style the output. The data of the record is inserted by the following placeholders: %author, %affil, %title, %year, %month, %bibstem, %pub, %page, %volume, and %adsurl. See the <a href=\"https:\/\/adsabs.github.io\/help\/search\/search-syntax\" rel=\"nofollow ugc\">NASA ADS search syntax<\/a> for the definition of the record\u2019s fields with the exception of %year and %month which are derived from <em>date<\/em>, and %adsurl which is derived from <em>bibcode<\/em>.<\/p>\n<p>Ultimate full control over the output and field records can be gained by new WordPress filters added by the plugin (see the <em>WordPress filter<\/em> section below).<\/p>\n<h4>WordPress filter<\/h4>\n<p>This plugins adds a few <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/add_filter\/\" rel=\"nofollow ugc\">filters<\/a> to WordPress, which can be used by third party plugins to further control the output and fetched record fields.<\/p>\n<pre><code>apply_filters( 'wp_nasaads_query_importer-record_mapping', array $mapping )\n<\/code><\/pre>\n<p>Defines which record fields are fetched from NASA ADS and on which placeholders they are mapped. The keys of the associative array <code>$mapping<\/code> are the placeholder names (without the leading %) and their values the API fields names. The default definition can be found in the source code. (<a href=\"https:\/\/github.com\/adsabs\/wp-nasaads-query-importer\" rel=\"nofollow ugc\">Source code<\/a>)<\/p>\n<pre><code>apply_filters( 'wp_nasaads_query_importer-API_value', mixed $value, string $field )\n<\/code><\/pre>\n<p>Filters the <code>$value<\/code> of a fetched API <code>$field<\/code> before it is inserted into the record\u2019s data. (<a href=\"https:\/\/github.com\/adsabs\/wp-nasaads-query-importer\" rel=\"nofollow ugc\">Source code<\/a>)<\/p>\n<pre><code>apply_filters( 'nasa_das_query-format_[placeholder]', mixed $current_value, mixed $original_value, array $atts )\n<\/code><\/pre>\n<p>The final value returned by this filter will be the replacement for the placeholder (without the leading %). The <code>$original_value<\/code> is that returned by the NASA ADS API while <code>$current_value<\/code> is the value already modified by filter functions of higher priority. The shortcode attributes are passed as the associative array <code>$atts<\/code>. See the source code of the <code>author filter<\/code> for an example. (<a href=\"https:\/\/github.com\/adsabs\/wp-nasaads-query-importer\" rel=\"nofollow ugc\">Source code<\/a>)<\/p>\n<h3>Requirements<\/h3>\n<p>The plugin needs your personalized NASA ADS API token in order to fetch records from the database and, thus, to work correctly! You need to <a href=\"https:\/\/ui.adsabs.harvard.edu\/user\/account\/register\" rel=\"nofollow ugc\">register an account<\/a> at NASA ADS or <a href=\"https:\/\/ui.adsabs.harvard.edu\/user\/account\/login\" rel=\"nofollow ugc\">login<\/a> and <a href=\"https:\/\/ui.adsabs.harvard.edu\/user\/settings\/token\" rel=\"nofollow ugc\">generate your token<\/a> in the account settings.<\/p>\n<h3>Examples<\/h3>\n<p>Show a list of refereed papers with Stephen Hawking among the list of authors:<br \/>\n    [wp_nasaads_query_importer author=\u201dHawking, S.\u201d property=\u201drefereed\u201d]<\/p>\n<p>Same as before but where Hawking was first author:<br \/>\n    [wp_nasaads_query_importer author=\u201d^Hawking, S.\u201d property=\u201drefereed\u201d]<\/p>\n<p>List all articles by Ejnar Hertzsprung published in the <em>Astronomische Nachrichten<\/em>:<br \/>\n    [wp_nasaads_query_importer author=\u201dHertzsprung, E.\u201d bibstem=\u201dAN\u201d]<\/p>\n<p>List all articles by Ejnar Hertzsprung and Henry Norris Russell. Note that the author string is surrounded by single quotes while the author names are surrounded by double quotes in order to preserve their last and first names. Also the search by both authors is logically combined by AND due to the space between their names:<br \/>\n    [wp_nasaads_query_importer author='\u201dHertzsprung, E.\u201d \u201cRussell, H.N.\u201d\u2018]<\/p>\n<p>Load a user ADS library and filter the list of papers on a year range and exclude a certain journal:<br \/>\n    [wp_nasaads_query_importer library=\u201dGdEguHJfSGCrYKKqJM-5XA\u201d year=\u201d1911-1914\u2033 bibstem=\u201d(-SciAm)\u201d max_rec=40]<\/p>\n<p>Same as before but only show the title by customizing the record template:<br \/>\n    <code><\/p>\n<ul>\n[wp_nasaads_query_importer library=\"GdEguHJfSGCrYKKqJM-5XA\" year=\"1911-1914\" bibstem=\"(-SciAm)\" max_rec=40]<\/p>\n<li><a href=\"%adsurl\">%title<\/a><\/li>\n<p>\n[\/wp_nasaads_query_importer]\n<\/ul>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fetch bibliographic records from The SAO\/NASA Astrophysics Data System (ADS) and include a list of these records in your posts using shortcodes.<\/p>\n","protected":false},"author":65,"featured_media":228505,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"WP Nasa\/ADS Query Importer - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"Fetch bibliographic records from The SAO\/NASA Astrophysics Data System (ADS) and include a list of these records in your posts using shortcodes."},"footnotes":""},"categories":[1],"tags":[569,1766,6084,6086],"class_list":["post-210513","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-ads","tag-article","tag-astronomy","tag-nasa"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/210513","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=210513"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/210513\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/228505"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=210513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=210513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=210513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}