I am working with a simple Jena dataset, which only has a single ~30 MB RDF file imported. As a part of the application, I am trying to let users query the default graph (or a named graph) and insert the resulting triples from the query into a new named graph. For this, I am using a CONSTRUCT statement to form the result set of triples in RDF form, then putting these triples into a new model (using QueryExecution.execConstruct()) and adding this model to the dataset. This appears to work again, as the dataset gets a new graph node, and the disk size of the TDB database folder grows in size.
The problem here comes up when I try to remove a named graph from the dataset. Using Dataset's removeNamedName("graphName") method, I remove the model from the dataset. Future queries over that model name reveal that it has successfully been removed. However, the disk size of the TDB database folder remains the same size, even after syncing and quitting.
At first I thought that perhaps the database was just marking the deleted files' space as free so that it could be overwritten as new data came in, but this doesn't seem to be the case. If I delete a named graph and replace it immediately after in the same program run, the folder doesn't seem to grow, but if I add a new named graph and delete it in the same run, the folder size gets bigger and the model removal doesn't free up the memory, meaning that after a few runs the database folder is five or ten times its original size without holding any more data.
Any insight or help would be great, thanks again.