Exemplo n.º 1
0
  @Test
  public void pipelineResponseWithData() {
    jedis.zadd("zset", 1, "foo");

    Pipeline p = jedis.pipelined();
    Response<Double> score = p.zscore("zset", "foo");
    p.sync();

    assertNotNull(score.get());
  }
Exemplo n.º 2
0
 @Aop("redis")
 public List<TopicTag> fetchTopTags() {
   Set<String> names = jedis().zrevrangeByScore(RKEY_TOPIC_TAG_COUNT, Long.MAX_VALUE, 0, 0, 20);
   List<TopicTag> tags = new ArrayList<>();
   List<Response<Double>> tmps = new ArrayList<>();
   Pipeline pipe = jedis().pipelined();
   for (String name : names) {
     tmps.add(pipe.zscore(RKEY_TOPIC_TAG_COUNT, name));
     tags.add(new TopicTag(name, 0));
   }
   pipe.sync();
   Iterator<TopicTag> it = tags.iterator();
   for (Response<Double> response : tmps) {
     it.next().setCount(response.get().intValue());
   }
   return tags;
 }
Exemplo n.º 3
0
 private void compareClassificationResults(
     OWLOntology ontology, OWLReasoner reasoner, Jedis resultStore, Jedis idReader)
     throws Exception {
   Set<OWLClass> classes = ontology.getClassesInSignature();
   Pipeline resultPipeline = resultStore.pipelined();
   double classCount = 0;
   int multiplier = 1;
   double totalCount = 0;
   for (OWLClass cl : classes) {
     classCount++;
     double classProgress = (classCount / classes.size()) * 100;
     Set<OWLClass> reasonerSuperclasses = reasoner.getSuperClasses(cl, false).getFlattened();
     // add cl itself to S(X) computed by reasoner. That is missing
     // in its result.
     reasonerSuperclasses.add(cl);
     // adding equivalent classes -- they are not considered if asked for superclasses
     Iterator<OWLClass> iterator = reasoner.getEquivalentClasses(cl).iterator();
     while (iterator.hasNext()) reasonerSuperclasses.add(iterator.next());
     String classToCheckID = conceptToID(cl.toString(), idReader);
     List<Response<Double>> responseList = new ArrayList<Response<Double>>();
     for (OWLClass scl : reasonerSuperclasses) {
       String key = conceptToID(scl.toString(), idReader);
       responseList.add(resultPipeline.zscore(key, classToCheckID));
     }
     resultPipeline.sync();
     double hitCount = 0;
     for (Response<Double> response : responseList) {
       if (response.get() != null) hitCount++;
     }
     totalCount += (hitCount / reasonerSuperclasses.size());
     if (classProgress >= (5 * multiplier)) {
       System.out.println(
           "% of no. of classes looked at: "
               + classProgress
               + "\tProgress %: "
               + (totalCount / classCount) * 100);
       multiplier++;
     }
   }
   double progress = totalCount / classes.size();
   System.out.println("\nProgress %: " + (progress * 100));
 }