Examples of Query


Examples of protocol.Query

    String queryString = request.getParameter("queryString");
    //System.out.println(">> DEBUG: Got query from user: " + queryName + " => " + queryString);
   
   
    if (queryName != null && queryString != null && queryName.length() > 0 && queryString.length() > 0) {
      Query query = QueryFactory.factory(queryName, queryString);
     
      if (query != null) {
        queryResponse = query.execute(request, databaseSession);
      } else {
        queryResponse = new Response(ResponseStatus.FAIL, "Unknown query requested");
      }

    } else {
View Full Code Here

Examples of ptolemy.gui.Query

            while (arguments.hasNext()) {
                Argument argument = (Argument) arguments.next();
                argumentNames[index++] = argument.getName();
            }

            Query query = new Query();
            query.addChoice("delete", "Argument to delete", argumentNames,
                    null, false);

            ComponentDialog dialog = new ComponentDialog(_owner,
                    "Delete a argument for " + _target.getFullName(), query,
                    null);

            // If the OK button was pressed, then queue a mutation
            // to delete the argument.
            if (dialog.buttonPressed().equals("OK")) {
                String argumentName = query.getStringValue("delete");

                if (argumentName != null) {
                    Argument argument = _target.getArgument(argumentName);

                    if (argument != null) {
View Full Code Here

Examples of queries.Query

    int queryId = is.readInt();
    Object results = is.readObject();

    QueryManager queryManager = getQueryManager();

    Query query = queryManager.getQuery(queryId);
    if (query == null)
    {
      return;
    }

    ClientConnection client = getConnectionManager().getClientById(
        query.getQuerierId());
    if (client == null)
    {
      return;
    }

    client.sendSearchResults(query.getQuerierCookie(), results);
  }
View Full Code Here

Examples of quickdb.query.Query

    private Date dateView;

    @Override
    public Object query(){
        ObjectViewTest1 o1 = new ObjectViewTest1();
        Query query = Query.create(this.getAdminBase(), o1);
        query.If("account", ObjectViewTest1.class).equal("accountTest");
        return query;
    }
View Full Code Here

Examples of railo.runtime.type.Query

  public static Query getMemoryUsageAsQuery(int type) throws DatabaseException {
   
   
    java.util.List<MemoryPoolMXBean> manager = ManagementFactory.getMemoryPoolMXBeans();
    Iterator<MemoryPoolMXBean> it = manager.iterator();
    Query qry=new QueryImpl(new Collection.Key[]{
        KeyConstants._name,
        KeyConstants._type,
        KeyConstants._used,
        KeyConstants._max,
        KeyConstants._init
    },0,"memory");
   
    int row=0;
    MemoryPoolMXBean bean;
    MemoryUsage usage;
    MemoryType _type;
    while(it.hasNext()){
      bean = it.next();
      usage = bean.getUsage();
      _type = bean.getType();
      if(type==MEMORY_TYPE_HEAP && _type!=MemoryType.HEAP)continue;
      if(type==MEMORY_TYPE_NON_HEAP && _type!=MemoryType.NON_HEAP)continue;
       
      row++;
      qry.addRow();
      qry.setAtEL(KeyConstants._name, row, bean.getName());
      qry.setAtEL(KeyConstants._type, row, _type.name());
      qry.setAtEL(KeyConstants._max, row, Caster.toDouble(usage.getMax()));
      qry.setAtEL(KeyConstants._used, row, Caster.toDouble(usage.getUsed()));
      qry.setAtEL(KeyConstants._init, row, Caster.toDouble(usage.getInit()));
     
    }
    return qry;
  }
View Full Code Here

Examples of rex.metadata.Query

                }
                //======
      
       // Query Holds ExecuteResult (for Axis).
       rex.metadata.Query q=new rex.metadata.Query(getCubeName(),null);
        q.setQuery(new ExecuteResult(smd.execute(removeComments(noNonEmptyQuery),execProperties),new Query(getCubeName(),null)));      
      
       // Getting Model and root of MDX Builder Tree.
       JTree bTree=builderTree.getTree();      
       DefaultTreeModel treeModel=(DefaultTreeModel) bTree.getModel();      
       DefaultMutableTreeNode root=(DefaultMutableTreeNode)treeModel.getRoot();
View Full Code Here

Examples of twitter4j.Query

   * (non-Javadoc)
   * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
   */
  public void start(BundleContext context) throws Exception {
    Twitter twitter = new Twitter();
    Query query = new Query("from:theasf");
   
    try {
      QueryResult result = twitter.search(query);
        List<Tweet> tweets = result.getTweets();
        System.out.println("hits:" + tweets.size());
View Full Code Here

Examples of uk.ac.ebi.ricordo.rdfstore.bean.Query

        assertEquals(3, resourceList.getCount());
    }

    @Test
    public void testPostQueryGetResourcesByType() {
        Query query = new Query();
        query.setQuery("http://www.ebi.ac.uk/ricordo/toolbox/sbmlo#SBMLModel");
        HttpEntity<Query> entity = new HttpEntity<Query>(query);

        ResponseEntity response = restTemplate.exchange( URL_STRING+"search/getResourcesByType", HttpMethod.POST, entity, String.class);

        assertEquals("{\"resources\":{\"count\":3,\"resources\":[{\"value\":[\"http://www.ebi.ac.uk/ricordo/toolbox/sbmlo#BIOMD0000000001\"]},{\"value\":[\"http://www.ebi.ac.uk/ricordo/toolbox/sbmlo#BIOMD0000000003\"]},{\"value\":[\"http://www.ebi.ac.uk/ricordo/toolbox/sbmlo#BIOMD0000000002\"]}],\"select\":[\"?s\"]}}"
View Full Code Here

Examples of uk.ac.ucl.panda.retrieval.query.Query

    if (v.size() == 0)
      return null;


        Query query = new Query(term);

        return query;
    }
View Full Code Here

Examples of unbbayes.prs.mebn.ssbn.Query

        } else {
          // it is supposed to fill KB before each query
        }
       
        // add to query
        Query query = PrognosController.this.setupQuery(shipNear);
        queryList.add(query);
        shipEntitiesInQuery.put(query,shipNear);
      }
     
//      System.out.println("[" + new Date() + "] took " + (System.currentTimeMillis() - time) + " ms to prepare for query on ship " + myShip.getShipName());
      long timeForPreparation = (System.currentTimeMillis() - time);
     
     
//      System.out.println("[" + new Date() + "] heap usage after preparation of query of " + myShip.getShipName() + " is " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));

      // store reasoning mode, for log purpose
      String reasoningModeLabel = isToUseMultipleQuery?(isContinuousCase()?"CONTINUOUS":"DISCRETE"):(isContinuousCase()?"CONTINUOUS_SEQUENTIAL":"DISCRETE_SEQUENTIAL")
     
      long timeForQuery = 0// will store time needed to perform query
     
      // mapping between ship's ID and how many iteration the reasoner used in order to get results
      Map<Integer, Integer> iterationQuantityMap = new HashMap<Integer, Integer>();
      // mapping between ship's ID and how long it took to query that ship. This is only useful if we are doing sequential query
      // (i.e. query each ship one by one instead of querying them altogether)
      Map<Integer, Long> executionTimeMap = new HashMap<Integer, Long>();
     
      if (!queryList.isEmpty()) {
        // timestamp to calculate time of query
        long milliseconds = System.currentTimeMillis();
       
        ProbabilisticNetwork returnedNet = null// points to the returned SSBN
        if (isToUseMultipleQuery) {
          PrognosController.this.runQuery(queryList)// this.net will contain the result
          returnedNet = net;  // net already contains all nodes
        } else {
          // append nodes of the SSBN to returnedNet
          returnedNet = new ProbabilisticNetwork("SequentialQueryResult");
          for (Query query : queryList) {
            long timestampBeforeSeqQuery = System.currentTimeMillis()// I want to include the KB overhead in the query time of seq query
           
            ShipEntity queriedShipEntity = shipEntitiesInQuery.get(query)// ship to query
           
            // kb must reflect only the current ship
            PrognosController.this.populateRelevantKB(queriedShipEntity, true);
            // query each target one-by-one
            PrognosController.this.runQuery(Collections.singletonList(query));
           
            long timeFor1QueryInSeqQuery = System.currentTimeMillis() - timestampBeforeSeqQuery;
           
            try {
              // its the same time and iteration for all of them (because we did only 1 query to get all the results)
              iterationQuantityMap.put(queriedShipEntity.getID(), textModeRunner.getSSBNgenerator().getLastIterationCount());
              executionTimeMap.put(queriedShipEntity.getID(), timeFor1QueryInSeqQuery);
            } catch (Exception e) {
              e.printStackTrace();
            }
            for (Node node : net.getNodes()) {
              // only add if it is not redundant
              if (returnedNet.getNodeIndex(node.getName()) < 0) {
                // supposedly, we only need the marginals, so we don't have to copy the structure of the net or its details
                returnedNet.addNode(node);
              }
            }
          }
        }
       
//        System.out.println(">> It took " + ((System.currentTimeMillis() - milliseconds)/1000.0) + " seconds to run query " + queryList + ". Area is " + World.This().getDetectingMile()
//                + " nautic miles. The size of the network is " + net.getNodeCount() + ". Reasoning mode was " + (isContinuousCase()?"CONTINUOUS.":"DISCRETE."));
//            System.out.println("[" + new Date() + "] current heap usage is " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
           
        // total time the query took
        timeForQuery = (System.currentTimeMillis() - milliseconds);
           
        if (isToUseMultipleQuery) {
          // fill the iteration quantity and execution time per ship for the multiple query case
          for (ShipEntity ship : shipEntitiesInQuery.values()) {
            try {
              // its the same time and iteration for all of them (because we did only 1 query to get all the results)
              iterationQuantityMap.put(ship.getID(), textModeRunner.getSSBNgenerator().getLastIterationCount());
              executionTimeMap.put(ship.getID(), timeForQuery)// value is not required in mult. query, but we need to fill something, so that the column of CSV is constant
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        }
       
            // this.net contains the SSBN
            for (Node node : returnedNet.getNodes()) {
              // only consider printing log for SSBN nodes generated from isShipOfInterest (such nodes supposedly have names starting with "isShipOfInterest")
              if (node.getName().toUpperCase().startsWith("ISSHIPOFINTEREST")) {
                try {
                  ShipEntity ship = DataBase.getInstance().getShipByName(node.getName().substring(node.getName().toLowerCase().lastIndexOf("ship"), node.getName().length()));
                  // print log in csv-like format: [timestamp , queried ship , area (nautic miles) , reasoning mode (continuous or discrete) , time for preparation , heap before query , time to query, heap after query, shipofinterest, probability(of true) ]
                    System.out.println(
                        ">> , "
                        + timestampLabel    // timestamp
                        + " , " + DataBase.getInstance().getShips().size()      // quantity of ships
                        + " , " + DataBase.getInstance().getOrganizations().size()  // quantity of organizations
                        + " , " + DataBase.getInstance().getPeople().size()      // quantity of people
                        + " , " + shipName        // name of the ship provided by the user
                        + " , " + World.This().getDetectingMile()           // detecting area, in nautic miles
                        + " , " + reasoningModeLabel  // reasoning mode
                        + " , " + timeForPreparation  // time took to prepare query
                        + " , " + heapBeforeQuery    // memory usage before query
                        + " , " + timeForQuery      // time took to actually perform query
                        + " , " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())  // memory usage afer query
                        + " , " + returnedNet.getNodeCount()  // size of net
                        + " , " + "Ship" + ship.getID()  // ship of interest
                        + " , " + ((TreeVariable)node).getMarginalAt((node.getStateAt(0).equalsIgnoreCase("TRUE")?0:1))      // probability ship of interest
                        + " , " + (ship.getTerroristPlan() != null && ship.getTerroristPlan().getTerroristPlanType() != null// whether it is a terrorist
                        + " , " + queryList.size()  // size of query is supposedly the quantity of ships
                        + " , " + iterationQuantityMap.get(ship.getID())  // how many iterations the reasoner used to get a result for the ship of interest
                        + " , " + executionTimeMap.get(ship.getID())    // time in milliseconds to complete 1 query (only important in sequential query)
                    );
            } catch (Throwable t) {
              // logging should not stop program
              t.printStackTrace();
            }
              }
        }
      } else {
        // there are no ships nearby
//        System.out.println(">> No ships nearby " + myShip.getShipName() + ". Area is " + World.This().getDetectingMile()
//            + " nautic miles. Reasoning mode was " + (isContinuousCase()?"CONTINUOUS.":"DISCRETE."));
//        System.out.println("[" + new Date() + "] current heap usage is " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
       
        // print log [timestamp , queried ship , area (nautic miles) , reasoning mode (continuous or discrete) , time for preparation , heap before query , time to query, heap after query, shipofinterest, probability(of true) ]
        System.out.println(
              ">> , "
              + timestampLabel    // timestamp
              + " , " + DataBase.getInstance().getShips().size()      // quantity of ships
              + " , " + DataBase.getInstance().getOrganizations().size()  // quantity of organizations
              + " , " + DataBase.getInstance().getPeople().size()      // quantity of people
              + " , " + shipName    // ship id of queried ship (ship provided by user as input for this method)
              + " , " + World.This().getDetectingMile()           // detecting area, in nautic miles
              + " , " + reasoningModeLabel  // reasoning mode
              + " , " + timeForPreparation  // time took to prepare query
              + " , " + heapBeforeQuery    // memory usage before query
              + " , " + timeForQuery      // time took to actually perform query
              + " , " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())  // memory usage afer query
              + " , " + 0        // size of net = 0 because nothing was queried
                    + " , " + "null"    // there were no ship to actually query
              + " , " + -1.0f      // invalid probability
              + " , " + false      // it is not a ship of interest
              + " , " + 0        // no ships in the result
              + " , " + 0        // no iteration performed by the reasoner
                + " , " + 0        // if 0 query in total, it's 0 query time sequentially as well
            );
      }
     
      // query ships of interest as well, if asked
      if (isToForceIncludeShipOfInterest) {
       
        // reset KB, because we are going to do a different query
        resetKB();
       
        // reset the maps with test data
        iterationQuantityMap.clear();
        executionTimeMap.clear();
       
        try {
          // try freeing memory now, because we want to collect memory usage again
          System.gc();
          Thread.sleep(500);
        } catch (Exception e) {
          e.printStackTrace();
        }
       
        // calculate new time and heap of preparation phase
        time = System.currentTimeMillis()
        heapBeforeQuery = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory());
       
        // prepare another multiple query
        queryList.clear();
       
        // look for ships that are terrorists.
        Map<Query, ShipEntity> terroristShips = new HashMap<Query, ShipEntity>()// will record who was added to new query
        for (ShipEntity ship : DataBase.getInstance().getShips()) {
          if (ship.getTerroristPlan() != null && ship.getTerroristPlan().getTerroristPlanType() != null) {
            // this is a ship of interest
            if (!shipEntitiesInQuery.containsValue(ship)) {
              Query query = PrognosController.this.setupQuery(ship);
              queryList.add(query);
              if (isToUseMultipleQuery) {
                PrognosController.this.populateRelevantKB(ship, false);
              } else {
                // register what ship was added to which query
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.