1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.apache.commons.rdf.api;
19
20 /**
21 * A generalised "triple-like" interface, extended by {@link Triple} and
22 * {@link Quad}.
23 * <p>
24 * A TripleLike statement has at least a {@link #getSubject()},
25 * {@link #getPredicate()} and {@link #getObject()}, but unlike a {@link Triple}
26 * does not have a formalised {@link Triple#equals(Object)} or
27 * {@link Triple#hashCode()} semantics and is not required to be
28 * <em>immutable</em> or <em>thread-safe</em>. This interfaced can also be used
29 * for <em>generalised triples</em> (e.g. a {@link BlankNode} as predicate).
30 * <p>
31 * Implementations should specialise which specific {@link RDFTerm} types they
32 * return by overriding {@link #getSubject()}, {@link #getPredicate()} and
33 * {@link #getObject()}.
34 *
35 *
36 * @since 0.3.0-incubating
37 * @see Triple
38 * @see Quad
39 * @see QuadLike
40 */
41 public interface TripleLike {
42
43 /**
44 * The subject of this statement.
45 *
46 * @return The subject, typically an {@link IRI} or {@link BlankNode}.
47 */
48 RDFTerm getSubject();
49
50 /**
51 * The predicate of this statement.
52 *
53 * @return The predicate, typically an {@link IRI}.
54 */
55 RDFTerm getPredicate();
56
57 /**
58 * The object of this statement.
59 *
60 * @return The object, typically an {@link IRI}, {@link BlankNode} or
61 * {@link Literal}.
62 */
63 RDFTerm getObject();
64 }