01 /*
02 * Copyright (c) 1995-2010, The University of Sheffield. See the file
03 * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
04 *
05 * This file is part of GATE (see http://gate.ac.uk/), and is free
06 * software, licenced under the GNU Library General Public License,
07 * Version 2, June 1991 (in the distribution as file licence.html,
08 * and also available at http://gate.ac.uk/gate/licence.html).
09 *
10 * Johann Petrak 2009-08-20
11 *
12 * $Id: OValue.java 12006 2009-12-01 17:24:28Z thomas_heitz $
13 */
14 package gate.creole.ontology;
15
16 /**
17 * A class representing something that is either a literal or a OResource.
18 * <p>
19 * Developer note: ideally this would be implemented as a superinteface
20 * of the Literal and OResource interfaces, but Literal is implemented
21 * as a class and has to remain a class for backwards compatibility.löschnaz
22 *
23 * @author Johann Petrak
24 */
25 // TODO: should we implement comparable and equals/hashcode for this?
26 public interface OValue {
27
28 /**
29 * Check if the object represents a literal.
30 *
31 * @return true if the object represents a literal value, false if it
32 * represents a blank node ID or an URI.
33 */
34 public boolean isLiteral();
35
36 /**
37 * Check if the object represents a OResource
38 *
39 * @return true if the object represents a OResource object
40 */
41 public boolean isOResource();
42
43 /**
44 * Get the {@link OResource} object if this object represents a resource. Throws a
45 * {@link GateOntologyException} if this object represents a literal.
46 *
47 * @return the OResource represented by this object
48 */
49 public OResource getOResource();
50
51 /**
52 * Get the {@link Literal} object if this object represents a literal.
53 * Throws a {@link GateOntologyException} if this object represents a
54 * node ID.
55 *
56 * @return the Literal represented by this object
57 */
58 public Literal getLiteral();
59 @Override
60 /**
61 * Create a String representation of the represented object.
62 *
63 */
64 public String toString();
65 /**
66 * Create a String representation that conforms to Turtle language syntax.
67 * If this represents a OResource it is identical to OResource.toString()
68 *
69 * @return a string representation of the node id or literal following
70 * Turtle syntax.
71 */
72 public String toTurtle();
73
74 @Override
75 public int hashCode();
76
77 @Override
78 public boolean equals(Object other);
79
80 }
|