commons/core/src/main/java/org/ldp4j/commons/net/URIRef.java
URI toURI() {
		StringBuilder builder=new StringBuilder();
		if(defined(this.scheme)) {
			builder.append(this.scheme);
			builder.append(":");
		}
		if(defined(this.authority)) {
			builder.append("//");
			builder.append(this.authority);
		}
		if(defined(this.path)) {
			builder.append(this.path);
		}
		if(defined(this.query)) {
			builder.append("?");
			builder.append(this.query);
		}
		if(defined(this.fragment)) {
			builder.append("#");
			builder.append(this.fragment);
		}
		String rawURI = builder.toString();
		return URI.create(rawURI);
	}
URI toURI() {
		StringBuilder builder=new StringBuilder();
		if(defined(this.scheme)) {
			builder.append(this.scheme);
			builder.append(":");
		}
		if(defined(this.authority)) {
			builder.append("//");
			builder.append(this.authority);
		}
		if(defined(this.path)) {
			builder.append(this.path);
		}
		if(defined(this.query)) {
			builder.append("?");
			builder.append(this.query);
		}
		if(defined(this.fragment)) {
			builder.append("#");
			builder.append(this.fragment);
		}
		String rawURI = builder.toString();
		return URI.create(rawURI);
	}
5.3.  Component Recomposition

Parsed URI components can be recomposed to obtain the corresponding
URI reference string.  Using pseudocode, this would be:

result = ""

if defined(scheme) then
append scheme to result;
append ":" to result;
endif;

if defined(authority) then
append "//" to result;
append authority to result;
endif;

append path to result;

if defined(query) then
append "?" to result;
append query to result;
endif;

if defined(fragment) then
append "#" to result;
append fragment to result;
endif;

return result;

Note that we are careful to preserve the distinction between a
component that is undefined, meaning that its separator was not
present in the reference, and a component that is empty, meaning that
the separator was present and was immediately followed by the next
component separator or the end of the reference.