@Override public String getReference() { return uri.getUnicodeString(); } public IRI getIRI(){
@Override public String toString() { return uri.getUnicodeString(); } }
@Override public String toString() { return uri.getUnicodeString(); } }
@Override public String toString() { return uri.getUnicodeString(); } }
@Override public String toString() { return uri.getUnicodeString(); } }
/** * Compares Entities based on their {@link #getUri()} */ @Override public int compareTo(Entity other) { return uri.getUnicodeString().compareTo(other.uri.getUnicodeString()); } }
@Override public boolean expand(RDFTerm resource) { if (resource instanceof BlankNode) { return true; } if (resource instanceof IRI) { return ((IRI)resource).getUnicodeString().startsWith(uriPrefix); } return false; } });
@Override public int hashCode() { return uri.getUnicodeString().hashCode(); } @Override
private File getTcDir(File directory, IRI name) { try { String subDirName = URLEncoder.encode(name.getUnicodeString(), "utf-8"); return new File(directory, subDirName); } catch (UnsupportedEncodingException ex) { throw new RuntimeException("utf-8 not supported", ex); } }
protected RdfReference(IRI uri){ if(uri == null){ throw new IllegalArgumentException("The parsed Reference MUST NOT be NULL!"); } else if(uri.getUnicodeString().isEmpty()){ throw new IllegalArgumentException("The parsed Reference MUST NOT be represent an empty string!"); } else { this.uri = uri; } } @Override
protected RdfReference(IRI uri){ if(uri == null){ throw new IllegalArgumentException("The parsed Reference MUST NOT be NULL!"); } else if(uri.getUnicodeString().isEmpty()){ throw new IllegalArgumentException("The parsed Reference MUST NOT be represent an empty string!"); } else { this.uri = uri; } } @Override
private <R extends RDFTerm> R toSourceRDFTerm(final R targetRDFTerm) { if (targetRDFTerm instanceof IRI) { final IRI sourceIRI = (IRI) targetRDFTerm; if (sourceIRI.getUnicodeString().startsWith(targetPrefix)) { final String uriRest = sourceIRI.getUnicodeString() .substring(targetPrefixLength); return (R) new IRI(sourcePrefix+uriRest); } } return targetRDFTerm; }
public static String extractLabel(IRI uri){ String fullUri = uri.getUnicodeString(); int index = Math.max(fullUri.lastIndexOf('#'),fullUri.lastIndexOf('/')); index = Math.max(index, fullUri.lastIndexOf(':')); //do not convert if the parsed uri does not contain a local name if(index > 0 && index+1 < fullUri.length()){ return StringUtils.capitalize(fullUri.substring(index+1).replaceAll("[\\-_]", " ")); } else { return uri.getUnicodeString(); } } public Collection<EntityExtractionSummary> getOccurrences(IRI type){
String getLocalName() { String uriValue = uri.getUnicodeString(); int hashPos = uriValue.lastIndexOf('#'); int slashPos = uriValue.lastIndexOf('/'); int delimiter = hashPos > slashPos ? hashPos : slashPos; String val = uriValue.substring(delimiter + 1); if (val.length()==0) return "THIS_ONTOLOGY"; //replace bad characters... val = val.replace('-', '_').replace('.','_'); return reservedWords.contains(val) ? val + "_" : val; }
@Override public String getId() { return getNode().getUnicodeString(); } /**
@Override public String getId() { return getNode().getUnicodeString(); } /**
@Override @Deprecated public String getPublicKey(OWLOntologyID ontologyId) { IRI ur = keymap.getMapping(ontologyId); log.debug("key for {} is {}", ontologyId, ur); return (ur == null) ? null : ur.getUnicodeString(); }
@Override public final String adapt(T value, Class<String> type) { if (value == null) { return null; } else if (value instanceof IRI) { return ((IRI) value).getUnicodeString(); } else if (value instanceof Literal) { return ((Literal) value).getLexicalForm(); } else { return value.toString(); } }
public EngineException(EnhancementEngine ee, ContentItem ci, String message, Throwable cause) { super(String.format( "'%s' failed to process content item '%s' with type '%s': %s", ee.getClass().getSimpleName(), ci.getUri().getUnicodeString(), ci.getMimeType(), message == null ? cause : message), cause); this.enhancementEngine = ee; this.contentItem = ci; }
private Graph getDocumentationGraph(URL docUrl, String symbolicName) { try { ImmutableGraph parsedGraph = parser.parse(docUrl.openStream(), SupportedFormat.N_TRIPLE); IRI baseUri = config.getDefaultBaseUri(); return new SimpleGraph(new UriMutatorIterator( parsedGraph.iterator(), baseUri.getUnicodeString(), symbolicName)); } catch (IOException ex) { logger.warn("Cannot parse documentation at URL: {}", docUrl); throw new RuntimeException(ex); } }