01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.model;
07:
08: import org.openrdf.model.util.URIUtil;
09:
10: /**
11: * A URI. A URI consists of a namespace and a local name, which are derived from
12: * a URI string by splitting it in two using the following algorithm:
13: * <ul>
14: * <li>Split after the first occurrence of the '#' character,
15: * <li>If this fails, split after the last occurrence of the '/' character,
16: * <li>If this fails, split after the last occurrence of the ':' character.
17: * </ul>
18: * The last step should never fail as every legal (full) URI contains at least
19: * one ':' character to seperate the scheme from the rest of the URI. The
20: * implementation should check this upon object creation.
21: *
22: * @see URIUtil#getLocalNameIndex(String)
23: */
24: public interface URI extends Resource {
25:
26: /**
27: * Returns the String-representation of this URI.
28: *
29: * @return The String-representation of this URI.
30: */
31: public String toString();
32:
33: /**
34: * Gets the namespace of this URI. The namespace is defined as per the
35: * algorithm described in the class documentation.
36: *
37: * @return The URI's namespace.
38: */
39: public String getNamespace();
40:
41: /**
42: * Gets the local name of this URI. The local name is defined as per the
43: * algorithm described in the class documentation.
44: *
45: * @return The URI's local name.
46: */
47: public String getLocalName();
48:
49: /**
50: * Compares a URI object to another object.
51: *
52: * @param o
53: * The object to compare this URI to.
54: * @return <tt>true</tt> if the other object is an instance of {@link URI}
55: * and their String-representations are equal, <tt>false</tt>
56: * otherwise.
57: */
58: public boolean equals(Object o);
59:
60: /**
61: * The hash code of a URI is defined as the hash code of its
62: * String-representation: <tt>toString().hashCode</tt>.
63: *
64: * @return A hash code for the URI.
65: */
66: public int hashCode();
67: }
|