Package org.apache.jena.iri

Examples of org.apache.jena.iri.IRI


    static public IRI chooseBaseURI() {
        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

    static private int relFlags = IRIRelativize.SAMEDOCUMENT | IRIRelativize.CHILD ;

    /** Abbreviate the URI */
    private String abbrevByBase(String uri) {
        IRI rel = iriResolver.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

    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

    private static void addPrefixes(Map<String, Object> ctx, PrefixMap prefixMap) {
        Map<String, IRI> pmap = prefixMap.getMapping() ;
        for ( Entry<String, IRI> e : pmap.entrySet() ) {
            String key = e.getKey() ;
            IRI iri = e.getValue() ;
            if ( key.trim().length() == 0 ) {
                if ( iri != null ) {
                    // set default URI prefix
                    ctx.put("@base", e.getValue().toString()) ;
                    ctx.put("", e.getValue().toString());
View Full Code Here

        if ( cmdLine.contains(argNoSkip) )
            skipOnBadTerm = false ;

        if ( cmdLine.contains(argBase) ) {
            baseIRI = cmdLine.getValue(argBase) ;
            IRI iri = IRIResolver.resolveIRI(baseIRI) ;
            if ( iri.hasViolation(false) )
                throw new CmdException("Bad base IRI: " + baseIRI) ;
            if ( !iri.isAbsolute() )
                throw new CmdException("Base IRI must be an absolute IRI: " + baseIRI) ;
        }

        if ( cmdLine.contains(argStop) )
            stopOnBadTerm = true ;
View Full Code Here

        // Simple literal or xsd:string
        String str = simpleLiteralOrXSDString(nv) ;
        if ( str == null )
            throw new ExprEvalException("Can't make an IRI from " + nv) ;

        IRI iri = null ;
        String iriStr = nv.getLiteralLexicalForm() ;

        // Level of checking?
        if ( baseIRI != null ) {
            IRI base = iriFactory.create(baseIRI) ;
            iri = base.create(iriStr) ;
        } else
            iri = iriFactory.create(iriStr) ;

        if ( !iri.isAbsolute() )
            throw new ExprEvalException("Relative IRI string: " + iriStr) ;
View Full Code Here

   
    static public String abbrevByBase(String uri, String base)
    {
        if ( hasScheme(uri) )
            return uri ;
        IRI baseIRI = IRIFactory.jenaImplementation().construct(base) ;
        IRI rel = baseIRI.relativize(uri, relFlags) ;
        String r = rel.toString() ;
        return r ;
    }
View Full Code Here

   *
   * @param filename
   * @return String The filename as an absolute URL
   */
  static public String resolveFileURL(String filename) throws IRIException {
    IRI r = cwd.resolve(filename);
    if (!r.getScheme().equalsIgnoreCase("file")) {
      return resolveFileURL("./" + filename);
    }
    return r.toString();
  }
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.