Package com.github.jsonldjava.utils

Examples of com.github.jsonldjava.utils.JsonLdUrl


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

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

        final JsonLdUrl rel = JsonLdUrl.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) {
        JsonLdUrl base;
        if (isString(baseobj)) {
            base = JsonLdUrl.parse((String) baseobj);
        } else {
            base = (JsonLdUrl) 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 JsonLdUrl rel = JsonLdUrl.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.JsonLdUrl

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.