uk.ac.open.kmi.watson.services
Class EntitySearch

java.lang.Object
  extended by uk.ac.open.kmi.watson.services.WatsonService
      extended by uk.ac.open.kmi.watson.services.EntitySearch

public class EntitySearch
extends WatsonService

Service for searching and inspecting entities.

Author:
mda99

Field Summary
 
Fields inherited from class uk.ac.open.kmi.watson.services.WatsonService
CLASS, COMMENT, EXACT_MATCH, INDIVIDUAL, LABEL, LITERAL, LOCAL_NAME, NS, PROPERTY, TOKEN_MATCH
 
Constructor Summary
EntitySearch()
           
 
Method Summary
 java.lang.String[] getAllSubClasses(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of all the direct and indirect sub-classes of the given entity in the given document
 java.lang.String[] getAllSuperClasses(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of all the direct and indirect sub-classes of the given entity in the given document
 java.lang.String[] getBelongsTo(java.lang.String entityURI)
          Returns the uri of the semantic contents in which the considered entity is described
 java.lang.String[] getClasses(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of classes (type) of the given individual in the given document
 java.lang.String[] getComments(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the comments of the considered entity in the considered document
 java.lang.String[] getDifferentFrom(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of individuals that are the different from the given individuals in the given document
 java.lang.String[] getDisjointWith(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of classes that are disjoint with the given class in the given document
 java.lang.String[] getDomain(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of domain classes of the given property in the given document
 java.lang.String[] getDomainOf(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of property having the given class as domain in the given document
 java.lang.String[] getEntitiesByKeyword(java.lang.String ontoURI, java.lang.String keyword)
          Default search: search in any entity and any scope using EXACT MATCH
 java.lang.String[] getEntitiesByKeywordWithRestriction(java.lang.String ontoURI, java.lang.String keyword, int scopeModifier, int entityModifier, int matchTechnique)
          Main entity search function.
 java.lang.String[] getEquivalentClasses(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of equivalent classes of the given entity in the given document
 java.lang.String[] getInstances(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of instances of the given class in the given document
 java.lang.String[] getLabels(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the labels of the considered entity in the considered document
 java.lang.String[][] getLiteralsByKeyword(java.lang.String ontoURI, java.lang.String keyword)
          Returns literals matching the given keyword in the given document.
 java.lang.String[][] getLiteralsFor(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the set of literal relations for entityURI in ontoURI
 java.lang.String[] getRange(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of range classes of the given property in the given document
 java.lang.String[] getRangeOf(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of property having the given class as range in the given document
 java.lang.String[][] getRelationsFrom(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the set of entity relations for entityURI in ontoURI
 java.lang.String[][] getRelationsTo(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the set of entity relations that point to entityURI in ontoURI
 java.lang.String[] getSameIndividuals(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of individuals that are the same as the given individuals in the given document
 java.lang.String[] getSubClasses(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of sub-classes of the given entity in the given document
 java.lang.String[] getSuperClasses(java.lang.String ontoURI, java.lang.String entityURI)
          Returns the list of super-classes of the given entity in the given document
 java.lang.String getType(java.lang.String ontoURI, java.lang.String entityURI)
          returns the type of the Entity.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntitySearch

public EntitySearch()
Method Detail

getEntitiesByKeyword

public java.lang.String[] getEntitiesByKeyword(java.lang.String ontoURI,
                                               java.lang.String keyword)
Default search: search in any entity and any scope using EXACT MATCH


getEntitiesByKeywordWithRestriction

public java.lang.String[] getEntitiesByKeywordWithRestriction(java.lang.String ontoURI,
                                                              java.lang.String keyword,
                                                              int scopeModifier,
                                                              int entityModifier,
                                                              int matchTechnique)
Main entity search function. Returns entities containing the given keyword, if they are of one of the types given by the entity modifier (class, property and/or individual), and the keyword matches some particular parts of the entity specified by the scope modifier (NS, LOCAL_NAME, etc.), using the specified matcher (Exact or partial match).

Parameters:
keyword - the keywords to search
scopeModifier - where to search in entity, e.g. WatsonService.LOCAL_NAME+WatsonService.LABEL
entityTypeModifier - in which entity to search, e.g. WatsonService.CLASS+WatsonService.INDIVIDUAL
matchTechnique - the match technique, e.g. WatsonService.EXACT_MATCH
Returns:
a set of valid entity indentifiers

getLiteralsByKeyword

public java.lang.String[][] getLiteralsByKeyword(java.lang.String ontoURI,
                                                 java.lang.String keyword)
Returns literals matching the given keyword in the given document.

Parameters:
ontoURI - the URI of the considered document
keyword - the keyword to match
Returns:
an array of rows of the form [literal][language][entity][property], where literal match keyword and there is in ontoURI a statement of the form {entity property literal@language}

getType

public java.lang.String getType(java.lang.String ontoURI,
                                java.lang.String entityURI)
returns the type of the Entity.

Parameters:
ontoURI - the ontologogy URI the entity belongs to
entityURI - the URI of the entity
Returns:
"Class", "Property", or "Individual"

getLabels

public java.lang.String[] getLabels(java.lang.String ontoURI,
                                    java.lang.String entityURI)
Returns the labels of the considered entity in the considered document

Parameters:
ontoURI - the URI of the document
entityURI - the URI of the entity
Returns:
a set of labels

getComments

public java.lang.String[] getComments(java.lang.String ontoURI,
                                      java.lang.String entityURI)
Returns the comments of the considered entity in the considered document

Parameters:
ontoURI - the URI of the document
entityURI - the URI of the entity
Returns:
a set of comments

getBelongsTo

public java.lang.String[] getBelongsTo(java.lang.String entityURI)
Returns the uri of the semantic contents in which the considered entity is described

Parameters:
entityURI - the URI of the entity to look for
Returns:
the list of URIs of documents in which entityURI is declared

getRelationsFrom

public java.lang.String[][] getRelationsFrom(java.lang.String ontoURI,
                                             java.lang.String entityURI)
Returns the set of entity relations for entityURI in ontoURI

Returns:
result[0] the property URI, result[1] the property local name, result[2] the related entity uri

getRelationsTo

public java.lang.String[][] getRelationsTo(java.lang.String ontoURI,
                                           java.lang.String entityURI)
Returns the set of entity relations that point to entityURI in ontoURI

Returns:
result[0] the property URI, result[1] the property local name, result[2] the relating entity uri

getLiteralsFor

public java.lang.String[][] getLiteralsFor(java.lang.String ontoURI,
                                           java.lang.String entityURI)
Returns the set of literal relations for entityURI in ontoURI

Returns:
result[0] the property URI, result[1] the property local name, result[2] the literal, result[3] the language of the literal if specified

getSubClasses

public java.lang.String[] getSubClasses(java.lang.String ontoURI,
                                        java.lang.String entityURI)
Returns the list of sub-classes of the given entity in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the entity to consider
Returns:
the list of URIs of sub-classes of entityURI in ontoURI

getAllSubClasses

public java.lang.String[] getAllSubClasses(java.lang.String ontoURI,
                                           java.lang.String entityURI)
Returns the list of all the direct and indirect sub-classes of the given entity in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the entity to consider
Returns:
the list of URIs of all the sub-classes of entityURI in ontoURI

getSuperClasses

public java.lang.String[] getSuperClasses(java.lang.String ontoURI,
                                          java.lang.String entityURI)
Returns the list of super-classes of the given entity in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the entity to consider
Returns:
the list of URIs of super-classes of entityURI in ontoURI

getAllSuperClasses

public java.lang.String[] getAllSuperClasses(java.lang.String ontoURI,
                                             java.lang.String entityURI)
Returns the list of all the direct and indirect sub-classes of the given entity in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the entity to consider
Returns:
the list of URIs of all the sub-classes of entityURI in ontoURI

getEquivalentClasses

public java.lang.String[] getEquivalentClasses(java.lang.String ontoURI,
                                               java.lang.String entityURI)
Returns the list of equivalent classes of the given entity in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the entity to consider
Returns:
the list of URIs of equivalent classes of entityURI in ontoURI

getInstances

public java.lang.String[] getInstances(java.lang.String ontoURI,
                                       java.lang.String entityURI)
Returns the list of instances of the given class in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the class to consider
Returns:
the list of URIs of instances of entityURI in ontoURI

getClasses

public java.lang.String[] getClasses(java.lang.String ontoURI,
                                     java.lang.String entityURI)
Returns the list of classes (type) of the given individual in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the individual to consider
Returns:
the list of URIs of classes of entityURI in ontoURI

getDomain

public java.lang.String[] getDomain(java.lang.String ontoURI,
                                    java.lang.String entityURI)
Returns the list of domain classes of the given property in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the property to consider
Returns:
the list of URIs of domain of entityURI in ontoURI

getRange

public java.lang.String[] getRange(java.lang.String ontoURI,
                                   java.lang.String entityURI)
Returns the list of range classes of the given property in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the property to consider
Returns:
the list of URIs of range of entityURI in ontoURI

getDomainOf

public java.lang.String[] getDomainOf(java.lang.String ontoURI,
                                      java.lang.String entityURI)
Returns the list of property having the given class as domain in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the class to consider
Returns:
the list of URIs of property having entityURI as domain in ontoURI

getRangeOf

public java.lang.String[] getRangeOf(java.lang.String ontoURI,
                                     java.lang.String entityURI)
Returns the list of property having the given class as range in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the class to consider
Returns:
the list of URIs of property having entityURI as range in ontoURI

getSameIndividuals

public java.lang.String[] getSameIndividuals(java.lang.String ontoURI,
                                             java.lang.String entityURI)
Returns the list of individuals that are the same as the given individuals in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the individual to consider
Returns:
the list of URIs of individuals equivalent to entityURI in ontoURI

getDifferentFrom

public java.lang.String[] getDifferentFrom(java.lang.String ontoURI,
                                           java.lang.String entityURI)
Returns the list of individuals that are the different from the given individuals in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the individual to consider
Returns:
the list of URIs of individuals declared as different from entityURI in ontoURI

getDisjointWith

public java.lang.String[] getDisjointWith(java.lang.String ontoURI,
                                          java.lang.String entityURI)
Returns the list of classes that are disjoint with the given class in the given document

Parameters:
ontoURI - the URI of the semantic document to consider
entityURI - the URI of the class to consider
Returns:
the list of URIs of classes disjoint with entityURI in ontoURI