Search in sources :

Example 1 with ResIterator

use of com.hp.hpl.jena.rdf.model.ResIterator in project lucene-skos by behas.

the class SKOSEngineImpl method indexSKOSModel.

/**
     * Creates the synonym index
     *
     * @throws IOException
     */
private void indexSKOSModel() throws IOException {
    IndexWriterConfig cfg = new IndexWriterConfig(analyzer);
    IndexWriter writer = new IndexWriter(indexDir, cfg);
    writer.getConfig().setRAMBufferSizeMB(48);
    /* iterate SKOS concepts, create Lucene docs and add them to the index */
    ResIterator concept_iter = skosModel.listResourcesWithProperty(RDF.type, SKOS.Concept);
    while (concept_iter.hasNext()) {
        Resource skos_concept = concept_iter.next();
        Document concept_doc = createDocumentsFromConcept(skos_concept);
        writer.addDocument(concept_doc);
    }
    writer.close();
}
Also used : ResIterator(com.hp.hpl.jena.rdf.model.ResIterator) Resource(com.hp.hpl.jena.rdf.model.Resource) Document(org.apache.lucene.document.Document)

Aggregations

ResIterator (com.hp.hpl.jena.rdf.model.ResIterator)1 Resource (com.hp.hpl.jena.rdf.model.Resource)1 Document (org.apache.lucene.document.Document)1