code: public Value createValue(final ValueFactory valueFactory, final RDFNode data, final int type)
          throws RepositoryException {
          assert (valueFactory != null);
  
  
          if (type == UNDEFINED || type == STRING) {
              return valueConverter.reverse().convert(data);
          } else if (type == REFERENCE || type == WEAKREFERENCE) {
              // reference to another node (by path)
              if (!data.isURIResource()) {
                  throw new ValueFormatException("Reference properties can only refer to URIs, not literals");
              }
  
              try {
                  final Node nodeFromGraphSubject = getJcrNode(idTranslator.convert(data.asResource()));
                  return valueFactory.createValue(nodeFromGraphSubject, type == WEAKREFERENCE);
              } catch (final RepositoryRuntimeException e) {
                  throw new MalformedRdfException("Unable to find referenced node", e);
              }
          } else if (data.isResource()) {
              LOGGER.debug("Using default JCR value creation for RDF resource: {}",
                      data);
              return valueFactory.createValue(data.asResource().getURI(), type);
          } else {
              LOGGER.debug("Using default JCR value creation for RDF literal: {}",
                      data);
  
              // If the date time stamp has a ms field which is a multiple of 10 (ie, .5 or .86) and is truncated to
              // one or two characters, then Modeshape 5.0 will incorrectly parse the timestamp
              // and pad the number incorrectly: ie. .5 ms becomes .005 ms, .86 becomes .086), thereby changing the
              // time stamp.  All this does is make the ms section 3 digits and then Modeshape behaves.
              String theValue = data.asLiteral().getString();
  
              if (type == DATE) {
                  theValue = Instant.parse(data.asLiteral().getString()).toString();
              }
              return valueFactory.createValue(theValue, type);
          }
      }
docs: Create a JCR value from an RDF node with the given JCR type
  @param valueFactory the given value factory
  @param data the rdf node data
  @param type the given JCR type
  @return created value
  @throws RepositoryException if repository exception occurred