Group Abstract Group Abstract

Message Boards Message Boards

0
|
11.4K Views
|
10 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?] Put a DataResource into persistent local storage?

I've downloaded a DataResource EntityStore from the Wolfram Data Depository, specifically, the ResourceObject["General Topology EntityStore"], in the form of the packageGeneral-Topology-EntityStore.wl`.

I know how to use $EntityStores to use this EntityStore within a given Mathematica session.

But exactly how do I use the Wolfram Language, within Mathematica, to make this EntityStore into a local persistent object?

POSTED BY: Murray Eisenberg
10 Replies

Yes, that's exactly what I was looking for! Thank you.

POSTED BY: Murray Eisenberg

Is something like the following on the right track?

ro = ResourceObject["General Topology EntityStore"];
store = ResourceData[ro, "EntityStore"];
PersistentValue["GeneralTopologyEntityStore"] = store;

Then

Quit[]

in a new session:

AppendTo[$EntityStores, PersistentValue["GeneralTopologyEntityStore"]];

RandomEntity["GeneralTopologyConcept"]
(* Entity["GeneralTopologyConcept", "SpaceWithTopologyOfPointwiseConvergence"]*)
POSTED BY: Jesus Hernandez

The .wl file was downloaded directly from https://datarepository.wolframcloud.com.

POSTED BY: Murray Eisenberg
POSTED BY: Murray Eisenberg
POSTED BY: Jason Biggs

OK, I can do the Get for the .wl now — have no idea why it didn't work yesterday! — and then successfully evaluating AppendTo[$EntityStores, store].

But after quitting the Mathematica session and starting a new session, once again $EntityStores is empty.

Is there some Option I need to set in order make the objects persistent?

POSTED BY: Murray Eisenberg

@Murray Eisenberg First you need to figure out why you get $Failed when trying to Get the file (<<).

Do you get True from FileExistsQ["~/Downloads/General-Topology-EntityStore.wl"]? What happens when you try to use Import instead of Get?

As to the persistence - I think that is just the way $EntityStores was designed. If you solve the problem above and are able to read in the store using Get, then you could add the line AppendTo code above to your "~/Library/Mathematica/Kernel/init.m" file and it would be available via EntityValue every time you start a kernel

POSTED BY: Jason Biggs

That is precisely the location to which the .wl file was downloaded and (temporarily) resides. But...

  • evaluating << "~/Downloads/General-Topology-EntityStore.wl" gives a $Failed message; and
  • $EntityStoresseems to be localized to the particular session rather than persisting across sessions.
POSTED BY: Murray Eisenberg

If you've already downloaded the file "General-Topology-EntityStore.wl" linked to from here, then all you need to do in your notebook is run this command

store = << "~/Downloads/General-Topology-EntityStore.wl"; (* or wherever you downloaded the data to *)
AppendTo[$EntityStores, << store]

and then you can access all the data via EntityValue

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