code: public String getObjectTitle(final Graph graph, final Node sub) {
          if (sub == null) {
              return "";
          }
          final Optional<String> title = TITLE_PROPERTIES.stream().map(Property::asNode).flatMap(p -> listObjects(
                  graph, sub, p).toList().stream()).filter(Node::isLiteral).map(Node::getLiteral).map(
                          LiteralLabel::toString).findFirst();
          return title.orElse(sub.isURI() ? sub.getURI() : sub.isBlank() ? sub.getBlankNodeLabel() : sub.toString());
      }
docs: Get the canonical title of a subject from the graph
  
  @param graph the graph
  @param sub the subject
  @return canonical title of the subject in the graph