public boolean execAsk() { HttpQuery httpQuery = makeHttpQuery() ; httpQuery.setAccept(HttpParams.contentTypeResultsXML) ; InputStream in = httpQuery.exec() ; boolean result = XMLInput.booleanFromXML(in) ; // Ensure connection is released try { in.close(); } catch (java.io.IOException e) { log.warn("Failed to close connection", e); } return result; }
public static boolean parseAskResult(final String resultURI) throws FileNotFoundException { if( resultURI.endsWith( "srx" ) ) { return XMLInput.booleanFromXML( new FileInputStream( resultURI.substring( 5 ) ) ); } else if( resultURI.endsWith( "ttl" ) || resultURI.endsWith( "rdf" ) ) { return FileManager .get() .loadModel( resultURI.substring( 5 ) ) .getProperty( null, ResourceFactory .createProperty( "http://www.w3.org/2001/sw/DataAccess/tests/result-set#boolean" ) ) .getBoolean(); } else { throw new RuntimeException( "Unknown format." ); } }
return XMLInput.booleanFromXML(in); if (actualContentType.equals(WebContent.contentTypeResultsJSON)) return JSONInput.booleanFromJSON(in);