Package com.hp.hpl.jena.update

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


       
        // ---- Reset.
        UpdateAction.parseExecute("DROP ALL", graphStore) ;
       
        // ---- Read the update script, then execute, in separate two steps
        UpdateRequest request = UpdateFactory.read("update.ru") ;
        UpdateAction.execute(request, graphStore) ;

        // Write in debug format.
        System.out.println("# Debug format");
        SSE.write(graphStore) ;
View Full Code Here


{
    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")) ;
        request.add(new UpdateLoad("file:etc/update-data.ttl", "http://example/g2")) ;
        UpdateAction.execute(request, graphStore) ;
       
        System.out.println("# Debug format");
        SSE.write(graphStore) ;
       
View Full Code Here

   
    public static void ex3(GraphStore graphStore)
    {
        // Build up the request then execute it.
        // This is the preferred way for complex sequences of operations.
        UpdateRequest request = UpdateFactory.create() ;
        request.add("DROP ALL")
               .add("CREATE GRAPH <http://example/g2>") ;
        // Different style.
        // Equivalent to request.add("...")
        UpdateFactory.parse(request, "LOAD <file:etc/update-data.ttl> INTO <http://example/g2>") ;
       
View Full Code Here

    @Test public void testUpdateInitialBinding4()
    {
        GraphStore gStore = getEmptyGraphStore() ;
        defaultGraphData(gStore, graph1) ;
        String update = "DELETE WHERE { ?x <http://example/p> 2007 } ; INSERT { ?x <http://example/p> 1999 } WHERE {}" ;
        UpdateRequest req = UpdateFactory.create(update) ;
       
        Binding b = BindingFactory.binding(Var.alloc("x"), s) ;
        UpdateAction.execute(req, gStore, b) ;
        assertEquals(1, gStore.getDefaultGraph().size()) ;
        assertTrue(gStore.getDefaultGraph().contains(s, p, NodeFactory.parseNode("1999"))) ;
View Full Code Here

    {
        InputStream input = null ;
        try { input = action.request.getInputStream() ; }
        catch (IOException ex) { errorOccurred(ex) ; }

        UpdateRequest req ;
        try {
           
            if ( super.verbose_debug || action.verbose )
            {
                // Verbose mode only .... capture request for logging (does not scale).
View Full Code Here

            requestStr = action.request.getParameter(paramRequest) ;
       
        if ( super.verbose_debug || action.verbose )
            requestLog.info(format("[%d] Form update = %s", action.id, formatForLog(requestStr))) ;
       
        UpdateRequest req ;
        try {
            req = UpdateFactory.create(requestStr, updateParseBase) ;
        }
        catch (UpdateException ex) { errorBadRequest(ex.getMessage()) ; req = null ; }
        catch (QueryParseException ex) { errorBadRequest(messageForQPE(ex)) ; req = null ; }
View Full Code Here

                } ;
                output(outStream, c, lineNumbers) ;
            }
           
            // Attempt to parse it.
            UpdateRequest request= null ;
            try {
                request = UpdateFactory.create(updateString, "http://example/base/", language) ;
            } catch (ARQException ex)
            {
                // Over generous exception (should be QueryException)
                // but this makes the code robust.
                outStream.println("<p>Syntax error:</p>") ;
                startFixed(outStream) ;
                outStream.println(ex.getMessage()) ;
                finishFixed(outStream) ;
            }
            catch (RuntimeException ex)
            {
                outStream.println("<p>Internal error:</p>") ;
                startFixed(outStream) ;
                outStream.println(ex.getMessage()) ;
                finishFixed(outStream) ;
            }
           
            // Because we pass into anon inner classes
            final UpdateRequest updateRequest = request ;
           
            // OK?  Pretty print
            if ( updateRequest != null && outputSPARQL )
            {
                outStream.println("<p>Formatted, parsed update request:</p>") ;
                Content c = new Content(){
                    @Override
                    public void print(IndentedWriter out)
                    {
                        updateRequest.output(out) ;
                    }
                       
                } ;
                output(outStream, c, lineNumbers) ;
            }
View Full Code Here

                + "WHERE {\n"
                + "{ ?subject skos:prefLabel ?text } UNION\n"
                + "{ ?subject skos:altLabel ?text } UNION\n"
                + "{ ?subject skos:hiddenLabel ?text }\n"
                + "}";
        UpdateRequest request = UpdateFactory.create(sparqlQuery);
        UpdateAction.execute(request, graphStore);
    }
View Full Code Here

        }
    }
   
    public static void execUpdate(String sparqlUpdateString, GraphStore graphStore)
    {
        UpdateRequest request = UpdateFactory.create(sparqlUpdateString) ;
        UpdateProcessor proc = UpdateExecutionFactory.create(request, graphStore) ;
        proc.execute() ;
    }
View Full Code Here

    }


    private void execOneFile(String filename, GraphStore store)
    {
        UpdateRequest req = UpdateFactory.read(filename, updateSyntax) ;
        UpdateExecutionFactory.create(req, store).execute() ;
    }
View Full Code Here

TOP

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

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.