}
static IndexLARQ buildIndexExternalContent(Model model)
{
// ---- Create index builder
IndexBuilderNode larqBuilder = new IndexBuilderNode() ;
Resource r1 = ResourceFactory.createResource("http://example/r1") ;
Resource r2 = ResourceFactory.createResource("http://example/r2") ;
Resource r3 = ResourceFactory.createResource("http://example/r3") ;
Resource r4 = ResourceFactory.createResource("http://example/r4") ;
Literal lit1 = ResourceFactory.createPlainLiteral("doc") ;
// ---- Index based on some external content. Teh content can be any string of words.
larqBuilder.index(r1, new StringReader("document")) ; // Just to show a Stringreader is possible
larqBuilder.index(r2, "document") ;
larqBuilder.index(r3, "slideshow") ;
larqBuilder.index(r4, "codebase") ;
larqBuilder.index(lit1, "document") ;
// Note that the model is untouched - the index exists outside of any model statements.
// The application is responsible for keeping
// ----
larqBuilder.closeWriter() ;
IndexLARQ index = larqBuilder.getIndex() ;
// NodeIterator iter = index.searchModelByIndex(model, "document") ;
// for ( ; iter.hasNext() ; )
// System.out.println("Found: "+FmtUtils.stringForRDFNode((RDFNode)iter.next())) ;