Package org.apache.jena.iri

Examples of org.apache.jena.iri.IRI


   
    @Override
    public IRI makeIRI(String uriStr, long line, long col)
    {
        // resolves, but we handle the errors and warnings.
        IRI iri = prologue.getResolver().resolveSilent(uriStr) ;
        CheckerIRI.iriViolations(iri, errorHandler, line, col) ;
        return iri ;
    }
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 void add(String prefix, String iriString) {
        prefix = canonicalPrefix(prefix);
        IRI iri = IRIFactory.iriImplementation().create(iriString);
        prefixes.put(prefix, iri);
        uriToPrefix.put(iriString, 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 static Node createNode(String x)
    {
        try {
            IRI iri = resolver.resolve(x) ;
            return NodeFactory.createURI(iri.toString()) ;
        } catch (Exception ex)
        {
            errorBadRequest("SPARQL Update: bad IRI: "+x) ;
            return null ;
        }
View Full Code Here

                    if ( fieldName.equals(HttpNames.paramGraph) )
                    {
                        graphName = value ;
                        if ( graphName != null && ! graphName.equals(HttpNames.valueDefault) )
                        {
                            IRI iri = IRIResolver.parseIRI(value) ;
                            if ( iri.hasViolation(false) )
                                errorBadRequest("Bad IRI: "+graphName) ;
                            if ( iri.getScheme() == null )
                                errorBadRequest("Bad IRI: no IRI scheme name: "+graphName) ;
                            if ( iri.getScheme().equalsIgnoreCase("http") || iri.getScheme().equalsIgnoreCase("https"))
                            {
                                // Redundant??
                                if ( iri.getRawHost() == null )
                                    errorBadRequest("Bad IRI: no host name: "+graphName) ;
                                if ( iri.getRawPath() == null || iri.getRawPath().length() == 0 )
                                    errorBadRequest("Bad IRI: no path: "+graphName) ;
                                if ( iri.getRawPath().charAt(0) != '/' )
                                    errorBadRequest("Bad IRI: Path does not start '/': "+graphName) ;
                            }
                        }
                    }
                    else if ( fieldName.equals(HttpNames.paramDefaultGraphURI) )
View Full Code Here

    }

    /** Check an IRI string (does not resolve it) */
    public static boolean checkIRI(String iriStr)
    {
        IRI iri = parseIRI(iriStr);
        return iri.hasViolation(false) ;
    }
View Full Code Here

     */
    static public String resolveFileURL(String filename) throws IRIException
    {
        synchronized(globalResolverLock)
        {
            IRI r = globalResolver.resolve(filename);
            if (!r.getScheme().equalsIgnoreCase("file"))
            {
                // Pragmatic hack that copes with "c:"
                return resolveFileURL("./" + filename);
            }
            return r.toString();
        }
    }
View Full Code Here

     */
    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

        nextToken() ;
        if ( ! lookingAt(IRI) )
            exception(peekToken(), "@prefix requires an IRI (found '"+peekToken()+"')") ;
        String iriStr = peekToken().getImage() ;
        dest.prefix(prefix, iriStr) ;
        IRI iri = profile.makeIRI(iriStr, currLine, currCol) ;
        profile.getPrologue().getPrefixMap().add(prefix, iri) ;

        nextToken() ;
    }
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.