2
$\begingroup$

I have a function below which downloads an entire entity class as a local copy on the system in a single query, so any further queries don't have to be send to the online server.

ClearAll[downloadEntireEntityClass];
downloadEntireEntityClass[class_]:=CompoundExpression[
    EntityValue[EntityList@class,"EntityPropertyAssociation"],
    Null
];

Suppose now I use this function to download a local copy of the following entity class.

downloadEntireEntityClass[EntityClass["NetworkService", All]]

Now how do I delete all the downloaded data so when I use this function again this downloads the entire data as a fresh copy?

How to get the location of the downloaded data and delete it?

Moreover if I don't delete the data and wolfram update this data on their server will any further queries check the changes and automatically update the local copy?

$\endgroup$
1
  • $\begingroup$ I am assuming you are wanting this so you can limit network usage during calculations or for off-line use. Have you looked into EntityPrefetch? $\endgroup$
    – kickert
    Jul 3 '19 at 12:18
2
$\begingroup$

There's an internal function that can purge the cache:

Load the data:

EntityPrefetch["NetworkService"];

Entity["NetworkService", "HTTP::7ww75"]["AlternateServiceNames"] // AbsoluteTiming
{0.000621, {"www", "www-http"}}

Clear the cache:

Internal`ClearEntityValueCache["NetworkService"];

Entity["NetworkService", "HTTP::7ww75"]["AlternateServiceNames"] // AbsoluteTiming
{0.543391, {"www", "www-http"}}

The data is stored in FileNameJoin[{$UserBaseDirectory, "Knowledgebase"}], but it's obfuscated so I don't think it would be easy to cherry pick anything to delete manually. You could delete all contents though.

$\endgroup$
1
  • $\begingroup$ I read the OP as wanting a local copy apart from the cache... at least that is what I assumed based on the defined function they were using. $\endgroup$
    – kickert
    Jul 3 '19 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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