Here you can find the source of getHostCore(final String quadGraph)
public static String getHostCore(final String quadGraph) throws URISyntaxException
//package com.java2s; //License from project: Apache License import java.net.URISyntaxException; public class Main { /**// w w w.j a v a 2s. com * This method should be used over others because it -safely- and accurately trims the host name by 1. */ public static String getHostCore(final String quadGraph) throws URISyntaxException { // if (quadGraph == null) { // System.out.println("null"); // } final String[] graphurisplit = quadGraph.split("\\."); StringBuilder host = new StringBuilder(); try { Integer.valueOf(graphurisplit[graphurisplit.length - 1]); host.append(quadGraph); } catch (NumberFormatException e) { for (int i = Math.min(1, Math.max(graphurisplit.length - 2, 0)); i < graphurisplit.length; i++) { host.append(graphurisplit[i] + "."); } host.deleteCharAt(host.length() - 1); } // String[] graphurisplit = quadGraph.toString().split("\\."); // final String host = ((Resource) quadGraph).getHost(); /* if (graphurisplit.length > 1) { host = graphurisplit[graphurisplit.length - 2] + "." + graphurisplit[graphurisplit.length - 1]; } else if (graphurisplit.length == 1) { host = graphurisplit[0]; } else { host = ""; } */ return host.toString(); } }