28

I found at Twitter that is possible to search for arXiv articles with Mathematica, e.g. the following code:

arXiv = ServiceConnect["ArXiv"];
articles = arXiv["Search", {"Query" -> "Mathematica"}];
articles[All, {"URL", "Title"}]

gives as result:

enter image description here

My question is:

  1. How can I specify the time range in between the articles were published?

  2. Is it possible to combine search keywords with binary operators (AND, OR, etc.)?

UPDATE:

To my second question:

articles = 
  arXiv["Search", {"Query" -> {"Title" -> {"Mathematica" | "Solving"}}}];

searches for all articles containing "Mathematica" OR "Solving" in "Title"

articles = 
  arXiv["Search", {"Query" -> {"Title" -> {"Mathematica", "Solving"}}}];

searches for all articles containing "Mathematica" AND "Solving" in "Title"

mmal
  • 3,508
  • 2
  • 18
  • 38
mrz
  • 11,686
  • 2
  • 25
  • 81

2 Answers2

19

Something like this:

arXiv = ServiceConnect["ArXiv"];

articles = 
  arXiv["Search", {"Query" -> {"Abstract" -> {"Eigenvalues", 
        "Mathematica"}}, MaxItems -> 25, "SortBy" -> "DateSubmitted"}];
articles[All, {"URL", "Title", "Published"}]

Looking at the help page has more info: ArXiv

user21
  • 39,710
  • 8
  • 110
  • 167
  • 5
    This successfully sorts the results by date, but how do you restrict results to be between a date range, as requested by the OP? – QuantumDot Dec 03 '16 at 20:12
  • 2
    Yes, this is one of the questions ... the rest I found also in the help. – mrz Dec 03 '16 at 21:06
6

Following up on the previous answer you can restrict by date pretty trivially using Mathematica:

arXiv = ServiceConnect["ArXiv"];
articles = arXiv["Search", {
    "Query" -> "Mathematica",
    "MaxItems" -> 1000, 
    "SortBy" -> "DateSubmitted"}];

selectFromRange[articles_, dmin_, dmax_] :=

 With[{min = DateObject@Normal@dmin, max = DateObject@Normal@dmax},
  articles[Select[min < #Published < max &]]
  ];

selectFromRange[articles, DateObject@Today[{"Year"}], Today]

Looking through the API documentation there doesn't seem to be a way to restrict within an API call and so any processing by date would have to be done after the fact anyway.

b3m2a1
  • 46,870
  • 3
  • 92
  • 239
  • 1
    That could be shortened a fair bit: articles[Select[#Updated ~Between~ {DateObject[{2016, 12, 20}], Today} &]]. – J. M.'s missing motivation Dec 29 '16 at 18:54
  • 1
    I figured for generality I'd leave the conversion of an arbitrary DateObject to it's most expanded form. Size comparisons for DateObjects with the different degrees of specificity, e.g., DateObject[{2016, 12}] and DateObject[{2016, 12, 10}] don't evaluate and the Normal scheme gets them to (by expanding to a DateList. One error though is that Today["Year"] should be DateObject@Today[{"Year"}]. – b3m2a1 Dec 29 '16 at 18:59
  • 1
    Huh. This works, tho: articles[Select[#Published ~Between~ {DateObject[{2016, 10}], DateObject[{2016, 12}]} &]] – J. M.'s missing motivation Dec 29 '16 at 19:17
  • 1
    That should select anything from Dec 11 2016. Try: Between[DateObject[{2016, 12, 10}], {DateObject[{2016, 10}], DateObject[{2016, 12}]}] to see what I mean. You get DateObject[{2016, 12, 10}] <= DateObject[{2016, 12}] as a return. – b3m2a1 Dec 29 '16 at 19:20