def getPair(self, fileName, step, t1, t2, givenRel): print "Pick pair: ", t1.taxonomy.abbrev + '.' + t1.name, findkey( relation, givenRel), t2.taxonomy.abbrev + '.' + t2.name # visualize reasoning f = open(fileName, "w") f.write("digraph {\n\nrankdir = LR\n\n") f.write('node [shape=box]\n') f.write('"' + t1.taxonomy.abbrev + '.' + t1.name + '" -> "' + t2.taxonomy.abbrev + '.' + t2.name + '" [color=blue, label="' + findkey(relation, givenRel) + '"];\n') f.close()
def getROPart6(self, fileName, t1, t2, t1Child, givenRel, deducedPair, deducedRel, allPairsMir): print "Child: " + t1Child.taxonomy.abbrev + '.' + t1Child.name + ", then look at pair (" + t1Child.taxonomy.abbrev + '.' + t1Child.name + ", " + t2.taxonomy.abbrev + '.' + t2.name + ")" print "Original relation: ", t1Child.taxonomy.abbrev + '.' + t1Child.name, findkey( relation, allPairsMir[deducedPair]), t2.taxonomy.abbrev + '.' + t2.name print "Using R32 comp table: ", t1Child.taxonomy.abbrev+'.'+t1Child.name, "<", t1.taxonomy.abbrev+'.'+t1.name, "R32COMP", t1.taxonomy.abbrev+'.'+t1.name, findkey(relation, givenRel), t2.taxonomy.abbrev+'.'+t2.name, \ "-->", t1Child.taxonomy.abbrev+'.'+t1Child.name, findkey(relation, deducedRel), t2.taxonomy.abbrev+'.'+t2.name f = open(fileName, "a") f.write('"' + t1Child.taxonomy.abbrev + '.' + t1Child.name + '" -> "' + t1.taxonomy.abbrev + '.' + t1.name + '" [label="< (children)"];\n') f.write('"' + t1Child.taxonomy.abbrev + '.' + t1Child.name + '" -> "' + t2.taxonomy.abbrev + '.' + t2.name + '" [color=red, label="' + findkey(relation, deducedRel) + '"];\n') f.close()
def getROPart4(self, fileName, t1, t2, t1Parent, givenRel, deducedPair, deducedRel, allPairsMir): print "\nPart (IV):" print t1.taxonomy.abbrev + '.' + t1.name + " has parent " + t1Parent.taxonomy.abbrev + '.' + t1Parent.name + ", then look at pair (" + t1Parent.taxonomy.abbrev + '.' + t1Parent.name + ", " + t2.taxonomy.abbrev + '.' + t2.name + ")" print "Original relation: ", t1Parent.taxonomy.abbrev + '.' + t1Parent.name, findkey( relation, allPairsMir[deducedPair]), t2.taxonomy.abbrev + '.' + t2.name print "Using R32 comp table: ", t1Parent.taxonomy.abbrev+'.'+t1Parent.name, ">", t1.taxonomy.abbrev+'.'+t1.name, "R32COMP", t1.taxonomy.abbrev+'.'+t1.name, findkey(relation, givenRel), t2.taxonomy.abbrev+'.'+t2.name, \ "-->", t1Parent.taxonomy.abbrev+'.'+t1Parent.name, findkey(relation, deducedRel), t2.taxonomy.abbrev+'.'+t2.name f = open(fileName, "a") f.write('"' + t1Parent.taxonomy.abbrev + '.' + t1Parent.name + '" -> "' + t1.taxonomy.abbrev + '.' + t1.name + '" [label="> (parent)"];\n') f.write('"' + t1Parent.taxonomy.abbrev + '.' + t1Parent.name + '" -> "' + t2.taxonomy.abbrev + '.' + t2.name + '" [color=red, label="' + findkey(relation, deducedRel) + '"];\n') f.close()
def getAssertNewViz(self, fileName, part, deducedPair, deducedRel, oldRel, newRel, cnt): f = open(fileName, "a") print deducedPair[0].taxonomy.abbrev+'.'+deducedPair[0].name + " " + findkey(relation, oldRel) + " " + deducedPair[1].taxonomy.abbrev+'.'+deducedPair[1].name + " & " + \ deducedPair[0].taxonomy.abbrev+'.'+deducedPair[0].name + " " + findkey(relation, deducedRel) + " " + deducedPair[1].taxonomy.abbrev+'.'+deducedPair[1].name + " --> " + \ deducedPair[0].taxonomy.abbrev+'.'+deducedPair[0].name + " " + findkey(relation, newRel) + " " + deducedPair[1].taxonomy.abbrev+'.'+deducedPair[1].name f.write('intersect' + part + str(cnt) + ' [shape=point];\n') f.write('node1' + part + str(cnt) + '[label="' + deducedPair[0].taxonomy.abbrev + '.' + deducedPair[0].name + ' ' + findkey(relation, oldRel) + ' ' + deducedPair[1].taxonomy.abbrev + '.' + deducedPair[1].name + '"];\n') f.write('node2' + part + str(cnt) + '[label="' + deducedPair[0].taxonomy.abbrev + '.' + deducedPair[0].name + ' ' + findkey(relation, deducedRel) + ' ' + deducedPair[1].taxonomy.abbrev + '.' + deducedPair[1].name + '"];\n') f.write('node3' + part + str(cnt) + '[label="' + deducedPair[0].taxonomy.abbrev + '.' + deducedPair[0].name + ' ' + findkey(relation, newRel) + ' ' + deducedPair[1].taxonomy.abbrev + '.' + deducedPair[1].name + '"];\n') f.write('node1' + part + str(cnt) + ' -> intersect' + part + str(cnt) + ' [label="original"];\n') f.write('node2' + part + str(cnt) + ' -> intersect' + part + str(cnt) + ' [label="deduced"];\n') f.write('intersect' + part + str(cnt) + ' -> node3' + part + str(cnt) + ' [label="intersection"];\n') f.close()