Message Boards Message Boards

1
|
6718 Views
|
3 Replies
|
5 Total Likes
View groups...
Share
Share this post:

How create local copy of Wolfram Data Repository resource

I know how to search https://datarepository.wolframcloud.com and how to copy and then evaluate an expression such as:

ResourceObject["General Topology EntityStore"]

But how can I keep a local copy of such a resource to use subsequently?

(I have the feeling that this has been asked here before, possibly by me, and answered, but I cannot find the post.)

POSTED BY: Murray Eisenberg
3 Replies

When you use a ResourceObject, it is automatically cached locally in a dedicated directory in your $DefaultLocalBase. The first time you retrieve the content of the resource object - data in this case - it is also cached locally.

Clear local cache

In[94]:= ResourceRemove[ResourceObject["General Topology EntityStore"]]

Out[94]= "15ef2946-102d-4814-b321-77286cfc41a6"

Download

In[97]:= AbsoluteTiming[ByteCount@ResourceData["General Topology EntityStore"]]

Out[97]= {0.926332, 13423880}

Reuse the cached version

In[98]:= AbsoluteTiming[ByteCount@ResourceData["General Topology EntityStore"]]

Out[98]= {0.036689, 13423880}

In a new session

In[99]:= Quit

In[1]:= ResourceData; (* there is some initialization that would inflate the timing *)

The first use is slightly slower because it resolves the resource name and validates the metadata cache.

In[2]:= AbsoluteTiming[ByteCount@ResourceData["General Topology EntityStore"]]

Out[2]= {0.429235, 13423880}

In[3]:= AbsoluteTiming[ByteCount@ResourceData["General Topology EntityStore"]]

Out[3]= {0.034282, 13423880}

Keep in mind this cache is on-disk. There is not automatically a kernel-level cache, but you can use Once[ResourceData[...]] to effectively cache in the kernel session.

If you want more control (formatting, file location, etc.) then of course you can use standard Export operations directly on the data.

POSTED BY: Bob Sandheinrich

Do you mean you want it automatically cached and Mathematica then know it and upon consequent calls it would go to a local copy without internet for example? Otherwise you could just Put, Export, etc...

POSTED BY: Kapio Letto

How (and where) should I save the ResourceObject locally for subsequent use?

How do I then make its data available at a subsequent Mathematica session?

POSTED BY: Murray Eisenberg
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract