Project

General

Profile

« Previous | Next » 

Revision 8765

when indexing annotations directly, just use an in-memory triple store rather than TDB since we remove each graph as it is processed (and my TDB instance would get into the multi-GB range with a few runs, even if I removed the old models)

View differences:

src/edu/ucsb/nceas/metacat/annotation/DatapackageSummarizer.java
31 31
import com.hp.hpl.jena.ontology.OntModel;
32 32
import com.hp.hpl.jena.ontology.Ontology;
33 33
import com.hp.hpl.jena.query.Dataset;
34
import com.hp.hpl.jena.query.DatasetFactory;
34 35
import com.hp.hpl.jena.query.Query;
35 36
import com.hp.hpl.jena.query.QueryExecution;
36 37
import com.hp.hpl.jena.query.QueryExecutionFactory;
......
84 85
		String rdfContent = this.generateAnnotation(metadataPid);
85 86
		
86 87
		// load to triple store
87
		Dataset dataset = TDBFactory.createDataset("./tbd");
88
		//Dataset dataset = TDBFactory.createDataset("./tbd");
89
		Dataset dataset = DatasetFactory.createMem();
88 90
		
89 91
    	// read the annotation into the triplestore
90 92
		InputStream source = IOUtils.toInputStream(rdfContent, "UTF-8");
......
94 96
    		dataset.removeNamedModel(name);
95 97
    		loaded = false;
96 98
    	}
99
		OntModel ontModel = null;
97 100
		if (!loaded) {
98
			OntModel ontModel = ModelFactory.createOntologyModel();
101
			ontModel = ModelFactory.createOntologyModel();
99 102
			ontModel.read(source, name);
100 103
			dataset.addNamedModel(name, ontModel);
101 104
		}
......
185 188
			}
186 189
        }
187 190

  
191
        // remove the graph to save storage
192
//        ontModel.removeAll();
193
//        ontModel.commit();
194
//        ontModel.close();
195
		dataset.removeNamedModel(name);
196
        
188 197
		// clean up the triple store
189 198
		TDBFactory.release(dataset);
190 199
        

Also available in: Unified diff