I evaluate ResourcObject["someName"], where the object i question is somewhere in the Cloud, I have access to it in the current Mathematica session. But how can I get it to be stored on my local machine, so that I subsequently have access to it there, without resorting to the Cloud again?
And where exactly does that object get stored on the local machine? (Presumably somewhere in $UserBaseDirectory?
Consider the preceding questions in the situation, for example, with:
Hi Murray,
One way to do this is to assign the ResourceObject to a symbol, and then export the symbol to a .mx file in a directory of your choice. The value of the ResourceObject can then be reloaded as needed. For example:
SetDirectory[NotebookDirectory[]];
sampleDataForQueryBook = ResourceObject["Sample Data for Query Book"];
DumpSave["Query data.mx", sampleDataForQueryBook];
Clear@sampleDataForQueryBook
sampleDataForQueryBook
(* sampleDataForQueryBook *)
<< "Query data.mx"
sampleDataForQueryBook
(*ResourceObject[Name: Sample Data for Query Book »
Type: DataResource \[SpanFromLeft]
Description: Data to support the Wolfram Media book Query: Getting \
Information from Data with... \[SpanFromLeft]
]*)
ResourceObject + ResourceData will cache the data locally.
ro = ResourceObject["Sample Data for Query Book"]
rd = ResourceData["Sample Data for Query Book"]
Quit[]
(* Use the locally cached data *)
rd = ResourceData["Sample Data for Query Book"]
(* Location of cached data *)
ro["ResourceLocations"]
A little note that one must first, of course, save the current notebook before setting the SetDirectory.
This method is not as general as one might wish, since the .mx file is saved in the current notebook’s directory and not in $UserBaseDirectory or, perhaps better, in ~/Library/Wolfram/Objects..
`.