Examples of Query


Examples of org.switchyard.common.version.Query

    public void testEquals() {
        VersionFactory factory = VersionFactory.instance();
        final Version expected = factory.getVersion(SWITCHYARD_COMMON);
        Version actual = factory.getVersion(Projects.create("org.switchyard", "switchyard-common"));
        assertEquals(expected, actual);
        actual = factory.getVersion(SWITCHYARD, new Query(PROJECT_ARTIFACT_ID, "switchyard-common"));
        assertEquals(expected, actual);
        actual = factory.getVersion(new Query(SPECIFICATION_TITLE, "SwitchYard: Common"));
        assertEquals(expected, actual);
    }
View Full Code Here

Examples of org.teiid.query.sql.lang.Query

     * @param command
     * @return
     */
    static boolean hasNoCriteria(Command command) {
      if(command instanceof Query) {
            Query query = (Query) command;
            return query.getCriteria() == null;
        }
        if (command instanceof Delete) {
          Delete query = (Delete) command;
            return query.getCriteria() == null;
        }
        if (command instanceof Update) {
          Update query = (Update) command;
            return query.getCriteria() == null;
        }
        if (command instanceof SetQuery) {
          SetQuery query = (SetQuery)command;
          return hasNoCriteria(query.getLeftQuery()) || hasNoCriteria(query.getRightQuery());
        }
        return false;
    }
View Full Code Here

Examples of org.terrier.querying.parser.Query

  //but I would prefer the separate method)
  /** runPreProcessing */
  public void runPreProcessing(SearchRequest srq)
  {
    Request rq = (Request)srq;
    Query query = rq.getQuery();
    //System.out.println(query);
    //get the controls
    try{
                boolean rtr = ! query.obtainControls(Allowed_Controls, rq.getControlHashtable());
    //we check that there is stil something left in the query
    if (! rtr)
    {
      rq.setEmpty(true);
      return;
    }
             
    /*if(ApplicationSetup.getProperty("querying.manager.sendlang","").equals("true"))
    {
      String lang = rq.getControl("lang").toLowerCase();
      String marker = ApplicationSetup.getProperty("termpipelines.languageselector.markerlang", "||LANG:");
      if(lang.length() > 0)
      {
        if(logger.isDebugEnabled()){
          logger.debug("Sending marker through pipeline "+marker+lang);
        }
        pipelineTerm(marker+lang);
       
      }
    }*/
    synchronized(this) {
      rtr = query.applyTermPipeline(tpa);
      tpa.resetPipeline();
    }
    Map<String,String> controls = rq.getControlHashtable();
     
    for(int i=0; i<PreProcesses_Order.length; i++)
    {
      String PreProcesses_Name = PreProcesses_Order[i];
      for(int j=0; j<PreProcesses_Controls[i].length; j++)
      {
        String ControlName = PreProcesses_Controls[i][j];
        String value = (String)controls.get(ControlName);
        //System.err.println(ControlName+ "("+ControlName+") => "+value);
        if (value == null)
          continue;
        value = value.toLowerCase();
        if(! (value.equals("off") || value.equals("false")))
        {
          if (logger.isDebugEnabled()){
            logger.debug("Processing: "+PreProcesses_Name);
          }
          getPreProcessModule(PreProcesses_Name).process(this, srq);
          //we've now run this pre process module, no need to check the rest of the controls for it.
          break;
        }
      }
    }
    String lastPP = null;
    if ((lastPP = ApplicationSetup.getProperty("querying.lastpreprocess",null)) != null)
    {
      getPreProcessModule(lastPP).process(this, srq);
    }   

    if (! rtr)
    {
      rq.setEmpty(true);
      return;
    }

    if (ApplicationSetup.getProperty("querying.no.negative.requirement", "").equals("true"))
    {
      ArrayList<org.terrier.querying.parser.Query> terms = new ArrayList<org.terrier.querying.parser.Query>();
      query.getTermsOf(org.terrier.querying.parser.SingleTermQuery.class, terms, true);
      for(Query sqt : terms)
        ((org.terrier.querying.parser.SingleTermQuery)sqt).setRequired(0);
    }

    MatchingQueryTerms queryTerms = new MatchingQueryTerms(rq.getQueryID(), rq);
   
    query.obtainQueryTerms(queryTerms);
    rq.setMatchingQueryTerms(queryTerms);
                  }
                catch(Exception e){
                }
  }
View Full Code Here

Examples of org.timedex.query.Query

  private static final String OUTPUT_FILE = "random_events.txt";
  private static final int NUM_EVENTS = 100;
  private static final SessionStrategy sessionStrategy = HibernateSessionStrategy.getInstance();
 
  public static void main(String[] args) {   
    Query q = new BasicQuery();
    List<Event> events;
    try {
      sessionStrategy.beginTransaction();
     
      events = q.getRandom(NUM_EVENTS);
     
      sessionStrategy.commitTransaction();
    } finally {
      sessionStrategy.rollbackIfActive();
    }
View Full Code Here

Examples of org.timepedia.chronoscope.gviz.api.client.Query

    }, "visualization", "1", new Command() {

      public void execute() {
        ChronoscopeOptions.setErrorReporting(false);
        Chronoscope.setFontBookRendering(true);
        Query q=GadgetHelper.create().createQueryFromPrefs();
       
        q.send(new QueryResponseHandler() {
              public void onQueryResponse(QueryResponse response) {
                try {
                  setTitle.setTitle(prefs.chartTitle().getValue());
                  DataTable table = response.getDataTable();
                  Dataset ds[] = DataTableParser.parseDatasets(table, null);
View Full Code Here

Examples of org.topbraid.spin.model.Query

    public static SelectBuilder fromResource(Resource resource)
    {
  if (resource == null) throw new IllegalArgumentException("Select Resource cannot be null");
 
  Query query = SPINFactory.asQuery(resource);
  if (query == null || !(query instanceof Select))
      throw new IllegalArgumentException("SelectBuilder Resource must be a SPIN SELECT Query");

  return fromSelect((Select)query);
    }
View Full Code Here

Examples of org.vfny.geoserver.wfs.Query

        WFS wfs = request.getWFS();
        GeoServer config = wfs.getGeoServer();
        Data catalog = wfs.getData();
        FeatureTypeInfo meta = null;
        NameSpaceInfo namespace;
        Query query;

        FeatureSource source;
        Feature feature;
        String fid;
        FilterFactory filterFactory = FilterFactoryFinder.createFilterFactory();
        FidFilter fidFilter;

        try {
            for (Iterator it = request.getQueries().iterator(); it.hasNext();) {
                query = (Query) it.next();

                // the feature type name used in the content disposition response will match
                // the first feature type
                if (featureTypeName == null) {
                    featureTypeName = query.getTypeName();
                }

                meta = catalog.getFeatureTypeInfo(query.getTypeName());
                namespace = meta.getDataStoreInfo().getNameSpace();
                source = meta.getFeatureSource();

                List attrs = meta.getAttributes();

                List propNames = query.getPropertyNames(); // REAL LIST: be careful here :)
                List attributeNames = meta.getAttributeNames();

                for (Iterator iter = propNames.iterator(); iter.hasNext();) {
                    String propName = (String) iter.next();

                    if (!attributeNames.contains(propName)) {
                        String mesg = "Requested property: " + propName + " is "
                            + "not available for " + query.getTypeName() + ".  "
                            + "The possible propertyName values are: " + attributeNames;
                        throw new WfsException(mesg);
                    }
                   
                   
                }

                List extraGeometries = new ArrayList();
                List properties = new ArrayList();
                if (propNames.size() != 0) {
                    Iterator ii = attrs.iterator();
                   

                    while (ii.hasNext()) {
                        AttributeTypeInfo ati = (AttributeTypeInfo) ii.next();

                        //String attName = (String) ii.next();
                        LOGGER.finer("checking to see if " + propNames + " contains" + ati);

                        if (((ati.getMinOccurs() > 0) && (ati.getMaxOccurs() != 0))
                                || propNames.contains(ati.getName())) {
                            properties.add(ati.getName());
                        }
                       
                        //if(wfs.isFeatureBounding() && meta.getFeatureType().getAttributeType(ati.getName()) instanceof GeometryAttributeType
                        //        && !properties.contains(ati.getName())) {
                        //    properties.add(ati.getName());
                        //    extraGeometries.add(ati.getName());
                        //}
                        if(meta.getFeatureType().getAttributeType(ati.getName()) instanceof GeometryAttributeType
                                && !properties.contains(ati.getName())) {
                            properties.add(ati.getName());
                            extraGeometries.add(ati.getName());
                        }
                    }

                    query.setPropertyNames(properties);
                }
               
                // Add range to filter
                AttributeExpression geomAttb = filterFactory.createAttributeExpression(meta.getFeatureType(), meta.getFeatureType().getDefaultGeometry().getName());
                LiteralExpression pointExpr = filterFactory.createLiteralExpression(request.getPoint());
                DWithin dWithin = filterFactory.dwithin(geomAttb, pointExpr, request.getMaxRange(), request.getUnits());
                if (query.getFilter() == null) {
                    query.addFilter((Filter)dWithin);
                   
                } else {
                    And andFilter = filterFactory.and(Arrays.asList(new Filter[] { (Filter)dWithin, query.getFilter() }));
                    query.addFilter((Filter)andFilter);
                }
               
                LOGGER.fine("Query is " + query + "\n To gt2: " + query.toDataQuery(Integer.MAX_VALUE));

                //DJB: note if maxFeatures gets to 0 the while loop above takes care of this! (this is a subtle situation)
                FeatureCollection featuresCheck = source.getFeatures(query.toDataQuery(Integer.MAX_VALUE));
               
                // find nearest feature
                Unit fromUnit = SI.METER;
                Unit toUnit = UnitFormat.getInstance().parseUnit(request.getUnits());
                Converter unitConvert = fromUnit.getConverterTo(toUnit);
View Full Code Here

Examples of org.wso2.carbon.cep.core.Query

* This class will help to build Query object from a given OMElement
*/
public class QueryHelper {

    public static Query fromOM(OMElement queryElement) {
        Query query = new Query();
        String name = queryElement.getAttribute(new QName(CEPConstants.CEP_CONF_ELE_NAME)).getAttributeValue();
        query.setName(name);
        OMElement expressionElement = queryElement.getFirstChildWithName(new QName(CEPConstants.CEP_CONF_NAMESPACE,
                CEPConstants.CEP_CONF_ELE_EXPRESSION));
        if (expressionElement != null) {
            query.setExpression(ExpressionHelper.fromOM(expressionElement));
        }

        OMElement outputOmElement = queryElement.getFirstChildWithName(new QName(CEPConstants.CEP_CONF_NAMESPACE,
                CEPConstants.CEP_CONF_ELE_OUTPUT));
        if (expressionElement != null) {
            query.setOutput(OutputHelper.fromOM(outputOmElement));
        }
        return query;
    }
View Full Code Here

Examples of org.wso2.carbon.dataservices.core.description.query.Query

     
      String resultWrapper = dataService.getResultWrapperForRequest(requestName);
      String ns = dataService.getNamespaceForRequest(requestName);
      OMElement responseElement = new OMSourcedElementImpl(new QName(ns,
          resultWrapper), OMAbstractFactory.getOMFactory(), ds);
      Query defQuery = dataService.getCallableRequest(
          requestName).getCallQueryGroup().getDefaultCallQuery().getQuery();
      /*
       * Checks if the result has to be pre-built, because in situations like having an
       * output-event-trigger, for XPath expression evaluations, the following operation
       * must be done, or it wont work.
       */
      if (defQuery.isPreBuildResult()) {
        responseElement = DBUtils.cloneAndReturnBuiltElement(responseElement);
      }
     
      /* do XSLT transformation if available */
      responseElement = this.executeXsltTranformation(responseElement, defQuery);
View Full Code Here

Examples of org.xmlBlaster.engine.mime.Query

      PluginInfo info = new PluginInfo(glob, null, "XPathFilter", "1.0");
      info.getParameters().put(XPathFilter.MATCH_AGAINST_QOS, ""+true);
      filter.init(glob, info);
     
      {
         Query query = new Query(glob, queryStr);
         boolean ret = filter.match(sessionInfo, msgUnit, query);
         System.out.println("Match: " + ret + "\nResult: " + msgUnit.getQos());
         assertTrue(queryStr + " should match", ret);
      }

      {
         queryStr = "/a";
         Query query = new Query(glob, queryStr);
         boolean ret = filter.match(sessionInfo, msgUnit, query);
         System.out.println("Match: " + ret + "\nResult: " + msgUnit.getQos());
         assertFalse(queryStr + " shouldn't match", ret);
      }
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.