Exemplo n.º 1
0
 private boolean isLegalCvt(Formula inner, Formula outer) {
   if (FreebaseInfo.isReverseProperty(inner.toString())
       && !FreebaseInfo.isReverseProperty(outer.toString())) return false;
   if (!FreebaseInfo.isReverseProperty(inner.toString())
       && FreebaseInfo.isReverseProperty(outer.toString())) return false;
   // if (isEquivalent(reverseFormula(outer), inner)) //don't expand if reverse is equivalent
   // return false;
   return true;
 }
Exemplo n.º 2
0
 private String getType1Desc(FormulaGenerationInfo fgInfo) {
   if (fgInfo.isUnary) {
     return fgInfo.uInfo.getRepresentativeDescrption();
   }
   if (fgInfo.bInfo.expectedType1.equals(FreebaseInfo.DATE)) return "date";
   if (fgInfo.bInfo.expectedType1.equals(FreebaseInfo.FLOAT)) return "number";
   if (fgInfo.bInfo.expectedType1.equals(FreebaseInfo.INT)) return "number";
   if (fgInfo.bInfo.expectedType1.equals(FreebaseInfo.BOOLEAN)) return "";
   if (fgInfo.bInfo.expectedType1.equals(FreebaseInfo.TEXT)) return "description";
   Formula type1Formula =
       new JoinFormula(
           FreebaseInfo.TYPE, new ValueFormula<Value>(new NameValue(fgInfo.bInfo.expectedType1)));
   try {
     if (fbFormulasInfo.getUnaryInfo(type1Formula) == null) {
       LogInfo.logs("No unary info for=%s", type1Formula);
       return null;
     }
     return fbFormulasInfo.getUnaryInfo(type1Formula).getRepresentativeDescrption();
   } catch (NullPointerException e) {
     if (type1Formula.toString().equals("(fb:type.object.type fb:type.object)")) return "thing";
     else {
       LogInfo.logs(
           "Binfo exType1=%s, exType2=%s", fgInfo.bInfo.expectedType1, fgInfo.bInfo.expectedType2);
       throw new RuntimeException(e);
     }
   }
 }
Exemplo n.º 3
0
 public String toString() {
   return formula.toString()
       + "\t"
       + popularity
       + "\t"
       + expectedType1
       + "\t"
       + expectedType2
       + "\t"
       + unitId
       + "\t"
       + unitDesc
       + "\t"
       + Joiner.on("###").join(descriptions);
 }