4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator Class Reference

Methods for translating output from SEC API to the Suggestion objects. More...

Collaboration diagram for cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator:
Collaboration graph

Classes

class  TranslateAlternativeHolder
 The object that hold informations ipmortant for translate of alternative from SEC Api. More...
 

Public Member Functions

 SECAPISuggestionTranslator (UserGroup userGroup)
 
ArrayList< AlternativetranslateAlternativeFromSecApi (RequestInfo requestInfo, String SECAPIResults, ArrayList< AnnotType > newTypes, ArrayList< Suggestion > validSuggestions)
 
ArrayList< SuggestiontranslateSugFromSecApi (RequestInfo requestInfo, String SECAPIResults, ArrayList< AnnotType > newTypes)
 
AnnotType findType (RequestInfo requestInfo, ArrayList< AnnotType > newTypes, String typePath)
 

Static Public Member Functions

static void linearizeSuggestions (HashMap< Integer, ArrayList< SuggestionFragment >> linFragmentsMap, Document doc, ArrayList< Suggestion > suggestions)
 

Static Public Attributes

static final String STRING_ATT_VALUES_SEPARATOR = ", "
 
static final String TEXT_ATT_VALUES_SEPARATOR = " \n"
 
static final String MODULE_NAME = "SECAPISuggestionTranslator"
 
static final String LATITUDE_NAME = "latitude"
 
static final String LONGITUDE_NAME = "longitude"
 
static final int DEFAULT_SUGGESTION_CONFIDENCE = 50
 

Package Attributes

UserGroup userGroup
 
UserGroup defaultUserGroup
 
String baseTypeUri
 
HashMap< String, AnnotTypetypesBuffer
 

Private Member Functions

Alternative processNestedAlternative (Element atEl, RequestInfo requestInfo, ArrayList< AnnotType > newTypes)
 
ArrayList< AlternativeprocessAlternatives (RequestInfo requestInfo, Element alternatvesEl, ArrayList< AnnotType > newTypes, AlternativeFragment altFragment)
 
ArrayList< AlternativemakeNewAlternative (RequestInfo requestInfo, HashMap< Integer, ArrayList< SuggestionFragment >> sugToLinFragments, HashMap< Integer, TranslateAlternativeHolder > alternativesHolders)
 
void findAlternativeSuggestions (HashMap< Integer, TranslateAlternativeHolder > alternatives, ArrayList< Suggestion > validSuggestions, HashMap< Integer, ArrayList< SuggestionFragment >> sugToLinFragments)
 
boolean isAlternativeInSuggestionList (List< Suggestion > suggestions, Alternative alt, HashMap< Integer, ArrayList< SuggestionFragment >> sugToLinFragments)
 
AlternativeFragment fixAlternativeFragment (RequestInfo requestInfo, AlternativeFragment frg)
 
Suggestion processNestedSugg (Element attEl, RequestInfo requestInfo, ArrayList< AnnotType > newTypes)
 
ArrayList convertLinFragments (RequestInfo requestInfo, ArrayList result, ArrayList allLinFragments, boolean useAlternatives)
 
SecSuggestion createSugFromElement (RequestInfo requestInfo, Element el, ArrayList< AnnotType > newTypes, boolean useAlternatives)
 
SecAttribute processAttributeEl (RequestInfo requestInfo, Element atEl, ArrayList sugAList, HashMap< String, Integer >atPriorities, HashMap< String, Integer >usedPriorities, int pGen, ArrayList< AnnotTypeAttr > atList, boolean useAlternatives, SecSuggestion sug, ArrayList< AnnotType > newTypes)
 

Static Private Member Functions

static AlternativeFragment processAlternativeFragment (Element fragmentEl)
 
static HashMap< String, Integer > getPriorities (String name)
 
static ArrayList
< SugEntityAdditionalAttribute
processSugEntityAddAttributes (Element el, SugEntityAttribute refEntity)
 
static ArrayList
< AltEntityAdditionalAttribute
processAltEntityAddAttributes (Element el, AlternativeAttribute refAltAtt)
 
static String processGeoPoint (Element el, boolean latitude)
 
static String getGeoPointNodeValue (Node node)
 
static Document parseXml (String XMLString)
 
static Date parseDate (String sDate)
 

Detailed Description

Methods for translating output from SEC API to the Suggestion objects.

Class provides methods for translating of suggestions from SEC API to the objects of class Suggestion.

Author
idytrych

Definition at line 53 of file SECAPISuggestionTranslator.java.

Constructor & Destructor Documentation

cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.SECAPISuggestionTranslator ( UserGroup  userGroup)

Set default userGroup.

Parameters
userGroupUser group.

Definition at line 86 of file SECAPISuggestionTranslator.java.

Member Function Documentation

ArrayList cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.convertLinFragments ( RequestInfo  requestInfo,
ArrayList  result,
ArrayList  allLinFragments,
boolean  useAlternatives 
)
private

Converts linearized fragments to common fragments

Parameters
requestInfoInformations about client request
resultList with suggestions or alternatives to which fragments belongs
allLinFragmentsList of all linearized fragments to convert
useAlternativesTrue for work with alternatives, false otherwise
Returns
Returns list with suggestions or alternatives to which fragments belongs with converted fragments

Definition at line 855 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

SecSuggestion cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.createSugFromElement ( RequestInfo  requestInfo,
Element  el,
ArrayList< AnnotType newTypes,
boolean  useAlternatives 
)
private

Creates suggestion object from XML element with suggestion

Parameters
requestInfoInformations about client request
elXML element with suggestion
newTypesArray for adding new types of annotations
useAlternativesTrue for work with alternatives, false otherwise
Returns
Object with suggestion

Definition at line 963 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

void cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.findAlternativeSuggestions ( HashMap< Integer, TranslateAlternativeHolder alternatives,
ArrayList< Suggestion validSuggestions,
HashMap< Integer, ArrayList< SuggestionFragment >>  sugToLinFragments 
)
private

Finds suggestions for which were alternatives sent and adds alternatives from DB.

Parameters
alternativesAlternatives from SEC API
validSuggestionsAlternatives is assign to one of these suggestions
sugToLinFragmentsLinearized fragments of given valid suggestions

Definition at line 450 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

AnnotType cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.findType ( RequestInfo  requestInfo,
ArrayList< AnnotType newTypes,
String  typePath 
)

Searches for a type specified by the typePath and returns the type if found

Parameters
requestInfoInformation about a client request
newTypesA list containing newly created types
typePathA path for the type identification
Returns
Type data if found, empty data object otherwise

Definition at line 1776 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

AlternativeFragment cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.fixAlternativeFragment ( RequestInfo  requestInfo,
AlternativeFragment  frg 
)
private

Converts linearized fragment to normal fragment

Parameters
requestInfoInformations about client request
frgLinearized fragment to convert
Returns
Returns converted fragment

Definition at line 565 of file SECAPISuggestionTranslator.java.

static String cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.getGeoPointNodeValue ( Node  node)
staticprivate

Returns node value of node with GeoPoint

Returns
Returns node value

Definition at line 1677 of file SECAPISuggestionTranslator.java.

Here is the caller graph for this function:

static HashMap<String, Integer> cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.getPriorities ( String  name)
staticprivate

Gets map with priorities of attributes of given type

Parameters
nameName of type
Returns
Returns map with priorities of attributes of given type

Definition at line 1200 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

boolean cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.isAlternativeInSuggestionList ( List< Suggestion suggestions,
Alternative  alt,
HashMap< Integer, ArrayList< SuggestionFragment >>  sugToLinFragments 
)
private

Check, if alternative is in suggestion list.

Parameters
suggestionsSuggestion list.
altAlternative.
sugToLinFragmentsHashMap with linearized fragments
Returns
Check, if alternative is in suggestion list.

Definition at line 547 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

static void cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.linearizeSuggestions ( HashMap< Integer, ArrayList< SuggestionFragment >>  linFragmentsMap,
Document  doc,
ArrayList< Suggestion suggestions 
)
static

Linearize fragments of given suggestions and return fragments as hash map where key is id of suggestion.

Parameters
linFragmentsMaphash map where the result will be stored
docannotated document
suggestionssuggestion which fragments will be linearize

Definition at line 505 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

ArrayList<Alternative> cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.makeNewAlternative ( RequestInfo  requestInfo,
HashMap< Integer, ArrayList< SuggestionFragment >>  sugToLinFragments,
HashMap< Integer, TranslateAlternativeHolder alternativesHolders 
)
private

Method creates new alternatives from SEC API message for given suggestions.

Parameters
requestInfoInformations about client request
sugToLinFragmentsLinearized fragments of given suggestions
alternativesHoldersnew alternatives and alternatives from DB
Returns
array of new alternatives

Definition at line 316 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

static Date cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.parseDate ( String  sDate)
staticprivate

Parses date from ISO format from dates.py (which is part of SEC API NER)

Parameters
sDateString with date
Returns
Returns parsed date

Definition at line 1732 of file SECAPISuggestionTranslator.java.

Here is the caller graph for this function:

static Document cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.parseXml ( String  XMLString)
staticprivate

Parses XML from the SEC API

Parameters
XMLStringString with XML with messages from client
Returns
Parsed XML in w3c.dom.Document

Definition at line 1693 of file SECAPISuggestionTranslator.java.

Here is the caller graph for this function:

static ArrayList<AltEntityAdditionalAttribute> cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.processAltEntityAddAttributes ( Element  el,
AlternativeAttribute  refAltAtt 
)
staticprivate

Processes element with entity additional attributes in entity in attribute of alternative

Parameters
elElement with entity additional attributes
refAltAttAttribute of alternative of type entity to which attributes belongs
Returns
List of entity additional attributes

Definition at line 1612 of file SECAPISuggestionTranslator.java.

Here is the caller graph for this function:

static AlternativeFragment cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.processAlternativeFragment ( Element  fragmentEl)
staticprivate

Method converts the raw format of alternatives fragments from SEC Api to array of objects.

Parameters
fragmentElElement with alternatives fragments from SEC Api in raw format
Returns
array of alternatives fragments from SEC Api

Definition at line 284 of file SECAPISuggestionTranslator.java.

Here is the caller graph for this function:

ArrayList<Alternative> cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.processAlternatives ( RequestInfo  requestInfo,
Element  alternatvesEl,
ArrayList< AnnotType newTypes,
AlternativeFragment  altFragment 
)
private

Method converts the raw format of alternatives from SEC Api to array of objects.

Parameters
requestInfoInformations about client request
alternatvesElElement with alternatives from SEC Api in raw format
newTypesArray for adding new types of annotations
altFragmentFragment that is assigned to all created alternatives
Returns
array of alternatives from SEC Api

Definition at line 243 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

SecAttribute cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.processAttributeEl ( RequestInfo  requestInfo,
Element  atEl,
ArrayList  sugAList,
HashMap< String, Integer >  atPriorities,
HashMap< String, Integer >  usedPriorities,
int  pGen,
ArrayList< AnnotTypeAttr atList,
boolean  useAlternatives,
SecSuggestion  sug,
ArrayList< AnnotType newTypes 
)
private

Creates suggestion object from XML element with attribute

Parameters
requestInfoInformations about client request
sugAListList of already processed attributes (for searching of duplicities)
atElXML element with attribute
atPrioritiesArray with priorities of attributes
usedPrioritiesArray with priorities which was already used
pGenCounter for generating of missing priorities
atListList of attributes for creation of type of annotation
useAlternativesTrue for work with alternatives, false otherwise
sugSuggestion to which this attribute will be added
newTypesNew annotation types
Returns
Object with attribute

Definition at line 1230 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

static String cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.processGeoPoint ( Element  el,
boolean  latitude 
)
staticprivate

Gets GeoPoint value from element

Parameters
elGeoPoint element
latitudeFlag for getting either latitude or longitude
Returns
If flag parameter is set to true, returns latitude value, longitude otherwise

Definition at line 1641 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

Alternative cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.processNestedAlternative ( Element  atEl,
RequestInfo  requestInfo,
ArrayList< AnnotType newTypes 
)
private

Method that process nested alternatives

Note: It's called recursively

Parameters
atElAttribute element
requestInfoRequestInfo
newTypesNew Annotations types
Returns
Nested alternative

Definition at line 176 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

Suggestion cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.processNestedSugg ( Element  attEl,
RequestInfo  requestInfo,
ArrayList< AnnotType newTypes 
)
private

Method that process nested suggestions

Note: It's called recursively

Parameters
attElAttribute element
requestInfoRequestInfo
newTypesNew Annotations types
Returns
Nested suggestion

Definition at line 782 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Here is the caller graph for this function:

static ArrayList<SugEntityAdditionalAttribute> cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.processSugEntityAddAttributes ( Element  el,
SugEntityAttribute  refEntity 
)
staticprivate

Processes element with entity additional attributes in entity in attribute of suggestion

Parameters
elElement with entity additional attributes
refEntityAttribute of suggestion of type entity to which attributes belongs
Returns
List of entity additional attributes

Definition at line 1582 of file SECAPISuggestionTranslator.java.

Here is the caller graph for this function:

ArrayList<Alternative> cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.translateAlternativeFromSecApi ( RequestInfo  requestInfo,
String  SECAPIResults,
ArrayList< AnnotType newTypes,
ArrayList< Suggestion validSuggestions 
)

Gets alternatives from SEC API and translates them to the Suugestion objects.

Parameters
requestInfoInformations about client request
SECAPIResultsResults from SEC API in String
newTypesArray for adding new types of annotations
validSuggestionsAlternatives is assign to one of theese suggestions
Returns
Resutns alternatives for the document

Definition at line 100 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

ArrayList<Suggestion> cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.translateSugFromSecApi ( RequestInfo  requestInfo,
String  SECAPIResults,
ArrayList< AnnotType newTypes 
)

Gets suggestions from SEC API and translates them to the Suugestion objects.

Parameters
requestInfoInformations about client request
SECAPIResultsResults from SEC API in String
newTypesArray for adding new types of annotations
Returns
Resutns suggestions for the document

Definition at line 613 of file SECAPISuggestionTranslator.java.

Here is the call graph for this function:

Member Data Documentation

String cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.baseTypeUri
package

Base URI for type of annotation.

Definition at line 76 of file SECAPISuggestionTranslator.java.

final int cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.DEFAULT_SUGGESTION_CONFIDENCE = 50
static

Definition at line 68 of file SECAPISuggestionTranslator.java.

UserGroup cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.defaultUserGroup
package

Default user group.

Definition at line 74 of file SECAPISuggestionTranslator.java.

final String cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.LATITUDE_NAME = "latitude"
static

Default name of attribute with latitude from SEC API

Definition at line 63 of file SECAPISuggestionTranslator.java.

final String cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.LONGITUDE_NAME = "longitude"
static

Default name of attribute with longitude from SEC API

Definition at line 65 of file SECAPISuggestionTranslator.java.

final String cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.MODULE_NAME = "SECAPISuggestionTranslator"
static

Name of this module

Definition at line 60 of file SECAPISuggestionTranslator.java.

final String cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.STRING_ATT_VALUES_SEPARATOR = ", "
static

Separator of String values if they should be concatenated into one String attribute

Definition at line 56 of file SECAPISuggestionTranslator.java.

final String cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.TEXT_ATT_VALUES_SEPARATOR = " \n"
static

Separator of Text values if they should be concatenated into one Text attribute

Definition at line 58 of file SECAPISuggestionTranslator.java.

HashMap<String,AnnotType> cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.typesBuffer
package

Cache for types of annotations

Definition at line 79 of file SECAPISuggestionTranslator.java.

UserGroup cz.vutbr.fit.knot.annotations.modules.suggestionManager.SECAPISuggestionTranslator.userGroup
package

Default user group.

Definition at line 71 of file SECAPISuggestionTranslator.java.


The documentation for this class was generated from the following file: