On 25/08/14 22:20, Hubert A Le Van Gong wrote:
On Aug 25, 2014, at 12:03 PM, Andy Seaborne <[email protected]> wrote:
On 25/08/14 18:58, Hubert A Le Van Gong wrote:
Actually this does not work because I need a dataset to invoke isBackedByTDB()
or location().
So restating my question a bit: given a directory (String), what is the best
way to verify that the dataset exists at the data store level?
Thanks,
Hubert
Location.exists()
There isn't a way to verify it is a TDB-formatted directory (TDB autoformats
anyway).
Looking for some necessary files (e.g. SPO.dat, SPO.idn) in the Location should
work.
Andy
Hi,
hmm, I tried the following but it does not seem to work (dataset is never
found).
String directory = DBpath.concat("/" + datasetID);
Location loc = Location.mem(directory);
boolean isbacked = loc.exists();
if (isbacked) {
log.debug("=> Found dataset to be deleted.");
} else {
log.debug("=> dataset to be deleted not found.");
}
Maybe it's the way I initialize the Location?
Ah - I see more clearly now.
Locations auto-create directories as need (.exists is probably not very
useful as it only applies during execution).
java.io.File.exists() does what want.
BTW, how does one remove a dataset from a TDB store?
You mean deleting an entire database?
Delete the directory (noting on Windows that the deletion actually
happens when the JVM exits because that's the way Java memory mapped
files work on MS Windows).
Andy
I didn't see a dedicated API call for this.
Cheers,
Hubert
On Aug 25, 2014, at 10:11 AM, Hubert A Le Van Gong <[email protected]> wrote:
Hello,
Is TDBFactory.isBackedByTDB() the proper way to simply test for the existence
of a dataset?
Thanks,
Hubert