/** * Gets the URI Fragment for the selected entity. * @return The fragment, or the empty string if there * is no fragment. */ private String getShortName() { IriSplitter splitter = new IriSplitter(); return splitter.getShortName(owlEntity.getIRI()).orElse(""); }
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)); }