Code example for URI

Methods: isAbsolute, toASCIIString

0
			// relative is an empty sequence, the empty sequence is returned 
			if( relative.length() == 0 )
				return relative;
 
			try { 
				relativeURI = new URI( relative );
 
				// If relative is absolute it is returned unchanged 
				if( relativeURI.isAbsolute() )
					return relative;
			} catch( URISyntaxException e ) {
				throw new InternalReasonerException( "Relative URI reference is not a valid URI" ); 
			} 
 
			try { 
				baseURI = new URI( base );
 
			} catch( URISyntaxException e ) {
				throw new InternalReasonerException( "Base URI reference is not a valid URI" ); 
			} 
 
			if( relativeURI == null )
				throw new InternalReasonerException( "Error in resolving relative URI" ); 
			if( baseURI == null )
				throw new InternalReasonerException( "Error in resolving base URI" ); 
 
			try { 
				URI ret = new URI( baseURI.toASCIIString() + relativeURI.toASCIIString() );
 
				return ret.toASCIIString();
			} catch( URISyntaxException e ) {
				throw new InternalReasonerException( 
						"Evaluation of base and relative URI is not a URI" );