1
$\begingroup$

I hope this isn't too obvious of a question, but I've looked around and can't find what I am looking for.

The problem: I have a list of data - in this case it's my album collection. The list is simple - artist and album title. If I have a notebook open and call to the WolframAlpha like this, for example:

=beatles abbey road release data

Then I get a date object with what is presumably the correct release date - in this case 26 September 1969. Terrific. Now I want to do this for all of my fairly long list of albums and add it to my data. But here's the problem. I can't (read: too lazy to) do this by hand for my several hundred albums, so obviously want to write code to go through my list of each album, pull the release date from the online data source (as a starter - I'll probably add to that once I know what I am doing) and add the release date to my list(s).

I tried: ResourceObject["beatles abbey road release date"] ("could not be found") ResourceSearch["beatles abbey road release date"] ("You must connect to the Wolfram Cloud...")

I don't know that ResourceSearch would not work, but am unsure of my WolframCloud status.

I have an up-to-date license for Mathematica and I know that affords me some cloud access, but I don't know if this is part of the license or not - or if I would exhaust what little annual cloud resources I get with that license long before I exhaust my list of albums (i.e., I have never accessed the WolframCloud and really have no clue here).

So I guess my first question is - if I in theory can sit here all day and type in, for example:

=beatles abbey road release data

And get EXACTLY what I need from WolframAlpha one query at a time - and clearly I can - is there an equivalent way for me to get the exact same data in code (that I obviously haven't figured out yet).

The second question is - if I am even close to getting on the right path with what I described above - do I absolutely have to have a WolframCloud account set up and have paid for some sort of cloud resources in order to do this is code, or depending on the answer to the first question, is there a way to do this in code that doesn't make Mathematica think it needs me to log into the Cloud first?

Thanks for any suggestions!

$\endgroup$
2
  • 2
    $\begingroup$ Sorry! I swear I looked! But shortly after posting this I did find the following works for me - had never seen this function in Mathamatica before - hope this helps someone else! WolframAlpha["beatles abbey road redlease date", "Result"] $\endgroup$
    – Merrick
    Commented Jun 29 at 12:34
  • $\begingroup$ Nice. You might want to make your comment into a response (self-responses are fine here). It’s not something everyone knows about. $\endgroup$ Commented Jun 29 at 16:03

2 Answers 2

1
$\begingroup$

You could make use of Interpreter to get the entity names, and then use EntityValue to find the release dates:

albums = Interpreter["MusicAlbum"] /@ {"abbey road", "dark side of the moon"}

{Entity["MusicAlbum", "AbbeyRoad::s3hj2"], Entity["MusicAlbum", "TheDarkSideoftheMoon::498q9"]}

EntityValue[albums, "CanonicalReleaseDate"]

{DateObject[{1969, 9, 26}, "Day"], DateObject[{1973, 3, 24}, "Day"]}

$\endgroup$
-2
$\begingroup$

You can indeed automate the process of retrieving album release dates in Mathematica using WolframAlpha queries, and you might not necessarily need extensive use of the Wolfram Cloud for this purpose, here is an attempt to do that :

(* List of albums *)
albums = {
  {"The Beatles", "Abbey Road"},
  {"Pink Floyd", "The Dark Side of the Moon"},
  {"Led Zeppelin", "IV"},
  (* Add more albums here *)
};

(* Function to get release date from WolframAlpha *)
getReleaseDate[artist_, album_] := Module[{query, result},
  query = artist <> " " <> album <> " release date";
  result = WolframAlpha[query, {{"Date", 1}, "Plaintext"}];
  If[StringMatchQ[result, __ ~~ "None" ~~ __],
    "Date not found",
    DateObject[result]
  ]
];

(* Apply the function to the list of albums *)
releaseDates = Table[
  {artist, album, getReleaseDate[artist, album]},
  {artist, album} ∈ albums
];

(* View the results *)
releaseDates // TableForm
$\endgroup$
1
  • $\begingroup$ For the third time here, please stop posting LLM generated answers. This is not allowed here, and it is not helpful. $\endgroup$
    – Domen
    Commented Jun 29 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.