Package com.hp.hpl.jena.update

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


        // This injection is prevented by forbidding the > character in URIs
        String str = "PREFIX : <http://example/>\nINSERT DATA { <s> <p> ? . }";
        ParameterizedSparqlString pss = new ParameterizedSparqlString(str);
        pss.setIri(0, "hello> } ; DROP ALL ; INSERT DATA { <s> <p> <goodbye");

        UpdateRequest updates = pss.asUpdate();
        Assert.fail("Attempt to do SPARQL injection should result in an exception");
    }
View Full Code Here


        // injection
        String str = "PREFIX : <http://example/>\nINSERT DATA { <s> <p> ? . }";
        ParameterizedSparqlString pss = new ParameterizedSparqlString(str);
        pss.setLiteral(0, "hello\" } ; DROP ALL ; INSERT DATA { <s> <p> <goodbye>");

        UpdateRequest updates = pss.asUpdate();
        Assert.assertEquals(1, updates.getOperations().size());
    }
View Full Code Here

        // ends up being a valid string literal within quotes
        String str = "PREFIX : <http://example/>\nINSERT DATA { <s> <p> ? }";
        ParameterizedSparqlString pss = new ParameterizedSparqlString(str);
        pss.setLiteral(0, "\" . } ; DROP ALL ; INSERT DATA { <s> <p> <o> }#");

        UpdateRequest updates = pss.asUpdate();
        Assert.assertEquals(1, updates.getOperations().size());
    }
View Full Code Here

        Iterator<Integer> params = pss.getEligiblePositionalParameters();
        Assert.assertTrue(params.hasNext());
        params.next();
        Assert.assertFalse(params.hasNext());

        UpdateRequest u = pss.asUpdate();
        Assert.assertEquals(1, u.getOperations().size());
    }
View Full Code Here

        // prevent this
        String str = "PREFIX : <http://example/>\nINSERT DATA { <s> <p> \" ? \" }";
        ParameterizedSparqlString pss = new ParameterizedSparqlString(str);
        pss.setLiteral(0, " . } ; DROP ALL ; INSERT DATA { <s> <p> ");

        UpdateRequest updates = pss.asUpdate();
        Assert.fail("Attempt to do SPARQL injection should result in an exception");
    }
View Full Code Here

        // prevent this
        String str = "PREFIX : <http://example/>\nINSERT DATA { <s> <p> \"some text ? other text\" }";
        ParameterizedSparqlString pss = new ParameterizedSparqlString(str);
        pss.setLiteral(0, " . } ; DROP ALL ; INSERT DATA { <s> <p> ");

        UpdateRequest updates = pss.asUpdate();
        Assert.fail("Attempt to do SPARQL injection should result in an exception");
    }
View Full Code Here

        // literal resulting in an injection, we now escape ' so prevent this
        String str = "PREFIX : <http://example/>\nINSERT DATA { <s> <p> ' ? ' }";
        ParameterizedSparqlString pss = new ParameterizedSparqlString(str);
        pss.setLiteral(0, "' . } ; DROP ALL ; INSERT DATA { <s> <p> <o> }#");

        UpdateRequest updates = pss.asUpdate();
        Assert.assertEquals(1, updates.getOperations().size());
    }
View Full Code Here

        // literal resulting in an injection, we now escape ' so prevent this
        String str = "PREFIX : <http://example/>\nINSERT DATA { <s> <p> 'some text ? other text' }";
        ParameterizedSparqlString pss = new ParameterizedSparqlString(str);
        pss.setLiteral(0, "' . } ; DROP ALL ; INSERT DATA { <s> <p> <o> }#");

        UpdateRequest updates = pss.asUpdate();
        Assert.assertEquals(1, updates.getOperations().size());
    }
View Full Code Here

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

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.