22 |
package nongnu.cashews.rdf; |
package nongnu.cashews.rdf; |
23 |
|
|
24 |
import java.net.URI; |
import java.net.URI; |
25 |
|
import java.net.URISyntaxException; |
26 |
|
|
27 |
/** |
/** |
28 |
* <p> |
* <p> |
44 |
*/ |
*/ |
45 |
private URI uri; |
private URI uri; |
46 |
|
|
47 |
|
/** |
48 |
|
* Constructs an <code>RDFURI</code> using the specified URI. |
49 |
|
* |
50 |
|
* @param uri the URI to use for this RDF URI. |
51 |
|
*/ |
52 |
|
public RDFURI(URI uri) |
53 |
|
{ |
54 |
|
this.uri = uri; |
55 |
|
} |
56 |
|
|
57 |
|
/** |
58 |
|
* Returns a textual representation of the RDF URI. |
59 |
|
* |
60 |
|
* @return a textual representation. |
61 |
|
*/ |
62 |
|
public String toString() |
63 |
|
{ |
64 |
|
return getClass().getName() + |
65 |
|
"[uri = " + |
66 |
|
uri + |
67 |
|
"]"; |
68 |
|
} |
69 |
|
|
70 |
|
/** |
71 |
|
* Returns a clone of the URI used by this RDF URI. |
72 |
|
* |
73 |
|
* @return a clone of the URI. |
74 |
|
*/ |
75 |
|
public URI getURI() |
76 |
|
{ |
77 |
|
try |
78 |
|
{ |
79 |
|
return new URI(uri.toString()); |
80 |
|
} |
81 |
|
catch (URISyntaxException e) |
82 |
|
{ |
83 |
|
throw new IllegalStateException("The URI is invalid.", e); |
84 |
|
} |
85 |
|
} |
86 |
|
|
87 |
} |
} |