Package com.hp.hpl.jena.sparql.util

Examples of com.hp.hpl.jena.sparql.util.Context


     * @param Query the Query to execute.
     * @return An HttpQuery configured as per the context.
     */
    private static HttpQuery configureQuery(String uri, Context parentContext, Query query) {
      HttpQuery httpQuery = new HttpQuery(uri);
      Context context = new Context(parentContext);

      // add the context settings from the service context
      @SuppressWarnings("unchecked")
      Map<String, Context> serviceContextMap = (Map<String, Context>) context.get(serviceContext);
      if (serviceContextMap != null)
      {
        Context serviceContext = serviceContextMap.get(uri);
        if (serviceContext != null) context.putAll(serviceContext);
      }

      // configure the query object.
      httpQuery.merge(QueryEngineHTTP.getServiceParams(uri, context));
View Full Code Here


        try {
            String sqlStr = store.getSQLGenerator().generateSQL(request, b.getSqlNode()) ;
            //System.out.println(sqlStr) ;
            ResultSetJDBC tableData = store.getConnection().execQuery(sqlStr) ;
            ExecutionContext execCxt = new ExecutionContext(new Context(), null, null, null) ;
            return b.assembleResults(tableData, BindingRoot.create(), execCxt) ;
        } catch (SQLException ex)
        { throw new SDBExceptionSQL(ex) ; }
    }
View Full Code Here

        this.prefixMapping = null ;
        if ( query != null )
            prefixMapping = query.getPrefixMapping() ;
        if ( context == null )
            context = SDB.getContext() ;
        this.context = new Context(context) ;
    }
View Full Code Here

     */
    private static void applyServiceConfig(String serviceURI, UpdateProcessRemoteBase engine) {
        @SuppressWarnings("unchecked")
        Map<String, Context> serviceContextMap = (Map<String, Context>) engine.context.get(Service.serviceContext);
        if (serviceContextMap != null && serviceContextMap.containsKey(serviceURI)) {
            Context serviceContext = serviceContextMap.get(serviceURI);
            if (log.isDebugEnabled())
                log.debug("Endpoint URI {} has SERVICE Context: {} ", serviceURI, serviceContext);

            // Apply authentication settings
            String user = serviceContext.getAsString(Service.queryAuthUser);
            String pwd = serviceContext.getAsString(Service.queryAuthPwd);

            if (user != null || pwd != null) {
                user = user == null ? "" : user;
                pwd = pwd == null ? "" : pwd;
                if (log.isDebugEnabled())
View Full Code Here

        printRequest(id, request) ;
       
        HttpServletResponseTracker responseTracked = new HttpServletResponseTracker(response) ;
        response = responseTracked ;
        initResponse(request, response) ;
        Context cxt = ARQ.getContext() ;

        try {
            validate(request) ;
            doCommonWorker(id, request, response) ;
        } catch (QueryCancelledException ex) {
            // Also need the per query info ...
            String message = String.format("The query timed out (restricted to %s ms)", cxt.get(ARQ.queryTimeout));
            // Possibility :: response.setHeader("Retry-after", "600") ;    // 5 minutes
            responseSendError(response, HttpSC.SERVICE_UNAVAILABLE_503, message);
        } catch (ActionErrorException ex) {
            if ( ex.exception != null )
                ex.exception.printStackTrace(System.err) ;
View Full Code Here

     */
    private static void applyServiceConfig(String serviceURI, UpdateProcessRemoteBase engine) {
        @SuppressWarnings("unchecked")
        Map<String, Context> serviceContextMap = (Map<String, Context>) engine.context.get(Service.serviceContext);
        if (serviceContextMap != null && serviceContextMap.containsKey(serviceURI)) {
            Context serviceContext = serviceContextMap.get(serviceURI);
            if (log.isDebugEnabled())
                log.debug("Endpoint URI {} has SERVICE Context: {} ", serviceURI, serviceContext);

            // Apply authentication settings
            String user = serviceContext.getAsString(Service.queryAuthUser);
            String pwd = serviceContext.getAsString(Service.queryAuthPwd);

            if (user != null || pwd != null) {
                user = user == null ? "" : user;
                pwd = pwd == null ? "" : pwd;
                if (log.isDebugEnabled())
View Full Code Here

     * @param Query the Query to execute.
     * @return An HttpQuery configured as per the context.
     */
    private static HttpQuery configureQuery(String uri, Context parentContext, Query query) {
      HttpQuery httpQuery = new HttpQuery(uri);
      Context context = new Context(parentContext);

      // add the context settings from the service context
      @SuppressWarnings("unchecked")
      Map<String, Context> serviceContextMap = (Map<String, Context>) context.get(serviceContext);
      if (serviceContextMap != null)
      {
        Context serviceContext = serviceContextMap.get(uri);
        if (serviceContext != null) context.putAll(serviceContext);
      }

      // configure the query object.
      httpQuery.merge(QueryEngineHTTP.getServiceParams(uri, context));
View Full Code Here

    {
        this.query = query ;
        this.queryString = queryString ;
        this.service = serviceURI ;
        // Copy the global context to freeze it.
        this.context = new Context(ARQ.getContext()) ;
       
        // Apply service configuration if relevant
        QueryEngineHTTP.applyServiceConfig(serviceURI, this);
    }
View Full Code Here

        if (engine.context == null) return;
       
        @SuppressWarnings("unchecked")
        Map<String, Context> serviceContextMap = (Map<String, Context>) engine.context.get(Service.serviceContext);
        if (serviceContextMap != null && serviceContextMap.containsKey(serviceURI)) {
            Context serviceContext = serviceContextMap.get(serviceURI);
            if (log.isDebugEnabled())
                log.debug("Endpoint URI {} has SERVICE Context: {} ", serviceURI, serviceContext);
           
            // Apply behavioral options
            engine.setAllowGZip(serviceContext.isTrueOrUndef(Service.queryGzip));
            engine.setAllowDeflate(serviceContext.isTrueOrUndef(Service.queryDeflate));
            applyServiceTimeouts(engine, serviceContext);

            // Apply authentication settings
            String user = serviceContext.getAsString(Service.queryAuthUser);
            String pwd = serviceContext.getAsString(Service.queryAuthPwd);

            if (user != null || pwd != null) {
                user = user == null ? "" : user;
                pwd = pwd == null ? "" : pwd;
                if (log.isDebugEnabled())
View Full Code Here

    // Force a call
    static { init() ; }
   
    private static Context defaultSettings()   
    {
        Context context = new Context() ;
        setNormalMode(context) ;
        return context ;
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.util.Context

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.