docs: private static RDFNode toNode(Object value) {
      if (value == null) {
        return null;
      } else if (value instanceof RDFNode) {
        return (RDFNode) value;
      } else if (value instanceof IRI) {
        return new NamedNodeImpl(URI.create(((IRI)value).iri.toString()));
      } else if (value instanceof PlainLiteral) {
        PlainLiteral pl = (PlainLiteral)value;
        String lang = pl.language != null ? pl.language.toString() : null;
        return new PlainLiteralImpl(pl.lexical.toString(), lang);
      } else if (value instanceof TypedLiteral) {
        TypedLiteral tl = (TypedLiteral)value;
        return new TypedLiteralImpl(tl.lexical.toString(), URI.create(tl.datatype.toString()));
      } else if (value instanceof BNode) {
        return new BlankNodeImpl(((BNode)value).label.toString());
      } else {
        // Sherpa passes strings as something other than java.lang.String, so convert.
        if (value instanceof CharSequence) {
          value = value.toString();
        }
        // What's left is a primitive Java type, convert it to an XSD-typed literal.
        // Falls back to xsd:anySimpleType for unrecognized classes
        return Conversions.toLiteral(value);
      }
    }