public static boolean booleanFromXML(InputStream in) { { JSONInput jin = new JSONInput(in, null) ; if(!jin.isResultSet() ) return jin.getBooleanResult() ; throw new ResultSetException("Not a boolean result") ; } }
/** * Read from an input stream which is the format of the SPARQL result set * format in JSON. * * @param in * InputStream * @return ResultSet */ public static ResultSet fromJSON(InputStream in) { return JSONInput.fromJSON(in); }
public static SPARQLResult make(InputStream input) { return make(input, null) ; }
public static ResultSet fromJSON(InputStream in, Model model) { JSONInput jin = new JSONInput(in, model) ; if(jin.isResultSet() ) return jin.getResultSet() ; throw new ResultSetException("Not a result set") ; }
public static SPARQLResult make(InputStream in , Model model) { return new JSONInput(in, model) ; }
checkContains(obj, kHead, kBoolean) ; booleanResult = obj.get(kBoolean).getAsBoolean().value() ; rows = null ; checkContains(obj, kHead, kResults) ; vars = parseVars(head) ; if ( ! vt.isObject() ) throw new ResultSetException("Binding for variable '"+vn+"' is not a JSON object: "+vt) ; Node n = parseOneTerm(vt.getAsObject()) ; b.add(Var.alloc(vn), n) ;
private Node parseOneTerm(JsonObject term) checkContains(term, kType, kValue, kXmlLang, kDatatype) ; String type = stringOrNull(term, kType) ; String v = stringOrNull(term, kValue) ; checkContains(term, kType, kValue) ; String uri = v ; Node n = NodeFactory.createURI(v) ; String lang = stringOrNull(term, kXmlLang) ; String dtStr = stringOrNull(term, kDatatype) ; if ( lang != null && dtStr != null ) throw new ResultSetException("Both language and datatype defined: "+term) ;
private SPARQLResult process(InputStream in, Model model) { parse(in) ; if ( model == null ) model = GraphFactory.makeJenaDefaultModel() ; if ( rows != null ) { QueryIterator qIter = new QueryIterPlainWrapper(rows.iterator()) ; ResultSet rs = new ResultSetStream(Var.varNames(vars), model, qIter) ; super.set(rs) ; } else super.set(booleanResult) ; return this ; }
return XMLInput.booleanFromXML(in); if (actualContentType.equals(WebContent.contentTypeResultsJSON)) return JSONInput.booleanFromJSON(in); if (actualContentType.equals(WebContent.contentTypeTextTSV)) return TSVInput.booleanFromTSV(in);
public static void main(String[] args){ RestTemplate restTemplate = new RestTemplate(); ObjectMapper mapper = new ObjectMapper(); JSONInput post = new JSONInput(); //create a JSONInput class with all your datas to be posted for URL //set the values here for ex: post.setString("test"); String deployedURl = "http://localhost:portNo/projectName/restService" System.out.println(restTemplate.postforObject(deployedURl,post,OutputExpected.class));
/** Read from an input stream which is the format of the SPARQL result set format in JSON. * * @param in InputStream * @return ResultSet */ public static ResultSet fromJSON(InputStream in) { return JSONInput.fromJSON(in) ; }
return JSONInput.make(in, GraphFactory.makeDefaultModel()) ; else return XMLInput.make(in, GraphFactory.makeDefaultModel()) ;
public static ResultSet fromJSON(InputStream in) { return fromJSON(in, null) ; }
x = JSONInput.make(in, GraphFactory.makeDefaultModel()) ; else x = XMLInput.make(in, GraphFactory.makeDefaultModel()) ;
return JSONInput.fromJSON(input) ;
x = JSONInput.make(in, GraphFactory.makeDefaultModel()); else x = XMLInput.make(in, GraphFactory.makeDefaultModel());
return JSONInput.fromJSON(input);