code: public String getObjectsAsString(final Graph graph,
              final Node subject, final Resource predicate, final boolean uriAsLink) {
          LOGGER.trace("Getting Objects as String: s:{}, p:{}, g:{}", subject, predicate, graph);
          final Iterator<Node> iterator = listObjects(graph, subject, predicate.asNode());
          if (iterator.hasNext()) {
              final Node obj = iterator.next();
              if (obj.isLiteral()) {
                  final String lit = obj.getLiteralValue().toString();
                  return lit.isEmpty() ? "<empty>" : lit;
              }
              return uriAsLink ? "&lt;<a href=\"" + obj.getURI() + "\">" + obj.getURI() + "</a>&gt;" : obj.getURI();
          }
          return "";
      }
docs: Get the string version of the object that matches the given subject and
  predicate
  
  @param graph the graph
  @param subject the subject
  @param predicate the predicate
  @param uriAsLink the boolean value of uri as link
  @return string version of the object