Package org.apache.jena.iri

Examples of org.apache.jena.iri.IRI


    /*
     * No exception thrown by this method.
     */
    static private IRI resolveIRI(String relStr, String baseStr) {
        synchronized (globalResolverLock) {
            IRI i = iriFactory.create(relStr) ;
            if (i.isAbsolute())
                // removes excess . segments
                return globalResolver.getBaseIRI().create(i) ;

            IRI base = iriFactory.create(baseStr) ;

            if ("file".equalsIgnoreCase(base.getScheme()))
                return globalResolver.getBaseIRI().create(i) ;
            return base.create(i) ;
        }
    }
View Full Code Here


            return globalResolver.getBaseIRI() ;
        }
    }

    public String getBaseIRIasString() {
        IRI iri = getBaseIRI() ;
        if (iri == null)
            return null ;
        return iri.toString() ;
    }
View Full Code Here

        @Override
        public IRI resolveSilent(String uriStr) {
            if (resolvedIRIs != null && resolvedIRIs.containsKey(uriStr))
                return resolvedIRIs.get(uriStr) ;
            IRI iri = iriFactory.create(uriStr) ;
            if (resolvedIRIs != null)
                resolvedIRIs.put(uriStr, iri) ;
            return iri ;
        }
View Full Code Here

    @Override
    public void add(String prefix, IRI iri) {
        prefix = canonicalPrefix(prefix);

        IRI existing = this.prefixes.get(prefix);
        if (existing != null && existing.equals(iri)) {
            // Same as existing mapping so no-op
            return;
        } else {
            // New/Updated mapping

            if (existing != null) {
                // Delete current abbreviation mapping
                this.abbrevs.remove(existing.toString());
            }

            // Add/Update the mapping
            this.prefixes.put(prefix, iri);
View Full Code Here

    @Override
    public void delete(String prefix) {
        prefix = canonicalPrefix(prefix);

        IRI iri = this.prefixes.get(prefix);
        if (iri == null)
            return;

        // Delete the abbreviation mapping
        this.abbrevs.remove(iri.toString());

        // Delete the mapping
        this.prefixes.remove(prefix);
    }
View Full Code Here

    }

    @Override
    public String expand(String prefix, String localName) {
        prefix = canonicalPrefix(prefix);
        IRI x = prefixes.get(prefix);
        if (x == null)
            return null;
        return x.toString() + localName;
    }
View Full Code Here

        }

    }

    private void check(String string) {
        IRI iri = factory.create(string);
        if (iri.hasViolation(true)) {
            System.out.println("n: " + string);
            Iterator<Violation> it = iri.violations(true);
            while (it.hasNext()) {
                Violation v = it.next();
                System.out.println(v.getLongMessage());
            }
        } else {
View Full Code Here

    static private int relFlags = IRIRelativize.SAMEDOCUMENT | IRIRelativize.CHILD ;
    static private String abbrevByBase(String uri, String base)
    {
        if ( base == null )
            return null ;
        IRI baseIRI = IRIFactory.jenaImplementation().construct(base) ;
        IRI rel = baseIRI.relativize(uri, relFlags) ;
        String r = null ;
        try { r = rel.toASCIIString() ; }
        catch (MalformedURLException  ex) { r = rel.toString() ; }
        return r ;
    }
View Full Code Here

    static private int relFlags = IRIRelativize.SAMEDOCUMENT | IRIRelativize.CHILD ;
    static public String abbrevByBase(String uri, String base)
    {
        if ( base == null )
            return null ;
        IRI baseIRI = IRIFactory.jenaImplementation().construct(base) ;
        IRI rel = baseIRI.relativize(uri, relFlags) ;
        String r = null ;
        try { r = rel.toASCIIString() ; }
        catch (MalformedURLException  ex) { r = rel.toString() ; }
        return r ;
    }
View Full Code Here

        @Override
        public IRI resolveSilent(String relURI) {
            if (resolvedIRIs != null && resolvedIRIs.containsKey(relURI))
                return resolvedIRIs.get(relURI) ;
            IRI iri = base.resolve(relURI) ;
            if (resolvedIRIs != null)
                resolvedIRIs.put(relURI, iri) ;
            return iri ;
        }
View Full Code Here

TOP

Related Classes of org.apache.jena.iri.IRI

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.