def checkString(source, entailment = None):
"""Simple function to call out to the pellet webpage.
Both input strings should be RDF/XML.
If the 'entailment' argument is None, check the 'source'
string for consistency. If 'entailment' argument is not
none, check to see if it is entailed by the 'source'
argument.
Return the output of the pellet.cgi in full as a string."""
args = {}
args['Consistency'] = 'true'
args['inputString'] = source
if entailment is not None:
args['conclusionsString'] = entailment
argsenc = urllib.urlencode(args)
pelletcon = urllib.urlopen(PELLETURL, argsenc)
return pelletcon.read()
# Testing.
if __name__=='__main__':
testinput = """
"""
testconc = """
"""
#" - # Stupid emacs can't deal with """ strings very well.
print "Testing consistency..."
print checkString(testinput)
print "Testing entailment..."
print checkString(testinput, testconc)