Package com.hp.hpl.jena.update

Examples of com.hp.hpl.jena.update.GraphStore


        assertTrue(graphContains(gStore.getGraph(graphIRI), triple1)) ;
    }

    @Test public void testInsert4()
    {
        GraphStore gStore = getEmptyGraphStore() ;
        defaultGraphData(gStore, graph1) ;
        UpdateModify insert = new UpdateModify() ;
        insert.getInsertAcc().addTriple(SSE.parseTriple("(?s <http://example/p> 1066)")) ;
        Element element = QueryFactory.createElement("{ ?s <http://example/p> 2007 }" ) ;
        insert.setElement(element) ;
        UpdateAction.execute(insert, gStore) ;
        assertTrue(graphContains(gStore.getDefaultGraph(), triple2)) ;
    }
View Full Code Here


        assertTrue(graphContains(gStore.getDefaultGraph(), triple2)) ;
    }
   
    @Test public void testDelete1()
    {
        GraphStore gStore = getEmptyGraphStore() ;
        QuadAcc acc = new QuadAcc() ;
        UpdateDeleteWhere delete = new UpdateDeleteWhere(acc) ;
        UpdateAction.execute(delete, gStore) ;
        assertTrue(graphEmpty(gStore.getDefaultGraph())) ;
    }
View Full Code Here

        assertTrue(graphEmpty(gStore.getDefaultGraph())) ;
    }
   
    @Test public void testDelete2()
    {
        GraphStore gStore = getEmptyGraphStore() ;
        defaultGraphData(gStore, graph1) ;
        QuadAcc acc = new QuadAcc() ;
        UpdateDeleteWhere delete = new UpdateDeleteWhere(acc) ;
        acc.addTriple(SSE.parseTriple("(?s ?p ?o)")) ;
        UpdateAction.execute(delete, gStore) ;
        assertTrue("Not empty", graphEmpty(gStore.getDefaultGraph())) ;
    }
View Full Code Here

public class UpdateReadFromFile
{
    public static void main(String []args)
    {
        // Create an empty GraphStore (has an empty default graph and no named graphs)
        GraphStore graphStore = GraphStoreFactory.create() ;
       
        // ---- Read and update script in one step.
        UpdateAction.readExecute("update.ru", graphStore) ;
       
        // ---- Reset.
View Full Code Here

public class UpdateProgrammatic
{
    public static void main(String []args)
    {
        GraphStore graphStore = GraphStoreFactory.create() ;
       
        UpdateRequest request = UpdateFactory.create() ;
       
        request.add(new UpdateDrop(Target.ALL)) ;
        request.add(new UpdateCreate("http://example/g2")) ;
View Full Code Here

public class UpdateExecuteOperations
{
    public static void main(String []args)
    {
        // Create an empty GraphStore (has an empty default graph and no named graphs)
        GraphStore graphStore = GraphStoreFactory.create() ;
        ex1(graphStore) ;
        ex2(graphStore) ;
        ex3(graphStore) ;
    }
View Full Code Here

        //   existing writer finishes.
       
        dataset.begin(ReadWrite.WRITE) ;
        try
        {
            GraphStore graphStore = GraphStoreFactory.create(dataset) ;
            // Do a SPARQL Update.
            String sparqlUpdateString = StrUtils.strjoinNL(
                 "PREFIX . <http://example/>",
                 "INSERT { :s :p ?now } WHERE { BIND(now() AS ?now) }"
                 ) ;
View Full Code Here

        {
            // SPARQL/Update
            Store store = SDBTestUtils.createInMemoryStore() ;
           
            GraphStore gs = SDBFactory.connectGraphStore(store) ;
            UpdateAction.readExecute("update.ru", gs) ;
           
            Iter<Node> iter = Iter.iter(gs.listGraphNodes()) ;
            System.out.println(">>>");
            for ( Node n : iter)
                System.out.println(n);
            System.out.println("<<<");
           
            // Does not see new graph.
            SSE.write(gs.toDataset()) ;
//           
//           
//            SSE.write(gs.getDefaultGraph()) ;
//            IndentedWriter.stdout.println();
            System.out.println("-- Get named graph");
            SSE.write(gs.getGraph(Node.createURI("http://example/foo"))) ;
            IndentedWriter.stdout.println() ;
//           
            System.out.println("----");
            Dataset ds = SDBFactory.connectDataset(store) ;
            SSE.write(ds) ;
View Full Code Here

   
   
    @Override
    protected final void exec()
    {
        GraphStore graphStore = modGraphStore.getGraphStore() ;
        if ( graphStore.getDefaultGraph() == null )
            graphStore.setDefaultGraph(ModelFactory.createDefaultModel().getGraph());
        // Migrate trasnaction flag to DatsetGraph ... sometime
       
        execUpdate(graphStore) ;
    }
View Full Code Here

    public Object open(Assembler a, Resource root, Mode mode)
    {
        // Same vocabulary as datasets.
        // Have dispatched on type by now so can just call the dataset code to build a Dataset.
       
        GraphStore gs = null ;
        Object ds = super.open(a, root, mode) ;
        if ( ds instanceof Dataset )
            gs = GraphStoreFactory.create((Dataset)ds) ;
        else
            throw new DatasetAssemblerException(root, "Not a graph store") ;
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.update.GraphStore

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.