# How to delete downloaded data from a particular entity class?

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];
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?

• 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? Jul 3 '19 at 12:18

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

EntityPrefetch["NetworkService"];

Entity["NetworkService", "HTTP::7ww75"]["AlternateServiceNames"] // AbsoluteTiming

{0.000621, {"www", "www-http"}}


Clear the cache:

InternalClearEntityValueCache["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.

• 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. Jul 3 '19 at 15:19