@Test public void testcleanPath() { String iriStr = "http: IRI iri = IRI.create(iriStr); String result = UTILS.cleanPath(iri); assertEquals("www/semanticweb/org/sesa/ontologies/_2017/_3/untitled_ontology_10", result); }
public static String cleanPath(IRI iri) { String path = iri.toURI().getPath(); if (path == null) { throw new InvalidUriException(iri.toQuotedString()); } path = path.replaceAll("\\/(\\d+)", "/_$1"); path = path.replaceAll("(\\.|\\-)", "_"); String domain = iri.toURI().getHost(); domain = domain.replaceAll("^(https?):\\/\\/", ""); int indexOfSharp = iri.getNamespace().indexOf("#"); if (indexOfSharp < 0 && path.length() > 1) { int indexOfLastSeperator = path.lastIndexOf("/"); path = path.substring(0, indexOfLastSeperator); } domain = domain + path; domain = domain.replaceAll("\\.", "/"); return domain; }
UTILS { public static String cleanPath(IRI iri) { String path = iri.toURI().getPath(); if (path == null) { throw new InvalidUriException(iri.toQuotedString()); } path = path.replaceAll("\\/(\\d+)", "/_$1"); path = path.replaceAll("(\\.|\\-)", "_"); String domain = iri.toURI().getHost(); domain = domain.replaceAll("^(https?):\\/\\/", ""); int indexOfSharp = iri.getNamespace().indexOf("#"); if (indexOfSharp < 0 && path.length() > 1) { int indexOfLastSeperator = path.lastIndexOf("/"); path = path.substring(0, indexOfLastSeperator); } domain = domain + path; domain = domain.replaceAll("\\.", "/"); return domain; } }
UTILS { public static String cleanPath(IRI iri) { String path = iri.toURI().getPath(); if (path == null) { throw new InvalidUriException(iri.toQuotedString()); } path = path.replaceAll("\\/(\\d+)", "/_$1"); path = path.replaceAll("(\\.|\\-)", "_"); String domain = iri.toURI().getHost(); domain = domain.replaceAll("^(https?):\\/\\/", ""); int indexOfSharp = iri.getNamespace().indexOf("#"); if (indexOfSharp < 0 && path.length() > 1) { int indexOfLastSeperator = path.lastIndexOf("/"); path = path.substring(0, indexOfLastSeperator); } domain = domain + path; domain = domain.replaceAll("\\.", "/"); return domain; }  }
UTILS { public static String cleanPath(IRI iri) { String path = iri.toURI().getPath(); if (path == null) { throw new InvalidUriException(iri.toQuotedString()); } path = path.replaceAll("\\/(\\d+)", "/_$1"); path = path.replaceAll("(\\.|\\-)", "_"); String domain = iri.toURI().getHost(); domain = domain.replaceAll("^(https?):\\/\\/", ""); int indexOfSharp = iri.getNamespace().indexOf("#"); if (indexOfSharp < 0 && path.length() > 1) { int indexOfLastSeperator = path.lastIndexOf("/"); path = path.substring(0, indexOfLastSeperator); } domain = domain + path; domain = domain.replaceAll("\\.", "/"); return domain; }  static String cleanPath(IRI iri); static boolean createNew(File file); static boolean delete(File file); static String getOlgaVersion(); static String cleanPackageName(String path); static void validateClassName(String className); static boolean hasOntologyFormatExtension(String fileName); static int weightOfProperties(ZClass zclass); static String cleanPackageName(IRI iri); static void copyFiles(String fileName, String pathSource, String pathDestination); static void copyDirectory(String directoryName, String pathSource, String pathDestination); static String removeLastPoint(String packageName); static boolean isPathValid(String path); static String rebuildPath(String path); static void cleanDirectory(File directory); static boolean deleteDirectory(File dir); static boolean isVersionPatternValid(String version); static int propertyWeight(ZObjectProperty zObjectProperty); static int propertyWeight(ZDataProperty zDataProperty); }
UTILS { public static String cleanPath(IRI iri) { String path = iri.toURI().getPath(); if (path == null) { throw new InvalidUriException(iri.toQuotedString()); } path = path.replaceAll("\\/(\\d+)", "/_$1"); path = path.replaceAll("(\\.|\\-)", "_"); String domain = iri.toURI().getHost(); domain = domain.replaceAll("^(https?):\\/\\/", ""); int indexOfSharp = iri.getNamespace().indexOf("#"); if (indexOfSharp < 0 && path.length() > 1) { int indexOfLastSeperator = path.lastIndexOf("/"); path = path.substring(0, indexOfLastSeperator); } domain = domain + path; domain = domain.replaceAll("\\.", "/"); return domain; }  static String cleanPath(IRI iri); static boolean createNew(File file); static boolean delete(File file); static String getOlgaVersion(); static String cleanPackageName(String path); static void validateClassName(String className); static boolean hasOntologyFormatExtension(String fileName); static int weightOfProperties(ZClass zclass); static String cleanPackageName(IRI iri); static void copyFiles(String fileName, String pathSource, String pathDestination); static void copyDirectory(String directoryName, String pathSource, String pathDestination); static String removeLastPoint(String packageName); static boolean isPathValid(String path); static String rebuildPath(String path); static void cleanDirectory(File directory); static boolean deleteDirectory(File dir); static boolean isVersionPatternValid(String version); static int propertyWeight(ZObjectProperty zObjectProperty); static int propertyWeight(ZDataProperty zDataProperty);  }