Package com.hp.hpl.jena.query

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


       
        // Otherwise
        if ( contains(assemblerDescDecl) )
        {
            log.info("Dataset from assembler") ;
            Dataset ds = modDataset.createDataset() ;
            if ( ds != null )
                dsg = ds.asDatasetGraph() ;
        }
       
        if ( contains(argFusekiConfig) )
        {
            if ( dsg != null )
View Full Code Here


    //String baseGraphName = "com.ibm.test.graphNamePrefix.";  

    long totalExecTime = 0L;
    long size = 0;
    Dataset dataset = TDBFactory.createDataset(location);
   
    Dataset dataset1 = TDBFactory.createDataset(location);
   
    if ( bracketWithReader )
        dataset1.begin(ReadWrite.READ) ;
   
    for (int i = 0; i < TOTAL; i++) {
      List<String> lastProcessedUris = new ArrayList<String>();
      for (int j = 0; j < 10*i; j++) {
        String lastProcessedUri = "http://test.net/xmlns/test/1.0/someUri" + j;
        lastProcessedUris.add(lastProcessedUri);
      }
      //Dataset dataset = TDBFactory.createDataset(location);
      //String graphName = baseGraphName + i;
      long t = System.currentTimeMillis();

      try {
        dataset.begin(ReadWrite.WRITE);
        Model m = dataset.getDefaultModel();

        m.removeAll();
        Resource subject = m.createResource(INDEX_INFO_SUBJECT);
        Property predicate = m.createProperty(TIMESTAMP_PREDICATE);
        m.addLiteral(subject, predicate, System.currentTimeMillis());
        predicate = m.createProperty(URI_PREDICATE);
        for (String uri : lastProcessedUris) {
          m.add(subject, predicate, m.createResource(uri));
        }
        predicate = m.createProperty(VERSION_PREDICATE);
        m.addLiteral(subject, predicate, 1.0);

        size += m.size() + 1;

        predicate = m.createProperty(INDEX_SIZE_PREDICATE);
        m.addLiteral(subject, predicate, size);

        dataset.commit();
      } catch (Throwable e) {
        dataset.abort();
        throw new RuntimeException(e);
      } finally {
        dataset.end();
        long writeOperationDuration = System.currentTimeMillis() - t;
        totalExecTime += writeOperationDuration;
        System.out.println("Write operation " + i + " took " + writeOperationDuration + "ms");
      }
    }
        if ( bracketWithReader )
            dataset1.end() ;

    System.out.println("All " + TOTAL + " write operations wrote " + size + " triples and took " + totalExecTime + "ms");
  }
View Full Code Here

        // Check if it is in the model.
        if ( ! datasetDesc.hasProperty(RDF.type) )
            throw new FusekiConfigException("No rdf:type for dataset "+nodeLabel(datasetDesc)) ;
       
        Dataset ds = (Dataset)Assembler.general.open(datasetDesc;
        sDesc.dataset = ds.asDatasetGraph() ;
        return sDesc ;
       
    }
View Full Code Here

        return QueryExecutionFactory.create(query, dataset) ;
    }

    protected SPARQLResult executeQuery(HttpActionQuery action, Query query, String queryStringLog)
    {
        Dataset dataset = decideDataset(action, query, queryStringLog) ;
        QueryExecution qexec = createQueryExecution(query, dataset) ;
        setAnyTimeouts(qexec, action);

        if ( query.isSelectType() )
        {
View Full Code Here

            assertTrue(dsgTxn2.contains(q)) ;
        assertTrue(dsgTxn2.contains(q1)) ;
        dsgTxn2.end() ;

        // Check API methods work.
        Dataset ds = TDBFactory.createDataset(loc) ;
        ds.begin(ReadWrite.READ) ;
        Model m = (q.isDefaultGraph() ? ds.getDefaultModel() : ds.getNamedModel("g")) ;
        assertEquals( nonTxnData ? 2 : 1 , m.size()) ;
        ds.end() ;
    }
View Full Code Here

  /** Create a memory Dataset and read in some data
     * @see #read(Dataset,String)
     */
    public static Dataset loadDataset(String uri)
  {
        Dataset ds = createDataset() ;
        read(ds, uri) ;
        return ds ;
    }
View Full Code Here

  /** Create a memory Dataset and read in some data
     * @see #read(Dataset,String,Lang)
     */
    public static Dataset loadDataset(String uri, Lang lang)
  {
        Dataset ds = createDataset() ;
        read(ds, uri, lang) ;
        return ds ;
  }
View Full Code Here

   
    @Override
    public Dataset open(Assembler a, Resource root, Mode mode)
    {
        StoreDesc desc = openStore(a, root, mode) ;
        Dataset ds = SDBFactory.connectDataset(desc) ;
        AssemblerUtils.setContext(root, ds.getContext());
        return ds ;
    }
View Full Code Here

            graphName = getAsStringValue(root, pGraphName2) ;

        if ( root.hasProperty(pIndex) )
            Log.warn(this, "Custom indexes not implemented yet - ignored") ;

        final Dataset ds ;
       
        if ( locationDir != null )
        {
            Location location = new Location(locationDir) ;
            ds = TDBFactory.createDataset(location) ;
        }
        else
            ds = DatasetAssemblerTDB.make(dataset) ;

        try {
            if ( graphName != null )
                return ds.getNamedModel(graphName) ;
            else
                return ds.getDefaultModel() ;
        } catch (RuntimeException ex)
        {
            ex.printStackTrace(System.err) ;
            throw ex ;
        }
View Full Code Here

        return DatasetAssemblerVocab.tDataset ;
    }

    @Override
    public Object open(Assembler a, Resource root, Mode mode) {
        Dataset ds = createDataset(a, root, mode) ;
        return ds ;
    }
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.