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...
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.
cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.SECDInterfaceThread |
( |
RequestInfo |
requestInfo | ) |
|
Constructor.
- Parameters
-
requestInfo | object with informations about requests from client |
Definition at line 112 of file SECDInterfaceThread.java.
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
-
jsonData | JSON data from SEC API |
- Returns
- If exception was presented, returns true, false otherwise
Definition at line 738 of file SECDInterfaceThread.java.
String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.createGERequest |
( |
EntityRequest |
request | ) |
|
|
private |
Creates request to SEC API
- Parameters
-
request | Request from client that will be searched |
- Returns
- Returns request for SEC API
Definition at line 521 of file SECDInterfaceThread.java.
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.
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
-
entityAttributes | JSON object with entity |
parentAttr | Entity attribute of annotation to which additional attributes belongs |
- Returns
- Returns array of additional attributes
Definition at line 789 of file SECDInterfaceThread.java.
ArrayList<String> cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.getPicturesFromString |
( |
String |
string | ) |
|
|
private |
Gets pictures from string
- Parameters
-
string | string with pictures |
- Returns
- list of strings
Definition at line 760 of file SECDInterfaceThread.java.
ArrayList<EntityAttribute> cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.getResultFromSECAPI |
( |
EntityRequest |
request | ) |
|
Method searches vocabulary entities by using a SEC API.
- Parameters
-
request | Request from client that will be searched |
- Returns
- Returns finded vocabulary entities
Definition at line 427 of file SECDInterfaceThread.java.
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
-
JSONString | JSON string from SEC Store API |
- Returns
- list of EntityAtributes parsed from JSON String
Definition at line 294 of file SECDInterfaceThread.java.
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
-
responses | array list with objects from SEC Store API |
- Returns
- XML string for client
Definition at line 224 of file SECDInterfaceThread.java.
String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.makeRemoteSECAPIRequest |
( |
EntityRequest |
request | ) |
|
|
private |
Makes remote SEC API request and return result
- Parameters
-
request | Request from client that will be searched |
- Returns
- Returns result from SEC API
Definition at line 707 of file SECDInterfaceThread.java.
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
-
request | request from client that will be parse |
- Returns
- JSON string for SEC Store API
Definition at line 169 of file SECDInterfaceThread.java.
String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.makeSECAPIRequest |
( |
EntityRequest |
request | ) |
|
|
private |
Makes SEC API request and return result
- Parameters
-
request | Request from client that will be searched |
- Returns
- Returns result from SEC API
Definition at line 655 of file SECDInterfaceThread.java.
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.
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 |
final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.DESCRIPTION_ATTRIBUTE = "description" |
|
static |
final int cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.MAX_RESULTS = 50 |
|
static |
final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.MULTIPLE_DATA_SEPARATOR = "\\|" |
|
static |
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 |
final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.PREFIX = "api.freebase.com/api/trans/raw/" |
|
static |
final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.PREFIX_NEW = "https://www.googleapis.com/freebase/v1/image/" |
|
static |
EntityRequest cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.request |
|
private |
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 |
final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.URI_ATTRIBUTE = "identifier" |
|
static |
final String cz.vutbr.fit.knot.annotations.modules.SECDictionaryInterface.SECDInterfaceThread.VIS_REPRESENTATION_ATTRIBUTE = "image" |
|
static |
The documentation for this class was generated from the following file: