Package com.hp.hpl.jena.iri

Examples of com.hp.hpl.jena.iri.IRI


        boolean first = true ;
       
        for ( Entry<String, IRI> e : prefixes.entrySet())
        {
            String prefix = e.getKey() ;
            IRI iri = e.getValue() ;
            if ( first )
                first = false ;
            else
                sb.append(" ,") ;
            sb.append(prefix) ;
            sb.append(":=") ;
            sb.append(iri.toString()) ;
        }
        sb.append(" }") ;
        return sb.toString() ;
    }
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

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

    IRI base = factory.create(baseStr);

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

        if (uri == null || uri.equals(""))
            localName = "";
        else
//            try
        {
                IRI u = BaseXMLWriter.factory.create(uri);
                u = u.create("");
                localName = u.toString();
            }
//        catch (MalformedURIException e) {
//                throw new BadURIException(uri, e);
//            }
    }
View Full Code Here

    private void checkNamespaceURI(String uri) throws SAXParseException {
        ((Frame) frame).checkEncoding(null,uri);
        if (uri.length() != 0)
             {
                IRI u = iriFactory().create(uri);
//                if (u.isVeryBad()) {
//                    warning(null,
//                            WARN_BAD_NAMESPACE_URI,
//                            "The namespace URI: <"
//                                    + uri
//                                    + "> is not well formed.");
//                    return;
//                
//                }
                if (!u.isAbsolute()) {
                    warning(null,
                            WARN_RELATIVE_NAMESPACE_URI_DEPRECATED,
                            "The namespace URI: <"
                                    + uri
                                    + "> is relative. Such use has been deprecated by the W3C, and may result in RDF interoperability failures. Use an absolute namespace URI.");
                }
                try {
                    if (!u.toASCIIString().equals(u.toString()))
                        warning(null,
                                WARN_BAD_NAMESPACE_URI,
                                "Non-ascii characters in a namespace URI may not be completely portable: <"
                                        + u.toString()
                                        + ">. Resulting RDF URI references are legal.");
                } catch (MalformedURLException e) {
                    warning(null,
                            WARN_BAD_NAMESPACE_URI,
                            "toAscii failed for namespace URI: <"
                                    + u.toString()
                                    + ">. " + e.getMessage());
              }

                if (uri.startsWith(rdfns) && !uri.equals(rdfns))
                    warning(null,WARN_BAD_RDF_NAMESPACE_URI, "Namespace URI ref <"
View Full Code Here

     */
    public static URIReference resolve(Frame f, AbsXMLContext ctxt, String uri)
            throws SAXParseException {

        Taint taintMe = new TaintImpl();
        IRI iri = ctxt.resolveAsURI(f.arp,taintMe,uri);
        f.checkEncoding(taintMe,uri);

        URIReference rslt = new URIReference(iri.toString());
        if (taintMe.isTainted())
            rslt.taint();
        return rslt;
    }
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

        }
    }

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

TOP

Related Classes of com.hp.hpl.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.