/** * Replaces terminating hash ('#') characters with their URL-encoded versions ("%23"). Any non-terminating * hashes will be left as they are (though they are not to be expected if the IRI denotes an URL). * * @param iri * the IRI to sanitize * @return the sanitized IRI */ public static IRI sanitize(IRI iri) { return IRI.create(sanitize(iri.toString())); }
/** * Provides a standardized string format for an OWL Ontology ID. The string returned is of type * <tt>ontologyIRI[:::versionIRI]</tt>. Any substring <tt>":::"</tt> present in <tt>ontologyIRI</tt> or * <tt>versionIRI</tt> will be URL-encoded (i.e. converted to <tt>"%3A%3A%3A"</tt>).<br/> * <br/> * Also note that both <tt>ontologyIRI</tt> and <tt>versionIRI</tt> are sanitized in the process. No other * URL encoding occurs. * * @param id * the OWL ontology ID to encode * @return the string form of this ID. * @see URIUtils#sanitize(IRI) */ public static String encode(OWLOntologyID id) { if (id == null) throw new IllegalArgumentException("Cannot encode a null OWLOntologyID."); if (id.getOntologyIRI() == null) throw new IllegalArgumentException( "Cannot encode an OWLOntologyID that is missing an ontologyIRI."); String s = ""; s += URIUtils.sanitize(id.getOntologyIRI()).toString().replace(":::", "%3A%3A%3A"); if (id.getVersionIRI() != null) s += (":::") + URIUtils.sanitize(id.getVersionIRI()).toString() .replace(":::", "%3A%3A%3A"); return s; }
/** * Provides a standardized string format for an OWL Ontology ID. The string returned is of type * <tt>ontologyIRI[:::versionIRI]</tt>. Any substring <tt>":::"</tt> present in <tt>ontologyIRI</tt> or * <tt>versionIRI</tt> will be URL-encoded (i.e. converted to <tt>"%3A%3A%3A"</tt>).<br/> * <br/> * Also note that both <tt>ontologyIRI</tt> and <tt>versionIRI</tt> are sanitized in the process. No other * URL encoding occurs. * * @param id * the OWL ontology ID to encode * @return the string form of this ID. * @see URIUtils#sanitize(IRI) */ public static String encode(OWLOntologyID id) { if (id == null) throw new IllegalArgumentException("Cannot encode a null OWLOntologyID."); if (id.getOntologyIRI() == null) throw new IllegalArgumentException( "Cannot encode an OWLOntologyID that is missing an ontologyIRI."); String s = ""; s += URIUtils.sanitize(id.getOntologyIRI()).toString().replace(":::", "%3A%3A%3A"); if (id.getVersionIRI() != null) s += (":::") + URIUtils.sanitize(id.getVersionIRI()).toString() .replace(":::", "%3A%3A%3A"); return s; }
private OWLOntology getOWLOntology(String ontologyId, boolean merge, URI requestUri) { long before = System.currentTimeMillis(); IRI iri = URIUtils.sanitize(IRI.create(ontologyId)); log.debug("Will try to retrieve ontology {} from provider.", iri);
log.debug("Ontology {} missing from provider. Trying libraries...", key); IRI iri = URIUtils.sanitize(IRI.create(ontologyId));
else if (r instanceof Literal) tgt = org.semanticweb.owlapi.model.IRI.create(((Literal) r).getLexicalForm()); else tgt = org.semanticweb.owlapi.model.IRI.create(r.toString()); tgt = URIUtils.sanitize(tgt); importTargets.add(new IRI(tgt.toString())); } catch (Exception ex) {
else if (r instanceof Literal) tgt = org.semanticweb.owlapi.model.IRI.create(((Literal) r).getLexicalForm()); else tgt = org.semanticweb.owlapi.model.IRI.create(r.toString()); tgt = URIUtils.sanitize(tgt); importTargets.add(new IRI(tgt.toString())); } catch (Exception ex) {
graphName = new IRI(URIUtils.sanitize(s)); log.debug("Storing ontology with graph ID {}", graphName); try {
graphName = new IRI(URIUtils.sanitize(s)); log.debug("Storing ontology with graph ID {}", graphName); try {