Class IRIs


  • public class IRIs
    extends java.lang.Object
    Operations in support of IRIx.
    • Constructor Summary

      Constructors 
      Constructor Description
      IRIs()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static IRIxResolver absoluteResolver()
      Return a resolver that does not resolve, and have a base and does not allow relative URIs.
      static boolean check​(java.lang.String iriStr)
      Check a string is valid syntax for an IRI (absolute or relative)
      static java.lang.String checkEx​(java.lang.String iriStr)
      Check a string is valid syntax for an IRI, is an absolute IRI (resolve if necessary) and normalize (e.g.
      static java.lang.String getBaseStr()
      The system base IRI as a string.
      static IRIx getSystemBase()
      The system base IRIx.
      static IRIx reference​(java.lang.String iriStr)
      Operation to take a string and make an IRIx.
      static IRIxResolver relativeResolver()
      Return a resolver that does not resolve relative URIs, with the current system base as its base IRI
      static java.lang.String resolve​(java.lang.String iriStr)
      Resolve a URI against the system base.
      static java.lang.String resolve​(java.lang.String baseStr, java.lang.String iriStr)
      Resolve a URI against a base.
      static java.lang.String resolve​(IRIx base, java.lang.String iriStr)
      Resolve a URI against a base.
      static java.lang.String resolve​(IRIx base, IRIx iri)
      Resolve a URI against a base.
      static IRIx resolveIRI​(java.lang.String iriStr)
      Resolve a URI against the system base.
      static IRIxResolver resolver​(java.lang.String base)
      Return a general purpose resolver, with the current system base as its base IRI.
      static IRIxResolver resolver​(IRIx base)
      Return a general purpose resolver, with the supplied IRI its base.
      static java.lang.String scheme​(java.lang.String str)
      Get the URI scheme at the start of the string.
      static IRIxResolver stdResolver()
      Return a general purpose resolver, with the current system base as its base IRI.
      static java.lang.String toBase​(java.lang.String baseURI)
      Given a candidate baseURI string, which may be a filename, turn it into a IRI suitable as a base IRI.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IRIs

        public IRIs()
    • Method Detail

      • reference

        public static IRIx reference​(java.lang.String iriStr)
        Operation to take a string and make an IRIx. This operation does not resolve the string against a base.

        Use this function if the application has been given an URI and wants to be sure it is valid for use in RDF.

        Use resolve(java.lang.String) to resolve a potentially relative URI against the current system base.

      • check

        public static boolean check​(java.lang.String iriStr)
        Check a string is valid syntax for an IRI (absolute or relative)
      • checkEx

        public static java.lang.String checkEx​(java.lang.String iriStr)
        Check a string is valid syntax for an IRI, is an absolute IRI (resolve if necessary) and normalize (e.g. remove "./.." and "/../").
      • getSystemBase

        public static IRIx getSystemBase()
        The system base IRIx.
      • getBaseStr

        public static java.lang.String getBaseStr()
        The system base IRI as a string.
      • toBase

        public static java.lang.String toBase​(java.lang.String baseURI)
        Given a candidate baseURI string, which may be a filename, turn it into a IRI suitable as a base IRI.
      • stdResolver

        public static IRIxResolver stdResolver()
        Return a general purpose resolver, with the current system base as its base IRI.
      • resolver

        public static IRIxResolver resolver​(java.lang.String base)
        Return a general purpose resolver, with the current system base as its base IRI.
      • resolver

        public static IRIxResolver resolver​(IRIx base)
        Return a general purpose resolver, with the supplied IRI its base.
      • absoluteResolver

        public static IRIxResolver absoluteResolver()
        Return a resolver that does not resolve, and have a base and does not allow relative URIs.
      • relativeResolver

        public static IRIxResolver relativeResolver()
        Return a resolver that does not resolve relative URIs, with the current system base as its base IRI
      • resolve

        public static java.lang.String resolve​(java.lang.String iriStr)
        Resolve a URI against the system base.
      • resolveIRI

        public static IRIx resolveIRI​(java.lang.String iriStr)
        Resolve a URI against the system base.
      • resolve

        public static java.lang.String resolve​(IRIx base,
                                               java.lang.String iriStr)
        Resolve a URI against a base.
      • resolve

        public static java.lang.String resolve​(IRIx base,
                                               IRIx iri)
        Resolve a URI against a base.
      • resolve

        public static java.lang.String resolve​(java.lang.String baseStr,
                                               java.lang.String iriStr)
        Resolve a URI against a base. The base must be an absolute IRI.
      • scheme

        public static java.lang.String scheme​(java.lang.String str)
        Get the URI scheme at the start of the string. This is the substring up to, and excluding, the first ":" if it conforms to the syntax requirements. Return null if it does not look like a scheme.

        The RFC 3986 URI grammar defines scheme as:

         URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
         scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
         ...