Package com.github.jsonldjava.utils

Examples of com.github.jsonldjava.utils.URL


        if (iri.indexOf(":") != -1) {
            return iri;
        }

        // parse base if it is a string
        URL base;
        if (isString(baseobj)) {
            base = URL.parse((String) baseobj);
        } else {
            // assume base is already a URL
            base = (URL) baseobj;
        }

        final URL rel = URL.parse(iri);

        // start hierarchical part
        String hierPart = base.protocol;
        if (!"".equals(rel.authority)) {
            hierPart += "//" + rel.authority;
View Full Code Here


     *            the absolute IRI.
     *
     * @return the relative IRI if relative to base, otherwise the absolute IRI.
     */
    private static String removeBase(Object baseobj, String iri) {
        URL base;
        if (isString(baseobj)) {
            base = URL.parse((String) baseobj);
        } else {
            base = (URL) baseobj;
        }

        // establish base root
        String root = "";
        if (!"".equals(base.href)) {
            root += (base.protocol) + "//" + base.authority;
        }
        // support network-path reference with empty base
        else if (iri.indexOf("//") != 0) {
            root += "//";
        }

        // IRI not relative to base
        if (iri.indexOf(root) != 0) {
            return iri;
        }

        // remove root from IRI and parse remainder
        final URL rel = URL.parse(iri.substring(root.length()));

        // remove path segments that match
        final List<String> baseSegments = _split(base.normalizedPath, "/");
        final List<String> iriSegments = _split(rel.normalizedPath, "/");

View Full Code Here

TOP

Related Classes of com.github.jsonldjava.utils.URL

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.