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

Class forwards queries from anotation client to the SEC API server and and creates a message for annotation client with the results from the SEC API server. More...

Inheritance diagram for cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread:
Inheritance graph
Collaboration diagram for cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread:
Collaboration graph

Public Member Functions

 SECDInterfaceThread (RequestInfo requestInfo)
 
void run ()
 
ArrayList< EntityAttributegetResultFromSECAPI (EntityRequest request)
 

Static Public Attributes

static final String PREFIX_NEW = "https://www.googleapis.com/freebase/v1/image/"
 
static final String POSTFIX_NEW = "?maxwidth=500&maxheight=500"
 
static final String PREFIX = "api.freebase.com/api/trans/raw/"
 
static final int MAX_RESULTS = 50
 
static final ArrayList< String > NAME_ATTRIBUTES
 
static final String URI_ATTRIBUTE = "identifier"
 
static final String VIS_REPRESENTATION_ATTRIBUTE = "image"
 
static final String ALT_VIS_REPRESENTATION_ATTRIBUTE = "freebase_image"
 
static final String DESCRIPTION_ATTRIBUTE = "description"
 
static final String MULTIPLE_DATA_SEPARATOR = "\\|"
 
static final ArrayList< String > REQUESTED_ATTRIBUTES
 

Package Functions

ArrayList
< EntityAdditionalAttribute
getAdditionalAttributes (JSONObject entityAttributes, EntityAttribute parentAttr)
 

Private Member Functions

String makeRequestString (EntityRequest request)
 
String makeMessageFromResult (ArrayList< EntityAttribute > responses)
 
ArrayList< EntityAttributemakeArrayFromResult (String JSONString)
 
String EscapeCharsToSend (String source)
 
String createGERequest (EntityRequest request)
 
String makeSECAPIRequest (EntityRequest request)
 
String makeRemoteSECAPIRequest (EntityRequest request)
 
boolean checkException (JSONObject jsonData)
 
ArrayList< String > getPicturesFromString (String string)
 

Private Attributes

RequestInfo requestInfo
 
EntityRequest request
 

Static Private Attributes

static final ArrayList< String > ALLOWED_POSTFIX
 

Detailed Description

Class forwards queries from anotation client to the SEC API server and and creates a message for annotation client with the results from the SEC API server.

Author
Martin Petr (xpetrm05)

Definition at line 47 of file SECDInterfaceThread.java.

Constructor & Destructor Documentation

cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.SECDInterfaceThread ( RequestInfo  requestInfo)

Constructor.

Parameters
requestInfoobject with informations about requests from client

Definition at line 112 of file SECDInterfaceThread.java.

Member Function Documentation

boolean cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.checkException ( JSONObject  jsonData)
private

Checks if JSON from SEC API contains exception and if yes, logs it

Parameters
jsonDataJSON data from SEC API
Returns
If exception was presented, returns true, false otherwise

Definition at line 738 of file SECDInterfaceThread.java.

Here is the caller graph for this function:

String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.createGERequest ( EntityRequest  request)
private

Creates request to SEC API

Parameters
requestRequest from client that will be searched
Returns
Returns request for SEC API

Definition at line 521 of file SECDInterfaceThread.java.

Here is the call graph for this function:

Here is the caller graph for this function:

String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.EscapeCharsToSend ( String  source)
private

Creates escaped version of the provided textual data. It is used when text to be sent to the SEC Store server contains special characters like quotes and backslash. Method expects SEC Store server to store strings enclosed in double quote. That's why double quote character needs to be escaped and single quote not.

Definition at line 409 of file SECDInterfaceThread.java.

Here is the caller graph for this function:

ArrayList<EntityAdditionalAttribute> cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.getAdditionalAttributes ( JSONObject  entityAttributes,
EntityAttribute  parentAttr 
)
package

Parses additional attributes of entity from SEC API

Parameters
entityAttributesJSON object with entity
parentAttrEntity attribute of annotation to which additional attributes belongs
Returns
Returns array of additional attributes

Definition at line 789 of file SECDInterfaceThread.java.

Here is the call graph for this function:

Here is the caller graph for this function:

ArrayList<String> cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.getPicturesFromString ( String  string)
private

Gets pictures from string

Parameters
stringstring with pictures
Returns
list of strings

Definition at line 760 of file SECDInterfaceThread.java.

Here is the caller graph for this function:

ArrayList<EntityAttribute> cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.getResultFromSECAPI ( EntityRequest  request)

Method searches vocabulary entities by using a SEC API.

Parameters
requestRequest from client that will be searched
Returns
Returns finded vocabulary entities

Definition at line 427 of file SECDInterfaceThread.java.

Here is the call graph for this function:

Here is the caller graph for this function:

ArrayList<EntityAttribute> cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.makeArrayFromResult ( String  JSONString)
private

Method parse response string from the SEC Store API and save entities in it to array.

Parameters
JSONStringJSON string from SEC Store API
Returns
list of EntityAtributes parsed from JSON String

Definition at line 294 of file SECDInterfaceThread.java.

Here is the call graph for this function:

String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.makeMessageFromResult ( ArrayList< EntityAttribute responses)
private

Method make string from array of EntityAtributes that will be sent to client.

Parameters
responsesarray list with objects from SEC Store API
Returns
XML string for client

Definition at line 224 of file SECDInterfaceThread.java.

Here is the call graph for this function:

Here is the caller graph for this function:

String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.makeRemoteSECAPIRequest ( EntityRequest  request)
private

Makes remote SEC API request and return result

Parameters
requestRequest from client that will be searched
Returns
Returns result from SEC API

Definition at line 707 of file SECDInterfaceThread.java.

Here is the call graph for this function:

Here is the caller graph for this function:

String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.makeRequestString ( EntityRequest  request)
private

Method makes JSON string from EntityRequest object (that represents request for entity from client).

Parameters
requestrequest from client that will be parse
Returns
JSON string for SEC Store API

Definition at line 169 of file SECDInterfaceThread.java.

Here is the call graph for this function:

String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.makeSECAPIRequest ( EntityRequest  request)
private

Makes SEC API request and return result

Parameters
requestRequest from client that will be searched
Returns
Returns result from SEC API

Definition at line 655 of file SECDInterfaceThread.java.

Here is the call graph for this function:

Here is the caller graph for this function:

void cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.run ( )

Method gets entities according to client's request and send the response to the client by comet channel.

Definition at line 123 of file SECDInterfaceThread.java.

Here is the call graph for this function:

Member Data Documentation

final ArrayList<String> cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.ALLOWED_POSTFIX
staticprivate
Initial value:
= new ArrayList<String>(Arrays.asList(
"jpg",
"gif",
"bmp",
"png",
"jpeg"
))

Allowed postfix of image file name

Definition at line 87 of file SECDInterfaceThread.java.

final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.ALT_VIS_REPRESENTATION_ATTRIBUTE = "freebase_image"
static

Alternative name of column in KB where URI of image of entity is stored.

Definition at line 79 of file SECDInterfaceThread.java.

final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.DESCRIPTION_ATTRIBUTE = "description"
static

Name of column in KB where description of entity is stored.

Definition at line 81 of file SECDInterfaceThread.java.

final int cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.MAX_RESULTS = 50
static

Maximum results to return if limit is not specified by client

Definition at line 61 of file SECDInterfaceThread.java.

final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.MULTIPLE_DATA_SEPARATOR = "\\|"
static

Separator of values in multivalue attributes

Definition at line 84 of file SECDInterfaceThread.java.

final ArrayList<String> cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.NAME_ATTRIBUTES
static
Initial value:
= new ArrayList<String>(Arrays.asList(
"name",
"preferred_term",
"display_term",
"short_name",
"alias"
))

Name of column in KB where name of entity is stored. Entities in KB have more options where name can be so fallback must be used

Definition at line 67 of file SECDInterfaceThread.java.

final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.POSTFIX_NEW = "?maxwidth=500&maxheight=500"
static

New postfix of freebase image URI

Definition at line 56 of file SECDInterfaceThread.java.

final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.PREFIX = "api.freebase.com/api/trans/raw/"
static

Old prefix of freebase image URI which must be replaced

Definition at line 58 of file SECDInterfaceThread.java.

final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.PREFIX_NEW = "https://www.googleapis.com/freebase/v1/image/"
static

New prefix of freebase image URI

Definition at line 54 of file SECDInterfaceThread.java.

EntityRequest cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.request
private

Detailed informations about request for entities

Definition at line 51 of file SECDInterfaceThread.java.

final ArrayList<String> cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.REQUESTED_ATTRIBUTES
static
Initial value:
= new ArrayList<String>(Arrays.asList(
"name",
"preferred_term",
"display_term",
"short_name",
))

Attributes which should be requested from SEC API

Definition at line 96 of file SECDInterfaceThread.java.

RequestInfo cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.requestInfo
private

Informations about client request

Definition at line 49 of file SECDInterfaceThread.java.

final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.URI_ATTRIBUTE = "identifier"
static

Name of column in KB where URI of entity is stored.

Definition at line 75 of file SECDInterfaceThread.java.

final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.VIS_REPRESENTATION_ATTRIBUTE = "image"
static

Name of column in KB where URI of image of entity is stored.

Definition at line 77 of file SECDInterfaceThread.java.


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