1   package ixa.kaflib;
2   
3   /**
4    * Linked Entity in the text.
5    */
6   public class SSTspan {
7   
8   	/**
9   	 * LinkedEntity's ID (required)
10  	 */
11  	private String sstID;
12  
13  	/**
14  	 * LinedEntity's properties
15  	 */
16  	private String type;
17  	private String label;
18  
19  	/**
20  	 * Mentions to the same entity (at least one required)
21  	 */
22  	private Span<Term> mentions;
23  
24  	SSTspan(String linkedEntityId) {
25  		this.sstID= linkedEntityId;
26  		this.mentions = new Span<Term>();
27  	}
28  
29  	SSTspan(String sstSpan, Span<Term> mentions) {
30  		if (mentions.size() < 1) {
31  			throw new IllegalStateException("SSTspan must contain at least one reference span");
32  		}
33  		this.sstID = sstSpan;
34  		this.mentions = mentions;
35  	}
36  
37  	public String getType() {
38  		return type;
39  	}
40  
41  	public void setType(String type) {
42  		this.type = type;
43  	}
44  
45  	public String getLabel() {
46  		return label;
47  	}
48  
49  	public void setLabel(String label) {
50  		this.label = label;
51  	}
52  
53  	public String getId() {
54  		return sstID;
55  	}
56  
57  	void setId(String id) {
58  		this.sstID = id;
59  	}
60  
61  	public String getSpanStr() {
62  		String str = "";
63  		for (Term term : mentions.getTargets()) {
64  			if (!str.isEmpty()) {
65  				str += " ";
66  			}
67  			str += term.getForm();
68  		}
69  		return str;
70  	}
71  
72  
73  	/**
74  	 * Returns the term targets of the first span. When targets of other spans are needed getReferences() method should be used.
75  	 */
76  	public Span<Term> getTerms() {
77  		return mentions;
78  //		if (this.mentions.size() > 0) {
79  //			return this.mentions.get(0).getTargets();
80  //		}
81  //		else {
82  //			return null;
83  //		}
84  	}
85  
86  }