nectec.semantic.web.knowledge.application.framework.searching
Class SemanticSearch

java.lang.Object
  extended by nectec.semantic.web.knowledge.application.framework.representative.ApplicationTemplate
      extended by nectec.semantic.web.knowledge.application.framework.searching.SemanticSearch

public class SemanticSearch
extends ApplicationTemplate

Contain all the methods regarding to Semantic Search application. Some of the methods available in this class contain a parameter named 'path' and it is actually the name of a class in ontology. The name is called 'path' due to the system expectation that the directory(path) name must be similar to the respective class name in the ontology.


Field Summary
 
Fields inherited from class nectec.semantic.web.knowledge.application.framework.representative.ApplicationTemplate
PROPERTY_CLASSIFICATION_DISPLAY, PROPERTY_CLASSIFICATION_PROCESSING, TO_DISPLAY, TO_PROCESS
 
Constructor Summary
SemanticSearch(String root)
          Constructor method.
 
Method Summary
 String[][] aggregationQuery(ArrayList<String> select, ArrayList<String> groupBy)
          Simulation of Aggregation Functions defined in SQL to apply on relational data, in order to perform similar actions on RDF data.
static boolean checkDataExistence(String root)
          Check whether the data is ready or not, in order to run Semantic Search application.
 ArrayList<String> getAllPropertiesInvolved(String classOfInterest)
          Get all the properties configured to be involved in the current class of interest.
 HashMap<String,String> getAvailableSearchProperties(String classOfInterest)
          Get the available search properties of the given class.
 boolean isInIncludedProperties(String propertyName, int propertyClassification)
          Check whether the given property is included in the configuration or not.
static void prepareData(String root, String plginData)
          Prepare the data required for use of Semantic Search, which includes merging data, applying the rules from common place, and insert additional inferences to the base data.
 String[] sortByProperty(String property, String order)
          Sort the currently interested class's instances according to the property value.
 
Methods inherited from class nectec.semantic.web.knowledge.application.framework.representative.ApplicationTemplate
getAllInstanceUniqueIDs, getAllInstanceURNs, getAppRelPath, getAvailableDisplayProperties, getConfig, getCurrentClassOfInterest, getCustomLabel, getInformationOfGivenInstanceURN, getNamespace, getOntologyModel, getOntologyProcessingInstance, getPaths, getPaths, getPkeyValueGivenURN, getRangeOfPropertyWRTcurretClass, getRelatedInformationOfGivenClassInstance, getStruturalInfoOfURN, getSubclassesOfGivenPropertyRange, getURNofID, getValueOfProperty, hasPropertyValueForInstanceWithGivenID, init, isValidResourceInThisNS, searchInstances, searchInstancesOfGivenConditions, setCurrentApplicationPath, setCurrentClassOfInterest, setOntologyModel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SemanticSearch

public SemanticSearch(String root)
Constructor method. This should not be called directly. Instead one should get this object from the class 'ServiceRepresentative'.

Parameters:
root - Location of the Semantic Search data directory on the system (e.g. "D:/NECTEC/SKAF_HOME/AppData/Employee").
Method Detail

getAvailableSearchProperties

public HashMap<String,String> getAvailableSearchProperties(String classOfInterest)
Get the available search properties of the given class.

Parameters:
classOfInterest - Class of interest (if used null, the class of current interest, which was defined when you create the object, is applied).
Returns:
Collection of search properties along with the RESOURCE or LITERAL type description.

checkDataExistence

public static boolean checkDataExistence(String root)
Check whether the data is ready or not, in order to run Semantic Search application.

Parameters:
root - Root of the application data (e.g. "D:/NECTEC/SKAF_HOME/AppData/Employee").
Returns:
true (It is ready) or false (It is not ready).

isInIncludedProperties

public boolean isInIncludedProperties(String propertyName,
                                      int propertyClassification)
Check whether the given property is included in the configuration or not.

Specified by:
isInIncludedProperties in class ApplicationTemplate
Parameters:
propertyName - Property of interest.
propertyClassification - Property type (Types are defined as Constants (Start with the word 'PROPERTY_CLASSIFICATION_') in ApplicationTemplate class and callable.)
Returns:
true(It is included in configuration) / false(It is not included in configuration)

getAllPropertiesInvolved

public ArrayList<String> getAllPropertiesInvolved(String classOfInterest)
Get all the properties configured to be involved in the current class of interest. Including searchable properties, display properties, conditional properties and, if have, recommended properties.

Specified by:
getAllPropertiesInvolved in class ApplicationTemplate
Parameters:
classOfInterest - Class of interest (if used null, the class of current interest, which was defined when you create the object, is applied).
Returns:
Collection of those properties.

prepareData

public static void prepareData(String root,
                               String plginData)
Prepare the data required for use of Semantic Search, which includes merging data, applying the rules from common place, and insert additional inferences to the base data.

Parameters:
root - Location of the Semantic Search data directory on the system (e.g. "D:/NECTEC/SKAF_HOME/AppData/Employee").
plginData - File name that contains data plugged in from other sources.

aggregationQuery

public String[][] aggregationQuery(ArrayList<String> select,
                                   ArrayList<String> groupBy)
Simulation of Aggregation Functions defined in SQL to apply on relational data, in order to perform similar actions on RDF data.

Parameters:
selectPart - Groups of parameter to select property values. See example for usage.
groupByPart - Groups of parameter to group instances. See example for usage.
Returns:
2-Dimensional arrays that represent rows and columns of the queried data. See example for usage.

sortByProperty

public String[] sortByProperty(String property,
                               String order)
Sort the currently interested class's instances according to the property value. In case of multiple value, the first value is taken.

Parameters:
property - Property to be used for sorting.
order - ASC (Ascending Order) or DESC (Descending Order).
Returns:
Sorted orders of instances' unique IDs