public class DLLearnerWS extends Object
Modifier and Type | Class and Description |
---|---|
static class |
DLLearnerWS.Datastructures
Conversion between different data structures.
|
Constructor and Description |
---|
DLLearnerWS() |
Modifier and Type | Method and Description |
---|---|
int |
addKnowledgeSource(int id,
String component,
String url)
Adds a knowledge source.
|
void |
applyConfigEntryBoolean(int sessionID,
int componentID,
String optionName,
Boolean value) |
void |
applyConfigEntryInt(int sessionID,
int componentID,
String optionName,
Integer value) |
void |
applyConfigEntryString(int sessionID,
int componentID,
String optionName,
String value) |
void |
applyConfigEntryStringArray(int sessionID,
int componentID,
String optionName,
String[] value) |
void |
applyConfigEntryStringTupleList(int sessionID,
int componentID,
String optionName,
String[] keys,
String[] values) |
void |
applyConfigEntryURL(int sessionID,
int componentID,
String optionName,
String value) |
int |
generateID()
Generates a unique ID for the client and initialises a session.
|
String |
getAsJSON(int sessionID,
int queryID) |
String |
getAsXMLString(int sessionID,
int queryID) |
String[] |
getAtomicConcepts(int id) |
String[] |
getAtomicRoles(int id) |
String[] |
getComponents()
Gets a list of all DL-Learner components accessible via this web service.
|
int[] |
getConceptArity(int id,
int nrOfConcepts) |
int[] |
getConceptDepth(int id,
int nrOfConcepts) |
int |
getConceptLength(String conceptString) |
String[] |
getConfigOptions(String component,
boolean allInfo)
Gets the configuration options supported by the component.
|
Boolean |
getConfigOptionValueBoolean(int sessionID,
int componentID,
String optionName) |
Double |
getConfigOptionValueDouble(int sessionID,
int componentID,
String optionName) |
Integer |
getConfigOptionValueInt(int sessionID,
int componentID,
String optionName) |
String |
getConfigOptionValueString(int sessionID,
int componentID,
String optionName) |
String[] |
getConfigOptionValueStringArray(int sessionID,
int componentID,
String optionName) |
String |
getConfigOptionValueURL(int sessionID,
int componentID,
String optionName) |
String |
getCurrentlyBestConcept(int id) |
String[] |
getCurrentlyBestConcepts(int id,
int nrOfConcepts,
String format) |
String |
getCurrentlyBestEvaluatedDescriptions(int id,
int limit) |
String |
getCurrentlyBestEvaluatedDescriptionsFiltered(int id,
int nrOfDescriptions,
double accuracyThreshold,
boolean filterNonMinimalDescriptions) |
String[] |
getIndividualsForARole(int id,
String role) |
String[] |
getInstances(int id) |
String[] |
getKnowledgeSources()
Gets a list of all DL-Learner knowledge source components accessible via this web service.
|
String[] |
getLearningAlgorithms()
Gets a list of all DL-Learner learning algorithm components accessible via this web service.
|
String[] |
getLearningProblems()
Gets a list of all DL-Learner learning problem components accessible via this web service.
|
String[] |
getNegativeExamples(int sessionID,
int componentID,
String[] positives,
int results,
String namespace,
String[] filterClasses) |
String[] |
getReasoners()
Gets a list of all DL-Learner reasoner components accessible via this web service.
|
String |
getSubsumptionHierarchy(int id) |
void |
init(int id,
int componentID)
Initialise the specified component.
|
void |
initAll(int id)
Initialise all components.
|
boolean |
isAlgorithmRunning(int id) |
boolean |
isSparqlQueryRunning(int sessionID,
int queryID) |
String |
learn(int id,
String format)
Starts the learning algorithm and returns the best concept found.
|
String |
learnDescriptionsEvaluated(int id)
Returns a list of JSON encoded description including extra information
(which partially depends on the learning problem) such as the accuracy
of the learned description.
|
String |
learnDescriptionsEvaluatedLimit(int id,
int limit)
Returns a list of JSON encoded description including extra information
(which partially depends on the learning problem) such as the accuracy
of the learned description.
|
void |
learnThreaded(int id)
Starts the learning algorithm and returns immediately.
|
boolean |
ping()
Method to check whether web service is online and how fast it responses.
|
void |
removeKnowledgeSource(int id,
int componentID)
Removes a knowledge source.
|
String[] |
retrieval(int id,
String conceptString) |
int |
setLearningAlgorithm(int id,
String component)
Sets the learning algorithm to use.
|
int |
setLearningProblem(int id,
String component)
Sets the learning problem to use.
|
void |
setNegativeExamples(int id,
String[] negativeExamples) |
void |
setPositiveExamples(int id,
String[] positiveExamples) |
int |
setReasoner(int id,
String component)
Sets the reasoner to use.
|
String |
sparqlQuery(int sessionID,
int componentID,
String query) |
String |
sparqlQueryPredefinedEndpoint(String predefinedEndpoint,
String query,
boolean useCache)
Queries one of the standard endpoints defined in DL-Learner.
|
int |
sparqlQueryThreaded(int sessionID,
int componentID,
String query) |
String |
SparqlRetrieval(String conceptString,
int limit) |
void |
stop(int id)
Stops the learning algorithm smoothly.
|
void |
stopSparqlThread(int sessionID,
int queryID) |
public DLLearnerWS()
public boolean ping()
public int generateID()
public String[] getComponents()
public String[] getKnowledgeSources()
public String[] getReasoners()
public String[] getLearningProblems()
public String[] getLearningAlgorithms()
public String[] getConfigOptions(String component, boolean allInfo)
component
- Name of the component.allInfo
- Whether or not complete information is desired (including option description, required, default value, example value).UnknownComponentException
- Thrown if component is not known (see getComponents()
).public int addKnowledgeSource(int id, String component, String url) throws ClientNotKnownException, UnknownComponentException, MalformedURLException
id
- The session ID.component
- The name of the component.url
- The URL of the knowledge source.ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
- Thrown if component is not known (see getComponents()
).MalformedURLException
- Thrown if passed URL is malformed.public void removeKnowledgeSource(int id, int componentID) throws ClientNotKnownException
id
- The session ID.componentID
- ID of knowledge source to remove.ClientNotKnownException
- Thrown if client (session ID) is not known.public int setReasoner(int id, String component) throws ClientNotKnownException, UnknownComponentException
id
- The session ID.component
- The name of the component.ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
- Thrown if component is not known (see getComponents()
).public int setLearningProblem(int id, String component) throws ClientNotKnownException, UnknownComponentException
id
- The session ID.component
- The name of the component.ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
- Thrown if component is not known (see getComponents()
).public int setLearningAlgorithm(int id, String component) throws ClientNotKnownException, UnknownComponentException
id
- The session ID.component
- The name of the component.ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
- Thrown if component is not known (see getComponents()
).LearningProblemUnsupportedException
- Thrown if the learning problem is not supported by the specified learning algorithm.public void initAll(int id) throws ClientNotKnownException, ComponentInitException
id
- Session ID.ComponentInitException
- Thrown if an error occurs during component initialisation.ClientNotKnownException
public void init(int id, int componentID) throws ClientNotKnownException, ComponentInitException
id
- Session-ID.componentID
- Component-ID.ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
- Thrown if the component is unknown.ComponentInitException
public String learn(int id, String format) throws ClientNotKnownException
id
- Session ID.format
- The format of the result string: "manchester", "kb", "dl".ClientNotKnownException
- Thrown if client (session ID) is not known.public String learnDescriptionsEvaluated(int id) throws ClientNotKnownException
id
- The session ID.ClientNotKnownException
- Thrown if client (session ID) is not known.public String learnDescriptionsEvaluatedLimit(int id, int limit) throws ClientNotKnownException
id
- The session ID.limit
- Maximum number of results desired.ClientNotKnownException
- Thrown if client (session ID) is not known.public void learnThreaded(int id) throws ClientNotKnownException
id
- Session ID.ClientNotKnownException
- Thrown if client (session ID) is not known.public String getCurrentlyBestConcept(int id) throws ClientNotKnownException
id
- The session ID.ClientNotKnownException
- Thrown if client (session ID) is not known.public String[] getCurrentlyBestConcepts(int id, int nrOfConcepts, String format) throws ClientNotKnownException
id
- The session ID.nrOfConcepts
- format
- ClientNotKnownException
- Thrown if client (session ID) is not known.public String getCurrentlyBestEvaluatedDescriptions(int id, int limit) throws ClientNotKnownException
id
- The session ID.limit
- ClientNotKnownException
- Thrown if client (session ID) is not known.public String getCurrentlyBestEvaluatedDescriptionsFiltered(int id, int nrOfDescriptions, double accuracyThreshold, boolean filterNonMinimalDescriptions) throws ClientNotKnownException
id
- The session ID.nrOfDescriptions
- accuracyThreshold
- filterNonMinimalDescriptions
- ClientNotKnownException
- Thrown if client (session ID) is not known.public boolean isAlgorithmRunning(int id) throws ClientNotKnownException
id
- The session ID.ClientNotKnownException
- Thrown if client (session ID) is not known.public void stop(int id) throws ClientNotKnownException
id
- The session ID.ClientNotKnownException
- Thrown if client (session ID) is not known.public void setPositiveExamples(int id, String[] positiveExamples) throws ClientNotKnownException
id
- The session ID.positiveExamples
- ClientNotKnownException
- Thrown if client (session ID) is not known.public void setNegativeExamples(int id, String[] negativeExamples) throws ClientNotKnownException
id
- The session ID.negativeExamples
- ClientNotKnownException
- Thrown if client (session ID) is not known.public void applyConfigEntryInt(int sessionID, int componentID, String optionName, Integer value) throws ClientNotKnownException, UnknownComponentException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.value
- ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
public void applyConfigEntryString(int sessionID, int componentID, String optionName, String value) throws ClientNotKnownException, UnknownComponentException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.value
- ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
public void applyConfigEntryURL(int sessionID, int componentID, String optionName, String value) throws ClientNotKnownException, UnknownComponentException, MalformedURLException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.value
- ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
MalformedURLException
public void applyConfigEntryStringArray(int sessionID, int componentID, String optionName, String[] value) throws ClientNotKnownException, UnknownComponentException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.value
- ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
public void applyConfigEntryStringTupleList(int sessionID, int componentID, String optionName, String[] keys, String[] values) throws ClientNotKnownException, UnknownComponentException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.keys
- values
- ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
public void applyConfigEntryBoolean(int sessionID, int componentID, String optionName, Boolean value) throws ClientNotKnownException, UnknownComponentException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.value
- ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
public String[] getConfigOptionValueStringArray(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
ConfigOptionTypeException
public String getConfigOptionValueString(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
ConfigOptionTypeException
public String getConfigOptionValueURL(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
ConfigOptionTypeException
public Double getConfigOptionValueDouble(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
ConfigOptionTypeException
public Boolean getConfigOptionValueBoolean(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
ConfigOptionTypeException
public Integer getConfigOptionValueInt(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException
sessionID
- The session ID.componentID
- The componentID.optionName
- The name of the configuration option.ClientNotKnownException
- Thrown if client (session ID) is not known.UnknownComponentException
ConfigOptionTypeException
public String[] getAtomicConcepts(int id) throws ClientNotKnownException
ClientNotKnownException
public String getSubsumptionHierarchy(int id) throws ClientNotKnownException
ClientNotKnownException
public String[] retrieval(int id, String conceptString) throws ClientNotKnownException, ParseException
public int getConceptLength(String conceptString) throws ParseException
ParseException
public String[] getAtomicRoles(int id) throws ClientNotKnownException
ClientNotKnownException
public String[] getInstances(int id) throws ClientNotKnownException
ClientNotKnownException
public String[] getIndividualsForARole(int id, String role) throws ClientNotKnownException
ClientNotKnownException
public String getAsJSON(int sessionID, int queryID) throws ClientNotKnownException, SparqlQueryException
public String getAsXMLString(int sessionID, int queryID) throws ClientNotKnownException, SparqlQueryException
public int sparqlQueryThreaded(int sessionID, int componentID, String query) throws ClientNotKnownException
ClientNotKnownException
public String sparqlQuery(int sessionID, int componentID, String query) throws ClientNotKnownException
ClientNotKnownException
public String sparqlQueryPredefinedEndpoint(String predefinedEndpoint, String query, boolean useCache)
predefinedEndpoint
- A string describing the endpoint e.g. DBpedia.query
- The SPARQL query.useCache
- Specify whether to use a cache for queries.SparqlEndpoint.getEndpointByName(String)
public boolean isSparqlQueryRunning(int sessionID, int queryID) throws ClientNotKnownException
ClientNotKnownException
public void stopSparqlThread(int sessionID, int queryID) throws ClientNotKnownException
ClientNotKnownException
public int[] getConceptDepth(int id, int nrOfConcepts) throws ClientNotKnownException
ClientNotKnownException
public int[] getConceptArity(int id, int nrOfConcepts) throws ClientNotKnownException
ClientNotKnownException
public String SparqlRetrieval(String conceptString, int limit)
public String[] getNegativeExamples(int sessionID, int componentID, String[] positives, int results, String namespace, String[] filterClasses) throws ClientNotKnownException
ClientNotKnownException
DL-Learner is licenced under the terms of the GNU General Public License.
Copyright © 2007-2019 Jens Lehmann