Package org.apache.jena.iri

Examples of org.apache.jena.iri.IRI


            String prefix = peekToken().getImage() ;
            nextToken() ;
            if ( ! lookingAt(IRI) )
                exception(peekToken(), "@prefix requires an IRI (found '"+peekToken()+"')") ;
            String iriStr = peekToken().getImage() ;
            IRI iri = profile.makeIRI(iriStr, currLine, currCol) ;
            profile.getPrologue().getPrefixMap().add(prefix, iri) ;
            nextToken() ;
            expect("PREFIX directive not terminated by a dot", DOT) ;
        }
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

   * @param str The fully expanded URI
   */
  protected void checkIdSymbol(Taint taintMe, AbsXMLContext ctxt, String str)
    throws SAXParseException {
    if (arp.idsUsed != null) {
      IRI uri = ctxt.uri;
            Map<String,ARPLocation> idsUsedForBase = idsUsed().get(uri);
      if (idsUsedForBase == null) {
        idsUsedForBase = new HashMap<String, ARPLocation>();
        idsUsed().put(uri, idsUsedForBase);
      }
View Full Code Here

    public XMLHandler getXMLHandler() {
        return arp;
    }

    protected String resolve(Taint taintMe,AbsXMLContext x, String uri) throws SAXParseException {
        IRI ref = x.resolveAsURI(arp,taintMe,uri);
//        checkBadURI(taintMe,ref);
        return ref.toString();
    }
View Full Code Here

    /** Add a prefix, overwrites any existing association */
    public void add(String prefix, String iriString)
    {
        prefix = canonicalPrefix(prefix) ;
        IRI iri = IRIFactory.iriImplementation().create(iriString) ;
        // Check!
        prefixes.put(prefix, iri);
    }
View Full Code Here

   
    /** Expand a prefix, return null if it can't be expanded */
    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

        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

    }

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

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.