
io.redlink.sdk.impl.analysis.model.TextAnnotation Maven / Gradle / Ivy
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.redlink.sdk.impl.analysis.model;
/**
* Text annotation, selects pieces of parsed textual content by using the following properties
*
* @author [email protected]
* @author [email protected]
* @see FISE Text Annotation
*/
public final class TextAnnotation extends Enhancement {
// properties
private int starts = 0; // http://fise.iks-project.eu/ontology/start
private int ends = 0; // http://fise.iks-project.eu/ontology/end
private String selectedText = null; // http://fise.iks-project.eu/ontology/selected-text
private String selectionContext = null; // http://fise.iks-project.eu/ontology/selection-context
private String type = null; // ttp://purl.org/dc/terms/type
public TextAnnotation() {
super();
}
/**
* Returns the position of the text where the annotation starts
*
* @return
*/
public int getStarts() {
return starts;
}
void setStarts(int starts) {
this.starts = starts;
}
/**
* Returns the position of the text where the annotation ends
*
* @return
*/
public int getEnds() {
return ends;
}
void setEnds(int ends) {
this.ends = ends;
}
/**
* Returns the matched/extracted piece of text from the analyzed content
*
* @return
*/
public String getSelectedText() {
return selectedText;
}
void setSelectedText(String selectedText) {
this.selectedText = selectedText;
}
/**
* Returns a surrounding context of the matched text
*
* @return
*/
public String getSelectionContext() {
return selectionContext;
}
void setSelectionContext(String selectionContext) {
this.selectionContext = selectionContext;
}
/**
* Returns the type of the entity annotation
*
* @return
*/
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ends;
result = prime * result + starts;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TextAnnotation other = (TextAnnotation) obj;
if (ends != other.ends)
return false;
if (starts != other.starts)
return false;
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy