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: LiteralOrONodeID.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 node ID.
18 *
19 * @author Johann Petrak
20 */
21 // TODO: should we implement comparable and equals/hashcode for this?
22 public interface LiteralOrONodeID {
23
24 /**
25 * Check if the object represents a literal.
26 *
27 * @return true if the object represents a literal value, false if it
28 * represents a blank node ID or an URI.
29 */
30 public boolean isLiteral();
31
32 /**
33 * Check if the object represents a node ID.
34 *
35 * @return true if the object represents a blank node id or an URI, false
36 * if it represents a literal.
37 */
38 public boolean isONodeID();
39
40 /**
41 * Get the {@link ONodeID} object if this object represents a node ID. Throws a
42 * {@link GateOntologyException} if this object represents a literal.
43 *
44 * @return the ONodeID represented by this object
45 */
46 public ONodeID getONodeID();
47
48 /**
49 * Get the {@link Literal} object if this object represents a literal.
50 * Throws a {@link GateOntologyException} if this object represents a
51 * node ID.
52 *
53 * @return the Literal represented by this object
54 */
55 public Literal getLiteral();
56 @Override
57 /**
58 * Create a String representation of the represented object.
59 *
60 */
61 public String toString();
62 /**
63 * Create a String representation that conforms to Turtle language syntax.
64 *
65 * @return a string representation of the node id or literal following
66 * Turtle syntax.
67 */
68 public String toTurtle();
69
70 @Override
71 public int hashCode();
72
73 @Override
74 public boolean equals(Object other);
75
76 }
|