/** * Execute a query, expecting the result to be one row, one column. Return * that one RDFNode */ public static RDFNode getExactlyOne(String qs, Model model) { return getExactlyOne(qs, DatasetFactory.wrap(model)) ; }
/** * Execute a query, expecting the result to be one row, one column. Return * that one RDFNode */ public static RDFNode getExactlyOne(String qs, Dataset ds) { Query q = QueryFactory.create(qs) ; if ( q.getResultVars().size() != 1 ) throw new ARQException("getExactlyOne: Must have exactly one result columns") ; String varname = q.getResultVars().get(0) ; try ( QueryExecution qExec = QueryExecutionFactory.create(q, ds) ) { return getExactlyOne(qExec, varname) ; } }