Package com.hp.hpl.jena.sparql

Examples of com.hp.hpl.jena.sparql.ARQException


     *            Node
     */
    protected void validateParameterValue(Node n) {
        if (n.isURI()) {
            if (n.getURI().contains(">"))
                throw new ARQException("Value for the parameter contains a SPARQL injection risk");
        }
    }
View Full Code Here


        // A ?var surrounded by " or ' where the variable is a literal is an
        // attack vector
        Pattern p = Pattern.compile("\"[?$]" + var + "\"|'[?$]" + var + "'");

        if (p.matcher(command).find() && n.isLiteral()) {
            throw new ARQException(
                    "Command string is vunerable to injection attack, variable ?"
                            + var
                            + " appears surrounded directly by quotes and is bound to a literal which provides a SPARQL injection attack vector");
        }

        // Parse out delimiter info
        DelimiterInfo delims = this.findDelimiters(command);

        // Check each occurrence of the variable for safety
        p = Pattern.compile("([?$]" + var + ")([^\\w]|$)");
        Matcher matcher = p.matcher(command);
        while (matcher.find()) {
            MatchResult posMatch = matcher.toMatchResult();

            if (n.isLiteral()) {
                if (delims.isInsideLiteral(posMatch.start(1), posMatch.end(1))) {
                    throw new ARQException(
                            "Command string is vunerable to injection attack, variable ?"
                                    + var
                                    + " appears inside of a literal and is bound to a literal which provides a SPARQL injection attack vector");
                }
            }
View Full Code Here

        DelimiterInfo delims = this.findDelimiters(command);

        // Check each occurrence of the variable for safety
        if (n.isLiteral()) {
            if (delims.isInsideLiteral(position, position)) {
                throw new ARQException(
                        "Command string is vunerable to injection attack, a positional paramter (index "
                                + index
                                + ") appears inside of a literal and is bound to a literal which provides a SPARQL injection attack vector");
            }
        }
View Full Code Here

     */
    public static Dataset assemble(Model model)
    {
        Resource r = GraphUtils.findRootByType(model, DatasetAssembler.getType()) ;
        if ( r == null )
            throw new ARQException("No root found for type <"+DatasetAssembler.getType()+">") ;
       
        return assemble(r) ;
    }
View Full Code Here

    public Op transform(OpBGP op)
    {
        // Bad - assume we work on the quad form.
        // Otherwise need to know the active graph at this point
        // toQuadForm transformation.
        throw new ARQException("Unexpected use of BGP in for a dynamic dataset") ;
        //return super.transform(op) ;
    }
View Full Code Here

    @Override
    public void execute() {
        // Validation
        if (this.getEndpoint() == null)
            throw new ARQException("Null endpoint for remote update by form");
        if (this.getUpdateRequest() == null)
            throw new ARQException("Null update request for remote update");

        // Execution
        String reqStr = this.getUpdateRequest().toString();
        Params ps = new Params(this.getParams());
        ps.addParam(HttpParams.pUpdate, reqStr);
View Full Code Here

    @Override
    public void execute()
    {
        // Validation
        if ( this.getEndpoint() == null )
            throw new ARQException("Null endpoint for remote update") ;
        if ( this.getUpdateRequest() == null )
            throw new ARQException("Null update request for remote update") ;
       
        // Build endpoint URL
        String endpoint = this.getEndpoint();
        String querystring = this.getQueryString();
        if (querystring != null && !querystring.equals("")) {
View Full Code Here

            else
                out.write(noBytes) ;
            out.write(NLBytes) ;
        } catch (IOException ex)
        {
            throw new ARQException(ex) ;
        }
    }
View Full Code Here

        try
        {
            return pool.takeFirst() ;
        } catch (InterruptedException ex)
        {
            throw new ARQException("Failed to get an item from the pool (InterruptedException): "+ex.getMessage()) ;
        }
    }
View Full Code Here

        try
        {
            //Here we try to parse only the Header Row
            str = reader.readLine();
            if (str == null )
                throw new ARQException("CSV Results malformed, input is empty (no header row)") ;
           
            if ( ! str.isEmpty() )
            {
                String[] tokens = str.split(",") ;
                for ( String token : tokens )
                {
                    Var var = Var.alloc(token);
                    vars.add(var);
                    varNames.add(var.getName());
                }
            }
        }
        catch ( IOException ex )
        {
            throw new ARQException(ex) ;
        }

        //Generate an instance of ResultSetStream using TSVInputIterator
        //This will parse actual result rows as needed thus minimising memory usage
        return new ResultSetStream(varNames, null, new CSVInputIterator(reader, vars));
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.ARQException

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.