Package com.hp.hpl.jena.sparql.core

Examples of com.hp.hpl.jena.sparql.core.DatasetGraph


    public void store_5()
    {
        // No transaction.  Make sure StoreConnection.release cleans up OK. 
        StoreConnection sConn = getStoreConnection() ;
        Location loc = sConn.getLocation() ;
        DatasetGraph dsg = sConn.getBaseDataset() ;
        dsg.add(q) ;
        assertTrue(dsg.contains(q)) ;
       
        StoreConnection.release(loc) ;
        sConn = StoreConnection.make(loc) ;
        dsg = sConn.getBaseDataset() ;
        assertTrue(dsg.contains(q)) ;
    }
View Full Code Here


        sConn.forceRecoverFromJournal() ;
        assertTrue(sConn.getBaseDataset().contains(q1)) ;
       
        StoreConnection.release(loc) ;
        sConn = StoreConnection.make(loc) ;
        DatasetGraph dsg2 = sConn.getBaseDataset() ;
        assertTrue(dsg2.contains(q1)) ;
       
        DatasetGraphTxn dsgTxn2 = sConn.begin(ReadWrite.READ) ;
        assertTrue(dsgTxn2.contains(q1)) ;
        dsgTxn2.end() ;
    }
View Full Code Here

       
        boolean nonTxnData = true ;
       
        StoreConnection sConn = getStoreConnection() ;
        Location loc = sConn.getLocation() ;
        DatasetGraph dsg = sConn.getBaseDataset() ;
        if ( nonTxnData )
        {
            dsg.add(q) ;
            TDB.sync(dsg) ;
            assertTrue(dsg.contains(q)) ;
        }

        DatasetGraphTxn dsgTxn = sConn.begin(ReadWrite.WRITE) ;
        if ( nonTxnData )
            assertTrue(dsgTxn.contains(q)) ;
        dsgTxn.add(q1) ;
        assertTrue(dsgTxn.contains(q1)) ;
        if ( nonTxnData )
            assertTrue(dsgTxn.contains(q)) ;
        dsgTxn.commit() ;
        dsgTxn.end() ;

        // Should have flushed to disk.
        if ( nonTxnData )
        {
            sConn.forceRecoverFromJournal() ;
            assertTrue(dsg.contains(q)) ;
        }
        assertTrue(dsg.contains(q1)) ;
       
        // release via the transactional machinery
        StoreConnection.release(loc) ;
        sConn = null ;
       
        StoreConnection sConn2 = StoreConnection.make(loc) ;
        DatasetGraph dsg2 = sConn2.getBaseDataset() ;
       
        if ( nonTxnData )
            assertTrue(dsg2.contains(q)) ;
        assertTrue(dsg2.contains(q1)) ;
       
        DatasetGraphTxn dsgTxn2 = sConn2.begin(ReadWrite.READ) ;
        if ( nonTxnData )
            assertTrue(dsgTxn2.contains(q)) ;
        assertTrue(dsgTxn2.contains(q1)) ;
View Full Code Here

        StreamRDF dest = StreamRDFLib.graph(graphTmp) ;
        LangRIOT parser = RiotReader.createParser(input, lang, base, dest) ;
        parser.getProfile().setHandler(errorHandler) ;
        try { parser.parse() ; }
        catch (RiotException ex) { errorBadRequest("Parse error: "+ex.getMessage()) ; }
        DatasetGraph dsgTmp = DatasetGraphFactory.create(graphTmp) ;
        return dsgTmp ;
    }
View Full Code Here

        return sConn ;
    }
   
    protected synchronized DatasetGraph getDatasetGraph()
    {
        DatasetGraph dsg = TDBFactory.createDatasetGraph(LOCATIONS.get(random.nextInt(NUM_DATASETS))) ;
       
        if ( dsg == null )
            throw new RuntimeException("DatasetGraph is null!") ;
       
        return dsg ;
View Full Code Here

        }
   
        @Override
        public Object call()
        {
            DatasetGraph dsg = null ;
            Lock lock = null ;
            try
            {
                dsg = tts.getDatasetGraph() ;
                lock = dsg.getLock() ;
                int id = gen.incrementAndGet() ;
                for (int i = 0; i < repeats; i++)
                {
                    try {
                        lock.enterCriticalSection(Lock.READ) ;
View Full Code Here

        }
       
        @Override
        public Object call()
        {
            DatasetGraph dsg = null ;
            Lock lock = null ;
            try {
                dsg = tts.getDatasetGraph() ;
                lock = dsg.getLock() ;
                int id = gen.incrementAndGet() ;
                for ( int i = 0 ; i < repeats ; i++ )
                {
                    try {
                        lock.enterCriticalSection(Lock.WRITE) ;
View Full Code Here

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

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

   
    @Test
    public void dataset_1()
    {
        // This must parse to <g>
        DatasetGraph dsg = parseToDataset("<x> <p> <s> <g> .") ;
        assertEquals(1,dsg.size()) ;
        assertEquals(1, dsg.getGraph(NodeFactory.createURI("g")).size()) ;
        assertEquals(0, dsg.getDefaultGraph().size()) ;
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.core.DatasetGraph

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.