/** {@inheritDoc} No binding will be emitted if the value is null (unbound). */ protected void addBinding(Variable var, Object value) throws IOException { if (value != null) { s.append(i(3)).append("<binding name=\"").append(var.getName()).append("\">"); // no dynamic dispatch, so use if/then if (value instanceof URIReference) addURI((URIReference) value); else if (value instanceof Literal) addLiteral((Literal) value); else if (value instanceof BlankNode) addBNode((BlankNode) value); else throw new IllegalArgumentException( "Unable to create a SPARQL response with an answer containing: " + value.getClass().getSimpleName()); s.append(i(3)).append("</binding>"); } }
/** {@inheritDoc} */ protected void addHeaderVariable(Variable var) throws IOException { s.append(i(2)).append("<variable name=\""); s.append(var.getName()).append("\"/>"); }