You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Mariacruz Jerald <ma...@nxp.com> on 2014/03/04 09:52:48 UTC
Indexing Triples with LARQ
Hi,
I'm new to LARQ. I have a code for indexing triples using LARQ.
public void indexTriples() {
try {
model = ModelFactory.createDefaultModel();
IndexBuilderString larqBuilder = new IndexBuilderString("path where the index will be stored");
model.register(larqBuilder);
FileManager.get().readModel(model, "path of file containg triples ");
larqBuilder.closeWriter();
model.unregister(larqBuilder);
IndexLARQ index = new IndexLARQ(IndexReader.open("path where the index is stored"), new StandardAnalyzer());
LARQ.setDefaultIndex(index);
} catch (Exception e) {
System.out.println("Exception caught: " + e.toString());
}
}
It's creating a index file in specified folder.
But what I want is to read these index files into a model and then want to query model. Otherwise each time I run this code , it indexes all the data again.
Is is possible to read these index files into a jena model??
Re: Indexing Triples with LARQ
Posted by Andy Seaborne <an...@apache.org>.
On 04/03/14 08:52, Mariacruz Jerald wrote:
> Hi,
> I'm new to LARQ. I have a code for indexing triples using LARQ.
>
> public void indexTriples() {
> try {
> model = ModelFactory.createDefaultModel();
>
> IndexBuilderString larqBuilder = new IndexBuilderString("path where the index will be stored");
> model.register(larqBuilder);
> FileManager.get().readModel(model, "path of file containg triples ");
> larqBuilder.closeWriter();
> model.unregister(larqBuilder);
> IndexLARQ index = new IndexLARQ(IndexReader.open("path where the index is stored"), new StandardAnalyzer());
> LARQ.setDefaultIndex(index);
>
>
> } catch (Exception e) {
> System.out.println("Exception caught: " + e.toString());
> }
>
> }
>
>
> It's creating a index file in specified folder.
> But what I want is to read these index files into a model and then want to query model. Otherwise each time I run this code , it indexes all the data again.
>
> Is is possible to read these index files into a jena model??
The text indexed are in the Lucene files.
As per my answer to Harkishan Singh
http://answers.semanticweb.com//questions/26764/indexing-triples-with-larq
(exactly the same question text)
LARQ has been superceded by the jena-text module.
If you have an in-memory RDF graph, use in-memory Lucene and index every
run. Otherwise, use a persistent graph and persistent Lucene, and load
once.
Andy