Package com.hp.hpl.jena.query

Examples of com.hp.hpl.jena.query.Dataset


    static Dataset getDataset(Resource r)
    {
        //DataSource ds = DatasetFactory.create() ;
        DatasetGraph dsg = DatasetGraphFactory.createMem() ;
        // Growing. dataset.
        Dataset ds = DatasetFactory.create(dsg) ;
       
       
        List<String> dftData = getAll(r,  TestManifestUpdate_11.data) ;
        for ( String x : dftData )
            FileManager.get().readModel(ds.getDefaultModel(), x) ;
       
        ClosableIterator<Statement> cIter =  r.listProperties(TestManifestUpdate_11.graphData) ;
        for ( ; cIter.hasNext() ; )
        {
            // An graphData entry can be a URI or a [ ut ... ; rdfs:label "foo" ] ;
            Statement stmt = cIter.next() ;
            Resource gn = stmt.getResource() ;
            if ( gn.isAnon() )
            {
                if ( ! gn.hasProperty(TestManifestUpdate_11.graph) )
                    System.err.println("No data for graphData") ;
               
                String fn = gn.getProperty(TestManifestUpdate_11.graph).getResource().getURI() ;
                String name = gn.getProperty(RDFS.label).getString() ;
                Model m = FileManager.get().loadModel(fn) ;
                ds.addNamedModel(name, m) ;
            }
            else
            {
                String x = gn.getURI() ;
                Model m = FileManager.get().loadModel(x) ;
                ds.addNamedModel(x, m) ;
            }
        }
        cIter.close() ;
        return ds ;
    }
View Full Code Here


    }

    @Test
    public void testUpdateRepository()
    {
        Dataset ds = DatasetStore.create(store);
        Model model = ds.getDefaultModel();

        String processingElement = "dummyPE01";
        String structuralType = "dummyST01";
        String input = "dummyInput01";
        String output = "dummyOutput01";
View Full Code Here

      emptyAndDeleteDirectory(indexDir);
  }
 
  private static Dataset createDatasetByCode(File indexDir) throws IOException {
    // Base data
    Dataset ds1 = DatasetFactory.createMem();
    return joinDataset(ds1, indexDir);
  }
View Full Code Here

    return joinDataset(ds1, indexDir);
  }
 
  private static Dataset createDatasetByCode(File indexDir, File TDBDir) throws IOException {
    // Base data
    Dataset ds1 = TDBFactory.createDataset(TDBDir.getAbsolutePath());
    return joinDataset(ds1, indexDir);
  }
View Full Code Here

    // Lucene, index in File system.
    Directory dir = FSDirectory.open(indexDir);

    // Join together into a dataset
    Dataset ds = SpatialDatasetFactory.createLucene(baseDataset, dir, entDef);

    return ds;
  }
View Full Code Here

  private static final Resource spec1;
  private static final Resource noDatasetPropertySpec;
  private static final Resource noIndexPropertySpec;
 
  @Test public void testSimpleDatasetAssembler() {
    Dataset dataset = (Dataset) Assembler.general.open(spec1);
    assertTrue(dataset.getContext().get(SpatialQuery.spatialIndex) instanceof SpatialIndexLucene);
  }
View Full Code Here

    @Test public void writer04() { test("writer-rt-24.trig") ; }
   
    private void test(String filename)
    {
        String displayname = filename.substring(0, filename.lastIndexOf('.')) ;
        Dataset ds = readDataset(filename) ;
        Lang lang = format.getLang() ;

        WriterDatasetRIOT rs = RDFWriterRegistry.getWriterDatasetFactory(format).create(format) ;
        assertEquals(lang, rs.getLang()) ;

        ByteArrayOutputStream out = new ByteArrayOutputStream() ;
        RDFDataMgr.write(out, ds, format) ;
       
        if ( lang == Lang.RDFNULL )
            return ;
       
        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()) ;
        String s = StrUtils.fromUTF8bytes(out.toByteArray()) ;
        if (false) {
            System.out.println(format.toString());
            System.out.println(s);
            System.out.println();
        }
        Dataset ds2 = DatasetFactory.createMem() ;
        try {
            RDFDataMgr.read(ds2, in, lang) ;
        } catch (RiotException ex)
        {
            System.out.println(displayname+" : "+format) ;
View Full Code Here

            throw ex ; }
    }
   
    private void run4()
    {
        Dataset ds = DatasetFactory.createMem() ;
        try {
            RDFDataMgr.read(ds, input) ;
            fail("Managed to read a bad evaluation test without error") ;
        }
        catch (RiotException ex) {}
View Full Code Here

                ResultSet.HOLD_CURSORS_OVER_COMMIT, JenaConnection.DEFAULT_AUTO_COMMIT, JdbcCompatibility.DEFAULT);
    }

    @Override
    protected JenaConnection getConnection(Dataset ds) throws SQLException {
        Dataset tdb = TDBFactory.createDataset(tempDir.getRoot().getAbsolutePath());
        TestUtils.copyDataset(ds, tdb, true);
        return new TDBConnection(tdb, ResultSet.HOLD_CURSORS_OVER_COMMIT, JenaConnection.DEFAULT_AUTO_COMMIT,
                JdbcCompatibility.DEFAULT);
    }
View Full Code Here

                JenaConnection.DEFAULT_AUTO_COMMIT, JdbcCompatibility.DEFAULT);
    }

    @Override
    protected JenaConnection getConnection(Dataset ds) throws SQLException {
        Dataset tdb = TDBFactory.createDataset();
        TestUtils.copyDataset(ds, tdb, true);
        return new TDBConnection(tdb, ResultSet.HOLD_CURSORS_OVER_COMMIT, JenaConnection.DEFAULT_AUTO_COMMIT,
                JdbcCompatibility.DEFAULT);
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.query.Dataset

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.