Package org.semarglproject.ri

Examples of org.semarglproject.ri.MalformedCurieException


        }

        int delimPos = curie.indexOf(':');
        if (delimPos == -1) {
            if (safeSyntax || ignoreRelIri) {
                throw new MalformedCurieException("CURIE with no prefix (" + curie + ") found");
            }
            return documentContext.resolveIri(curie);
        }

        String result = resolveMapping(curie, delimPos, safeSyntax);
View Full Code Here


    private String resolveMapping(String curie, int delimPos, boolean safeSyntax) throws MalformedCurieException {
        String localName = curie.substring(delimPos + 1);
        String prefix = curie.substring(0, delimPos);

        if (prefix.equals("_")) {
            throw new MalformedCurieException("CURIE with invalid prefix (" + curie + ") found");
        }

        if (!iriMappings.containsKey(prefix)) {
            if (documentContext.rdfaVersion > RDFa.VERSION_10 && RDFA11_INITIAL_CONTEXT.containsKey(prefix)) {
                String nsUri = RDFA11_INITIAL_CONTEXT.get(prefix);
                iriMappings.put(prefix, nsUri);
                String result = nsUri + localName;
                if (RIUtils.isIri(result)) {
                    return result;
                }
                throw new MalformedCurieException("Malformed CURIE (" + curie + ")");
            }
            if (!safeSyntax && RIUtils.isIri(curie)) {
                return curie;
            }
            throw new MalformedCurieException("CURIE with unresolvable prefix found (" + curie + ")");
        }
        return iriMappings.get(prefix) + localName;
    }
View Full Code Here

        }

        int delimPos = curie.indexOf(':');
        if (delimPos == -1) {
            if (ignoreRelIri) {
                throw new MalformedCurieException("CURIE with no prefix (" + curie + ") found");
            }
            return resolveIri(curie);
        }

        String suffix = curie.substring(delimPos + 1);
        if (suffix.startsWith("//")) {
            return resolveIri(curie);
        }

        String prefix = curie.substring(0, delimPos);
        if (prefix.equals("_")) {
            throw new MalformedCurieException("CURIE with invalid prefix (" + curie + ") found");
        }

        try {
            String prefixUri = resolveMapping(prefix);
            if (prefixUri != null) {
View Full Code Here

TOP

Related Classes of org.semarglproject.ri.MalformedCurieException

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.