Package com.hp.hpl.jena.sparql.engine.http

Examples of com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP


        Assert.assertTrue(qe.execAsk());
    }

    @Test
    public void query_with_auth_09() throws URISyntaxException {
        QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(serviceQuery, "ASK { }");

        // Auth credentials for valid user with correct password using
        // pre-emptive auth
        ScopedAuthenticator authenticator = new ScopedAuthenticator(new URI(serviceQuery), "allowed", "password".toCharArray());
        qe.setAuthenticator(new PreemptiveBasicAuthenticator(authenticator));
        Assert.assertTrue(qe.execAsk());
    }
View Full Code Here


    @Test
    public void query_with_auth_10() {
        Context ctx = ARQ.getContext();
        try {
            QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(serviceQuery, "ASK { }");

            // Auth credentials for valid user with correct password and scoped
            // to correct URI
            // Provided via Service Context and its associated authenticator
            Map<String, Context> serviceContext = new HashMap<String, Context>();
            Context authContext = new Context();
            authContext.put(Service.queryAuthUser, "allowed");
            authContext.put(Service.queryAuthPwd, "password");
            serviceContext.put(serviceQuery, authContext);
            ctx.put(Service.serviceContext, serviceContext);

            qe.setAuthenticator(new ServiceAuthenticator());
            Assert.assertTrue(qe.execAsk());
        } finally {
            ctx.remove(Service.serviceContext);
        }
    }
View Full Code Here

    {
        checkNotNull(service, "URL for service is null") ;
        //checkNotNull(defaultGraphURIs, "List of default graph URIs is null") ;
        //checkNotNull(namedGraphURIs, "List of named graph URIs is null") ;
        checkArg(query) ;
        QueryEngineHTTP qe = createServiceRequest(service, query) ;
        if ( defaultGraphURIs != null )
            qe.setDefaultGraphURIs(defaultGraphURIs) ;
        if ( namedGraphURIs != null )
            qe.setNamedGraphURIs(namedGraphURIs) ;
        return qe ;
    }
View Full Code Here

    static public QueryExecution sparqlService(String service, Query query, String defaultGraph)
    {
        checkNotNull(service, "URL for service is null") ;
        //checkNotNull(defaultGraph, "IRI for default graph is null") ;
        checkArg(query) ;
        QueryEngineHTTP qe = createServiceRequest(service, query) ;
        qe.addDefaultGraph(defaultGraph) ;
        return qe ;
    }
View Full Code Here

     * {@link QueryEngineHTTP},
     * allows various HTTP specific paramters to be set.
     */
    static public QueryEngineHTTP createServiceRequest(String service, Query query)
    {
        QueryEngineHTTP qe = new QueryEngineHTTP(service, query) ;
        return qe ;
    }
View Full Code Here

    static public QueryExecution sparqlService(String service, Query query, String defaultGraph)
    {
        checkNotNull(service, "URL for service is null") ;
        //checkNotNull(defaultGraph, "IRI for default graph is null") ;
        checkArg(query) ;
        QueryEngineHTTP qe = makeServiceRequest(service, query) ;
        qe.addDefaultGraph(defaultGraph) ;
        return qe ;
    }
View Full Code Here

        checkNotNull(service, "URL for service is null") ;
        //checkNotNull(defaultGraphURIs, "List of default graph URIs is null") ;
        //checkNotNull(namedGraphURIs, "List of named graph URIs is null") ;
        checkArg(query) ;

        QueryEngineHTTP qe = makeServiceRequest(service, query) ;

        if ( defaultGraphURIs != null )
            qe.setDefaultGraphURIs(defaultGraphURIs) ;
        if ( namedGraphURIs != null )
            qe.setNamedGraphURIs(namedGraphURIs) ;
        return qe ;
    }
View Full Code Here

      return null ;
    }

    static private QueryEngineHTTP makeServiceRequest(String service, Query query)
    {
        return new QueryEngineHTTP(service, query) ;
    }
View Full Code Here

    static public QueryExecution sparqlService(String service, Query query, String defaultGraph)
    {
        checkNotNull(service, "URL for service is null") ;
        //checkNotNull(defaultGraph, "IRI for default graph is null") ;
        checkArg(query) ;
        QueryEngineHTTP qe = makeServiceRequest(service, query) ;
        qe.addDefaultGraph(defaultGraph) ;
        return qe ;
    }
View Full Code Here

        checkNotNull(service, "URL for service is null") ;
        //checkNotNull(defaultGraphURIs, "List of default graph URIs is null") ;
        //checkNotNull(namedGraphURIs, "List of named graph URIs is null") ;
        checkArg(query) ;

        QueryEngineHTTP qe = makeServiceRequest(service, query) ;

        if ( defaultGraphURIs != null )
            qe.setDefaultGraphURIs(defaultGraphURIs) ;
        if ( namedGraphURIs != null )
            qe.setNamedGraphURIs(namedGraphURIs) ;
        return qe ;
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP

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.