Package org.apache.jena.larq

Examples of org.apache.jena.larq.IndexBuilderModel


        Location location = new Location(args[0]);
        Dataset dataset = TDBFactory.createDataset(location);
       
        FSDirectory dir = FSDirectory.open(new File(args[1]));
        IndexWriter indexWriter = IndexWriterFactory.create(dir) ;
        IndexBuilderModel larqBuilder = new IndexBuilderString(indexWriter) ;
       
        Model defaultModel = dataset.getDefaultModel();
        index (larqBuilder, defaultModel);
        for ( Iterator<String> iter = dataset.listNames() ; iter.hasNext() ; ) {
            String g = iter.next() ;
View Full Code Here


        ResultSetFormatter.out(res);
        qe.close();
    }

    public static void index(Model m) {
        IndexBuilderModel larqBuilder = new IndexBuilderString();
        //IndexBuilderModel larqBuilder = new IndexBuilderSubject();
        StmtIterator iter = m.listStatements();
        larqBuilder.indexStatements(iter);
        larqBuilder.closeWriter();

        LARQ.setDefaultIndex(larqBuilder.getIndex());
    }
View Full Code Here

   
    @Override
    protected void exec()
    {
        // ---- Read and index all literal strings.
        IndexBuilderModel larqBuilder =
            indexSubjects ? new IndexBuilderSubject(modIndex.getIndexWriter()) :
                            new IndexBuilderString(modIndex.getIndexWriter()) ;
        if ( allow_duplicates ) larqBuilder.setAvoidDuplicates(false) ;
        Dataset ds = modDataset.getDataset() ;
        index(larqBuilder, ds.getDefaultModel()) ;
        for ( Iterator<String> iter = ds.listNames() ; iter.hasNext() ; )
        {
            String g = iter.next() ;
            index(larqBuilder, ds.getNamedModel(g)) ;
        }
       
        larqBuilder.closeWriter() ;
    }
View Full Code Here

        if ( dataset != null )
        {
            try
            {
                IndexWriter indexWriter = IndexWriterFactory.create(directory);
                IndexBuilderModel larqBuilder = new IndexBuilderString(indexWriter) ;
                dataset.getDefaultModel().register(larqBuilder);
                for ( Iterator<String> iter = dataset.listNames() ; iter.hasNext() ; ) {
                    String g = iter.next() ;
                    dataset.getNamedModel(g).register(larqBuilder) ;
                }
View Full Code Here

    private static void build (Dataset dataset, File path)
    {
        Directory directory = null ;
        IndexWriter indexWriter = null ;
        IndexBuilderModel larqBuilder = null ;
        try {
            directory = FSDirectory.open(path) ;
            indexWriter = IndexWriterFactory.create(directory);
            larqBuilder = new IndexBuilderString(indexWriter) ;
            larqBuilder.setAvoidDuplicates(false) ;
            index(larqBuilder, dataset.getDefaultModel()) ;
            for ( Iterator<String> iter = dataset.listNames() ; iter.hasNext() ; )
            {
                String g = iter.next() ;
                index(larqBuilder, dataset.getNamedModel(g)) ;
            }
        } catch (Exception e) {
            log.warn("Exception building the index: {}", e.getMessage()) ;
        } finally {
            if ( larqBuilder != null) larqBuilder.closeWriter() ;
            if ( directory != null ) try { directory.close() ; } catch (IOException e) { log.warn("Problems closing the Lucene directory.") ; }
        }
    }
View Full Code Here

        if ( dataset != null )
        {
            try
            {
                IndexWriter indexWriter = IndexWriterFactory.create(directory);
                IndexBuilderModel larqBuilder = new IndexBuilderString(indexWriter) ;
                dataset.getDefaultModel().register(larqBuilder);
                for ( Iterator<String> iter = dataset.listNames() ; iter.hasNext() ; ) {
                    String g = iter.next() ;
                    dataset.getNamedModel(g).register(larqBuilder) ;
                }
View Full Code Here

    private static void build (Dataset dataset, File path)
    {
        Directory directory = null ;
        IndexWriter indexWriter = null ;
        IndexBuilderModel larqBuilder = null ;
        try {
            directory = FSDirectory.open(path) ;
            indexWriter = IndexWriterFactory.create(directory);
            larqBuilder = new IndexBuilderString(indexWriter) ;
            larqBuilder.setAvoidDuplicates(false) ;
            index(larqBuilder, dataset.getDefaultModel()) ;
            for ( Iterator<String> iter = dataset.listNames() ; iter.hasNext() ; )
            {
                String g = iter.next() ;
                index(larqBuilder, dataset.getNamedModel(g)) ;
            }
        } catch (Exception e) {
            log.warn("Exception building the index: {}", e.getMessage()) ;
        } finally {
            if ( larqBuilder != null) larqBuilder.closeWriter() ;
            if ( directory != null ) try { directory.close() ; } catch (IOException e) { log.warn("Problems closing the Lucene directory.") ; }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jena.larq.IndexBuilderModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.