public Optional<String> getShortNamePrefix(@Nonnull IRI iri) { String iriString = checkNotNull(iri).toString(); int shortNameIndex = getShortNameIndex(iriString); if(shortNameIndex == -1) { return Optional.empty(); } return Optional.of(iriString.substring(0, shortNameIndex)); } }
/** * Gets the suffix from an IRI. This is either the fragment (the bit after the # character) or it is * the last path element (the bit after the last slash character). * @return The */ public Optional<String> getShortName(@Nonnull IRI iri) { String iriString = checkNotNull(iri).toString(); int shortNameIndex = getShortNameIndex(iriString); if(shortNameIndex == -1) { return Optional.empty(); } return Optional.of(iriString.substring(shortNameIndex)); }