code: private static SPARQLQueryDefinition bindObject(SPARQLQueryDefinition qdef, String variableName, Value object) throws MarkLogicSesameException{
          SPARQLBindings bindings = qdef.getBindings();
          if(object != null){
              if (object instanceof URI) {
                  bindings.bind(variableName, object.stringValue());
              } else if (object instanceof Literal) {
                  Literal lit = (Literal) object;
                  if (lit.getLanguage() != null) {
                      String languageTag = lit.getLanguage();
                      bindings.bind(variableName, lit.getLabel(), Locale.forLanguageTag(languageTag));
                  }else if (((Literal) object).getDatatype() != null) {
                      try {
                          String xsdType = lit.getDatatype().toString();
                          String fragment = new java.net.URI(xsdType).getFragment();
                          bindings.bind(variableName,lit.getLabel(),RDFTypes.valueOf(fragment.toUpperCase()));
                      } catch (URISyntaxException e) {
                          logger.error(e.getLocalizedMessage());
                          throw new MarkLogicSesameException("Problem with object datatype.");
                      }
                  }else {
                      // assume we have a string value
                      bindings.bind(variableName, lit.getLabel(), RDFTypes.STRING);
                  }
              }
              qdef.setBindings(bindings);
          }
          return qdef;
      }
docs: bind object
  
  @param qdef
  @param variableName
  @param object
  @return
  @throws MarkLogicSesameException