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 java.io.Serializable;
09:
10: /**
11: * An RDF statement, with optional associated context. A statement can have an
12: * associated context in specific cases, for example when fetched from a
13: * repository. The context field does not influence statement equality; a
14: * statement is equal to another statement if the subjects, predicates and
15: * objects are equal.
16: */
17: public interface Statement extends Serializable {
18:
19: /**
20: * Gets the subject of this statement.
21: *
22: * @return The statement's subject.
23: */
24: public Resource getSubject();
25:
26: /**
27: * Gets the predicate of this statement.
28: *
29: * @return The statement's predicate.
30: */
31: public URI getPredicate();
32:
33: /**
34: * Gets the object of this statement.
35: *
36: * @return The statement's object.
37: */
38: public Value getObject();
39:
40: /**
41: * Gets the context of this statement.
42: *
43: * @return The statement's context, or <tt>null</tt> in case of the null
44: * context or if not applicable.
45: */
46: // FIXME should this return a set instead of a single context?
47: public Resource getContext();
48:
49: /**
50: * Compares a statement object to another object.
51: *
52: * @param other
53: * The object to compare this statement to.
54: * @return <tt>true</tt> if the other object is an instance of
55: * {@link Statement} and if their subjects, predicates and objects
56: * are equal.
57: */
58: public boolean equals(Object other);
59:
60: /**
61: * The hash code of a statement is defined as:
62: * <tt>961 * subject.hashCode() + 31 * predicate.hashCode() + object.hashCode()</tt>.
63: * This is similar to how {@link String#hashCode String.hashCode()} is
64: * defined.
65: *
66: * @return A hash code for the statement.
67: */
68: public int hashCode();
69: }
|