Exemplo n.º 1
0
 /** supports chains only */
 public boolean hasOpposite(Formula formula) {
   LispTree tree = formula.toLispTree();
   if (tree.isLeaf()) {
     String fbProperty =
         FreebaseInfo.isReverseProperty(tree.value) ? tree.value.substring(1) : tree.value;
     return freebaseInfo.fbPropertyHasOpposite(fbProperty);
   } else {
     // Un-reverse everything.
     String binary1 = tree.child(2).child(0).value;
     binary1 = FreebaseInfo.isReverseProperty(binary1) ? binary1.substring(1) : binary1;
     String binary2 = tree.child(2).child(1).child(0).value;
     binary2 = FreebaseInfo.isReverseProperty(binary2) ? binary2.substring(1) : binary2;
     return freebaseInfo.fbPropertyHasOpposite(binary1)
         && freebaseInfo.fbPropertyHasOpposite(binary2);
   }
 }
Exemplo n.º 2
0
  public Formula equivalentFormula(Formula formula) {

    LispTree tree = formula.toLispTree();
    return equivalentFormula(tree);
  }
Exemplo n.º 3
0
 /** supports chains only */
 public boolean isReversed(Formula formula) {
   LispTree tree = formula.toLispTree();
   if (tree.isLeaf()) return FreebaseInfo.isReverseProperty(tree.value);
   else return FreebaseInfo.isReverseProperty(tree.child(2).child(0).value);
 }