Package com.hp.hpl.jena.query

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


    File base = new File(dataPathString);
    return getTcDir(new File(base, "graph"), name);
  }

  private MGraph getMGraph(File tcDir) {
    Dataset dataset = TDBFactory.createDataset(tcDir.getAbsolutePath());
    Model model = dataset.getDefaultModel();
    //Model model = TDBFactory.createModel(tcDir.getAbsolutePath());
    final com.hp.hpl.jena.graph.Graph jenaGraph = model.getGraph();
    dir2JenaGraphMap.put(tcDir, jenaGraph);
    synchronized(dir2Dataset) {
      dir2Dataset.put(tcDir, dataset);
View Full Code Here


public class JenaSparqlEngine implements QueryEngine {

  @Override
  public Object execute(TcManager tcManager, TripleCollection defaultGraph,
      final Query query) {
    final Dataset dataset = new TcDataset(tcManager, defaultGraph);

    // Missing permission (java.lang.RuntimePermission getClassLoader)
    // when calling QueryFactory.create causes ExceptionInInitializerError
    // to be thrown.
    // QueryExecutionFactory.create requires
View Full Code Here

        }
       
        // Make sure a plain, no sameValueAs graph is used.
        Object oldValue = ARQ.getContext().get(ARQ.strictGraph) ;
        ARQ.setTrue(ARQ.strictGraph) ;
        Dataset ds = DatasetFactory.create(item.getDefaultGraphURIs(), item.getNamedGraphURIs()) ;
        ARQ.getContext().set(ARQ.strictGraph, oldValue) ;
       
        // ---- First, get the expected results by executing in-memory or from a results file.
       
        ResultSet rs = null ;
View Full Code Here

//    }
   
    /** Example setup - in-memory dataset with two graphs, one triple in each */
    private static Dataset setup()
    {
        Dataset ds = TDBFactory.createDataset() ;
        DatasetGraphTDB dsg = (DatasetGraphTDB)(ds.asDatasetGraph()) ;
        Quad q1 = SSE.parseQuad("(<http://example/g1> <http://example/s> <http://example/p> <http://example/o1>)") ;
        Quad q2 = SSE.parseQuad("(<http://example/g2> <http://example/s> <http://example/p> <http://example/o2>)") ;
        dsg.add(q1) ;
        dsg.add(q2) ;
        return ds ;
View Full Code Here

       
        // 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

    }


    @Test public void update3()
    {
        Dataset ds = TDBFactory.createDataset() ;
       
        ds.asDatasetGraph().getDefaultGraph().add(t1) ;
        ds.getNamedModel(graphName).getGraph().add(t1) ;
       
        Model m = ds.getDefaultModel() ;
        m.removeAll() ;
        assertEquals(0, m.size()) ;
       
        // But still in the other graph
        assertTrue(ds.getNamedModel(graphName).getGraph().contains(t1)) ;
    }
View Full Code Here

        assertTrue(ds.getNamedModel(graphName).getGraph().contains(t1)) ;
    }

    @Test public void update4()
    {
        Dataset ds = TDBFactory.createDataset() ;
       
        ds.asDatasetGraph().getDefaultGraph().add(t1) ;
        ds.getNamedModel(graphName).getGraph().add(t1) ;
       
        Model m = ds.getNamedModel(graphName) ;
        m.removeAll() ;
        assertEquals(0, m.size()) ;
       
        // But still in the other graph
        assertTrue(ds.getDefaultModel().getGraph().contains(t1)) ;
    }
View Full Code Here

   
    @AfterClass public static void afterClass() { StoreConnection.reset() ; }

    @Test public void dataset1()
    {
        Dataset ds = graphLocation.getDataset() ;
        assertTrue( ds.getDefaultModel().getGraph() instanceof GraphTDB ) ;
        assertTrue( ds.getNamedModel("http://example/").getGraph() instanceof GraphTDB ) ;
    }
View Full Code Here

        assertTrue( ds.getNamedModel("http://example/").getGraph() instanceof GraphTDB ) ;
    }
   
    @Test public void dataset2()
    {
        Dataset ds = graphLocation.getDataset() ;
        Graph g1 = ds.getDefaultModel().getGraph() ;
        Graph g2 = ds.getNamedModel("http://example/").getGraph() ;
       
        g1.add(new Triple(n0,n1,n2) ) ;
        assertTrue(g1.contains(n0,n1,n2) ) ;
        assertFalse(g2.contains(n0,n1,n2) ) ;
    }
View Full Code Here

        assertFalse(g2.contains(n0,n1,n2) ) ;
    }

    @Test public void dataset3()
    {
        Dataset ds = graphLocation.getDataset() ;
        Graph g1 = ds.getDefaultModel().getGraph() ;
        // Sometimes, under windows, deleting the files by
        // graphLocation.clearDirectory does not work. 
        // Needed for safe tests on windows.
        g1.clear() ;
       
        Graph g2 = ds.getNamedModel("http://example/").getGraph() ;
        g2.add(new Triple(n0,n1,n2) ) ;
        assertTrue(g2.contains(n0,n1,n2) ) ;
        assertFalse(g1.contains(n0,n1,n2) ) ;
    }
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.