id.substring(1) : "!" + id));
}
/** supports chains only */
public boolean hasOpposite(String formula) {
LispTree tree = LispTree.proto.parseFromString(formula);
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);
}
}