public void loadFromModifiableHDT(TempHDT modHdt, ProgressListener listener) { modHdt.reorganizeDictionary(listener); modHdt.reorganizeTriples(listener); // Get parts TempTriples modifiableTriples = (TempTriples) modHdt.getTriples(); TempDictionary modifiableDictionary = (TempDictionary) modHdt.getDictionary(); // Convert triples to final format if(triples.getClass().equals(modifiableTriples.getClass())) { triples = modifiableTriples; } else { //StopWatch tripleConvTime = new StopWatch(); triples.load(modifiableTriples, listener); //System.out.println("Triples conversion time: "+tripleConvTime.stopAndShow()); } // Convert dictionary to final format if(dictionary.getClass().equals(modifiableDictionary.getClass())) { dictionary = (DictionaryPrivate)modifiableDictionary; } else { //StopWatch dictConvTime = new StopWatch(); dictionary.load(modifiableDictionary, listener); //System.out.println("Dictionary conversion time: "+dictConvTime.stopAndShow()); } this.baseUri = modHdt.getBaseURI(); isClosed=false; }
hdt.populateHeaderStructure(modHDT.getBaseURI());
@Override public HDT doGenerateHDT(String rdfFileName, String baseURI, RDFNotation rdfNotation, HDTOptions spec, ProgressListener listener) throws IOException, ParserException { //choose the importer String loaderType = spec.get("loader.type"); TempHDTImporter loader; if ("two-pass".equals(loaderType)) { loader = new TempHDTImporterTwoPass(); } else { loader = new TempHDTImporterOnePass(); } // Create TempHDT TempHDT modHdt = loader.loadFromRDF(spec, rdfFileName, baseURI, rdfNotation, listener); // Convert to HDT HDTImpl hdt = new HDTImpl(spec); hdt.loadFromModifiableHDT(modHdt, listener); hdt.populateHeaderStructure(modHdt.getBaseURI()); // Add file size to Header try { long originalSize = HeaderUtil.getPropertyLong(modHdt.getHeader(), "_:statistics", HDTVocabulary.ORIGINAL_SIZE); hdt.getHeader().insert("_:statistics", HDTVocabulary.ORIGINAL_SIZE, originalSize); } catch (NotFoundException e) { } modHdt.close(); return hdt; }
@Override public HDT doGenerateHDT(Iterator<TripleString> triples, String baseURI, HDTOptions spec, ProgressListener listener) throws IOException { //choose the importer TempHDTImporterOnePass loader = new TempHDTImporterOnePass(); // Create TempHDT TempHDT modHdt = loader.loadFromTriples(spec, triples, baseURI, listener); // Convert to HDT HDTImpl hdt = new HDTImpl(spec); hdt.loadFromModifiableHDT(modHdt, listener); hdt.populateHeaderStructure(modHdt.getBaseURI()); // Add file size to Header try { long originalSize = HeaderUtil.getPropertyLong(modHdt.getHeader(), "_:statistics", HDTVocabulary.ORIGINAL_SIZE); hdt.getHeader().insert("_:statistics", HDTVocabulary.ORIGINAL_SIZE, originalSize); } catch (NotFoundException e) { } modHdt.close(); return hdt; }