public class SadlServerImpl extends java.lang.Object implements ISadlServer
Constructor and Description |
---|
SadlServerImpl() |
SadlServerImpl(java.lang.String _kbaseRoot) |
Modifier and Type | Method and Description |
---|---|
boolean |
addTriple(java.lang.String subjName,
java.lang.String predName,
java.lang.Object objValue)
This method is called to add a triple to the instance data.
|
com.ge.research.sadl.reasoner.ResultSet |
ask(java.lang.String subjName,
java.lang.String propName,
java.lang.Object objValue)
This method retrieves the results of an RDF triple matching request as a list of matching statements.
|
com.ge.research.sadl.reasoner.ResultSet[] |
atomicQuery(java.lang.String serviceName,
javax.activation.DataSource dataSrc,
java.lang.String inputFormat,
java.lang.String[] sparql)
Method to provide instance data and then execute a set of queries in an atomic (stateless) manner, returning a ResultSet for each query.
|
com.ge.research.sadl.reasoner.ResultSet[] |
atomicQueryCsvData(java.lang.String serviceName,
javax.activation.DataSource csvDataSrc,
boolean includesHeader,
java.lang.String csvTemplate,
java.lang.String[] sparql)
Method to provide CSV instance data and then execute a set of queries in an atomic (stateless) manner, returning a ResultSet for each query.
|
boolean |
clearCache()
Method to clear the cache for the current kbase model.
|
void |
collectTimingInformation(boolean bCollect)
Turn on/off collection of timing information
|
javax.activation.DataSource |
construct(java.lang.String sparql)
Executes a construct query, which will return a subgraph of the knowledge base and instance data.
|
java.lang.String |
createInstance(java.lang.String name,
java.lang.String className)
This method creates a new Individual of the class identified.
|
boolean |
deleteTriple(java.lang.String subjName,
java.lang.String predName,
java.lang.Object objValue)
This method is called to delete a triple from the instance data.
|
java.lang.String |
getClassName()
This method returns the name of the class implementing the ISadlService interface.
|
javax.activation.DataSource |
getDerivations()
Gets derivations of all inferred statements (if the reasoner supports derivations)
|
java.lang.String |
getInstanceDataNamespace()
This method retrieves the default instance data namespace.
|
java.lang.String |
getInstanceModelName()
This method retrieves the instance model associated with the default instance data namespace.
|
java.lang.String |
getKBaseIdentifier()
Gets the knowledge base identifier for the current session.
|
java.lang.String |
getKbaseRoot()
Method to get the kbase root folder path.
|
java.lang.String |
getModelName()
Gets the model name for the current session.
|
java.lang.String |
getReasonerVersion()
Gets the version of the reasoner.
|
java.util.Map<java.lang.String,java.lang.String[]> |
getServiceNameMap()
This method returns the service name map whose keys are the names of the services and whose values are
String arrays of size 2 with the 1st element being the actual URL of the knowledge base folder (the folder
containing the OWL models, rule files, etc.; the knowledgeBaseIdentifier) and the 2nd element being the
public URI of the model which is the entry point into the kbase for the named service.
|
java.lang.String |
getServiceVersion()
This method returns the Source Code Control System (SCC) Version of the class implementing the ISadlService interface
|
com.ge.research.sadl.reasoner.ReasonerTiming[] |
getTimingInformation()
Gets timing information for a given session, if the reasoner supports this capability.
|
boolean |
loadCsvData(java.lang.String serverCsvDataLocator,
boolean includesHeader,
java.lang.String csvTemplate)
This method is called to cause abox data to be loaded by mapping from a CSV data file to semantic data using the mapping template specified
|
boolean |
loadData(java.lang.String serverDataLocator)
This method is called to cause abox data to be loaded from the server environment.
|
java.lang.String |
parameterizeQuery(java.lang.String query,
java.util.List<java.lang.Object> values)
Method to substitute parameter values for "?" terms in a query string.
|
java.lang.String |
prepareQuery(java.lang.String query)
Method to expand prefixes, find namespaces, and do whatever
other processing may be necessary to prepare a query string
for execution by the target query engine.
|
com.ge.research.sadl.reasoner.ResultSet |
query(java.lang.String sparql)
This method retrieves the results of a kbase query as a List array, 1st element being a List of
the column headings and second being a List of rows, each of which is a List of values.
|
boolean |
reset()
This method is called to delete all instance data added by calls to addTriple or forms of loadInstanceData.
|
java.lang.String |
selectServiceModel(java.lang.String serviceName)
This method is called to identify the model (tbox) to use by service name.
|
java.lang.String |
selectServiceModel(java.lang.String serviceName,
java.util.List<com.ge.research.sadl.reasoner.ConfigurationItem> preferences)
This method is called to identify the model (tbox) to use in this knowledge service session and to simultaneously override certain default configuration settings.
|
java.lang.String |
selectServiceModel(java.lang.String knowledgeBaseIdentifier,
java.lang.String modelName)
This method is called to identify the knowledgeBaseIdentifier and model (tbox) to use in this knowledge service session.
|
java.lang.String |
selectServiceModel(java.lang.String knowledgeBaseIdentifier,
java.lang.String modelName,
java.util.List<com.ge.research.sadl.reasoner.ConfigurationItem> preferences)
This method is called to identify the knowledgeBaseIdentifier and model (tbox) to use in this knowledge service session.
|
boolean |
sendCsvData(javax.activation.DataSource csvDataSrc,
boolean includesHeader,
java.lang.String csvTemplate)
This method is called to send abox data in CSV format to be converted to semantic data using the identified mapping template.
|
boolean |
sendData(javax.activation.DataSource dataSrc)
This method passes input data as a semantic model as a DataSource
|
boolean |
sendData(javax.activation.DataSource dataSrc,
java.lang.String inputFormat)
This method passes input data as a semantic model as a DataSource with a specified format
|
java.lang.String |
setInstanceDataNamespace(java.lang.String namespace)
This method sets the default instance data namespace.
|
void |
setKbaseRoot(java.lang.String _kbaseRoot)
Method to set the kbase root folder--a folder on the server file
system in which and under which server configuration files and
folders of model files will be found.
|
void |
setOwlFileOutputFormat(java.lang.String outputFormat)
Sets the Owl file output format to be used for output, e.g., when responding to a SPARQL construct query.
|
void |
setQueryTimeout(long timeout)
Method to set the timeout for queries.
|
void |
setServiceNameMap(java.util.Map<java.lang.String,java.lang.String[]> serviceNameMap)
This method sets the service name map.
|
public SadlServerImpl()
public SadlServerImpl(java.lang.String _kbaseRoot) throws com.ge.research.sadl.reasoner.ConfigurationException
com.ge.research.sadl.reasoner.ConfigurationException
public java.lang.String getClassName() throws SessionNotFoundException
ISadlServer
getClassName
in interface ISadlServer
SessionNotFoundException
public java.lang.String getServiceVersion() throws SessionNotFoundException
ISadlServer
getServiceVersion
in interface ISadlServer
SessionNotFoundException
public com.ge.research.sadl.reasoner.ResultSet query(java.lang.String sparql) throws com.ge.research.sadl.reasoner.QueryParseException, com.ge.research.sadl.reasoner.ReasonerNotFoundException, com.ge.research.sadl.reasoner.QueryCancelledException
ISadlServer
query
in interface ISadlServer
sparql
- a query stringcom.ge.research.sadl.reasoner.QueryParseException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
com.ge.research.sadl.reasoner.QueryCancelledException
public com.ge.research.sadl.reasoner.ReasonerTiming[] getTimingInformation()
ISadlServer
getTimingInformation
in interface ISadlServer
public javax.activation.DataSource construct(java.lang.String sparql) throws com.ge.research.sadl.reasoner.QueryParseException, com.ge.research.sadl.reasoner.QueryCancelledException
ISadlServer
construct
in interface ISadlServer
com.ge.research.sadl.reasoner.QueryParseException
com.ge.research.sadl.reasoner.QueryCancelledException
public com.ge.research.sadl.reasoner.ResultSet ask(java.lang.String subjName, java.lang.String propName, java.lang.Object objValue) throws com.ge.research.sadl.reasoner.TripleNotFoundException, com.ge.research.sadl.reasoner.ReasonerNotFoundException
ISadlServer
ask
in interface ISadlServer
com.ge.research.sadl.reasoner.TripleNotFoundException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
public boolean loadData(java.lang.String serverDataLocator) throws java.io.IOException, com.ge.research.sadl.reasoner.ReasonerNotFoundException, com.ge.research.sadl.reasoner.ConfigurationException
ISadlServer
loadData
in interface ISadlServer
serverDataLocator
- -- the location of the data to be loaded in the server environment. This will be reasoner-specifc. For some reasoners it may be a relative file path.java.io.IOException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
com.ge.research.sadl.reasoner.ConfigurationException
public boolean loadCsvData(java.lang.String serverCsvDataLocator, boolean includesHeader, java.lang.String csvTemplate) throws com.ge.research.sadl.reasoner.ConfigurationException, java.io.IOException, com.ge.research.sadl.reasoner.InvalidNameException, com.ge.research.sadl.importer.TemplateException
ISadlServer
loadCsvData
in interface ISadlServer
serverCsvDataLocator
- -- server-side location of CSV dataincludesHeader
- -- true if the CSV file contains header information in the first rowcsvTemplate
- -- server-side location of template mapping filecom.ge.research.sadl.reasoner.ConfigurationException
java.io.IOException
com.ge.research.sadl.reasoner.InvalidNameException
com.ge.research.sadl.importer.TemplateException
public java.lang.String selectServiceModel(java.lang.String serviceName) throws com.ge.research.sadl.reasoner.ConfigurationException, com.ge.research.sadl.reasoner.ReasonerNotFoundException
ISadlServer
selectServiceModel
in interface ISadlServer
serviceName
- -- the name of the service, which is used to lookup the knowledgeBaseIdentifier and modelNamecom.ge.research.sadl.reasoner.ConfigurationException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
public java.lang.String selectServiceModel(java.lang.String serviceName, java.util.List<com.ge.research.sadl.reasoner.ConfigurationItem> preferences) throws com.ge.research.sadl.reasoner.ConfigurationException, com.ge.research.sadl.reasoner.ReasonerNotFoundException, NamedServiceNotFoundException
ISadlServer
selectServiceModel
in interface ISadlServer
serviceName
- -- the name of the service, which is used to lookup the knowledgeBaseIdentifier and modelNamepreferences
- -- preferences override the configuration from the development environment (configuration.rdf)com.ge.research.sadl.reasoner.ConfigurationException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
NamedServiceNotFoundException
public java.lang.String selectServiceModel(java.lang.String knowledgeBaseIdentifier, java.lang.String modelName) throws com.ge.research.sadl.reasoner.ConfigurationException, com.ge.research.sadl.reasoner.ReasonerNotFoundException
ISadlServer
selectServiceModel
in interface ISadlServer
knowledgeBaseIdentifier
- -- the identity of the knowledge base, e.g., the folder containing the OWL/Rule files OR the name of the service of a service that does not have a model name specified, in which case the model name is specified by the next parametermodelName
- -- the entry point (specific model) within the knowledge base, e.g., the URI corresponding with the base namespace of the OWL modelcom.ge.research.sadl.reasoner.ConfigurationException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
public java.lang.String selectServiceModel(java.lang.String knowledgeBaseIdentifier, java.lang.String modelName, java.util.List<com.ge.research.sadl.reasoner.ConfigurationItem> preferences) throws com.ge.research.sadl.reasoner.ConfigurationException, com.ge.research.sadl.reasoner.ReasonerNotFoundException
ISadlServer
selectServiceModel
in interface ISadlServer
knowledgeBaseIdentifier
- -- the identity of the knowledge base, e.g., the folder containing the OWL/Rule files OR the name of the service of a service that does not have a model name specified, in which case the model name is specified by the next parametermodelName
- -- the entry point (specific model) within the knowledge base, e.g., the URI corresponding with the base namespace of the OWL modelpreferences
- -- preferences override the configuration from the development environment (configuration.rdf)com.ge.research.sadl.reasoner.ConfigurationException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
public boolean sendData(javax.activation.DataSource dataSrc) throws java.io.IOException, com.ge.research.sadl.reasoner.ReasonerNotFoundException, com.ge.research.sadl.reasoner.ConfigurationException
ISadlServer
sendData
in interface ISadlServer
java.io.IOException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
com.ge.research.sadl.reasoner.ConfigurationException
public boolean sendData(javax.activation.DataSource dataSrc, java.lang.String inputFormat) throws java.io.IOException, com.ge.research.sadl.reasoner.ReasonerNotFoundException, com.ge.research.sadl.reasoner.ConfigurationException
ISadlServer
sendData
in interface ISadlServer
inputFormat
- -- "N-TRIPLE", "N3", or "RDF/XML"java.io.IOException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
com.ge.research.sadl.reasoner.ConfigurationException
public boolean sendCsvData(javax.activation.DataSource csvDataSrc, boolean includesHeader, java.lang.String csvTemplate) throws com.ge.research.sadl.reasoner.ConfigurationException, java.io.IOException, com.ge.research.sadl.reasoner.InvalidNameException, com.ge.research.sadl.importer.TemplateException
ISadlServer
sendCsvData
in interface ISadlServer
csvDataSrc
- -- CSV data streamincludesHeader
- -- true if the CSV file contains header information in the first rowcsvTemplate
- -- template mapping identifiercom.ge.research.sadl.reasoner.ConfigurationException
java.io.IOException
com.ge.research.sadl.reasoner.InvalidNameException
com.ge.research.sadl.importer.TemplateException
public boolean addTriple(java.lang.String subjName, java.lang.String predName, java.lang.Object objValue) throws com.ge.research.sadl.reasoner.ConfigurationException, com.ge.research.sadl.reasoner.TripleNotFoundException, com.ge.research.sadl.reasoner.ReasonerNotFoundException
ISadlServer
addTriple
in interface ISadlServer
subjName
- the URI of the subjectpredName
- the URI of the propertyobjValue
- the URI of the object value for an ObjectProperty or a value that will be interpreted for a DatatypePropertycom.ge.research.sadl.reasoner.ConfigurationException
com.ge.research.sadl.reasoner.TripleNotFoundException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
public boolean deleteTriple(java.lang.String subjName, java.lang.String predName, java.lang.Object objValue) throws com.ge.research.sadl.reasoner.ConfigurationException, com.ge.research.sadl.reasoner.TripleNotFoundException, com.ge.research.sadl.reasoner.ReasonerNotFoundException
ISadlServer
deleteTriple
in interface ISadlServer
com.ge.research.sadl.reasoner.ConfigurationException
com.ge.research.sadl.reasoner.TripleNotFoundException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
public boolean reset() throws com.ge.research.sadl.reasoner.ReasonerNotFoundException
ISadlServer
reset
in interface ISadlServer
com.ge.research.sadl.reasoner.ReasonerNotFoundException
public java.lang.String prepareQuery(java.lang.String query) throws com.ge.research.sadl.reasoner.InvalidNameException, com.ge.research.sadl.reasoner.ReasonerNotFoundException, com.ge.research.sadl.reasoner.ConfigurationException
ISadlServer
prepareQuery
in interface ISadlServer
com.ge.research.sadl.reasoner.InvalidNameException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
com.ge.research.sadl.reasoner.ConfigurationException
public java.lang.String parameterizeQuery(java.lang.String query, java.util.List<java.lang.Object> values) throws com.ge.research.sadl.reasoner.InvalidNameException, com.ge.research.sadl.reasoner.ConfigurationException, com.ge.research.sadl.reasoner.ReasonerNotFoundException
ISadlServer
parameterizeQuery
in interface ISadlServer
query
- -- SPARQL query or update stringvalues
- -- parameter values to be substitutedcom.ge.research.sadl.reasoner.InvalidNameException
com.ge.research.sadl.reasoner.ConfigurationException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
public void setOwlFileOutputFormat(java.lang.String outputFormat)
ISadlServer
setOwlFileOutputFormat
in interface ISadlServer
outputFormat
- -- "N-TRIPLE", "N3", or "RDF/XML"public java.lang.String getKBaseIdentifier() throws com.ge.research.sadl.reasoner.ConfigurationException
ISadlServer
getKBaseIdentifier
in interface ISadlServer
com.ge.research.sadl.reasoner.ConfigurationException
public java.lang.String getModelName() throws java.io.IOException
ISadlServer
getModelName
in interface ISadlServer
java.io.IOException
public java.lang.String getReasonerVersion() throws com.ge.research.sadl.reasoner.ConfigurationException
ISadlServer
getReasonerVersion
in interface ISadlServer
com.ge.research.sadl.reasoner.ConfigurationException
public javax.activation.DataSource getDerivations() throws com.ge.research.sadl.reasoner.ConfigurationException, com.ge.research.sadl.reasoner.InvalidDerivationException
ISadlServer
getDerivations
in interface ISadlServer
com.ge.research.sadl.reasoner.ConfigurationException
com.ge.research.sadl.reasoner.InvalidDerivationException
public void setServiceNameMap(java.util.Map<java.lang.String,java.lang.String[]> serviceNameMap)
ISadlServer
setServiceNameMap
in interface ISadlServer
serviceNameMap
- -- service name mappublic java.util.Map<java.lang.String,java.lang.String[]> getServiceNameMap()
ISadlServer
getServiceNameMap
in interface ISadlServer
public void collectTimingInformation(boolean bCollect)
ISadlServer
collectTimingInformation
in interface ISadlServer
bCollect
- -- true to collect timing information; false otherwisepublic void setKbaseRoot(java.lang.String _kbaseRoot) throws com.ge.research.sadl.reasoner.ConfigurationException
ISadlServer
setKbaseRoot
in interface ISadlServer
com.ge.research.sadl.reasoner.ConfigurationException
public java.lang.String getKbaseRoot()
ISadlServer
getKbaseRoot
in interface ISadlServer
public com.ge.research.sadl.reasoner.ResultSet[] atomicQuery(java.lang.String serviceName, javax.activation.DataSource dataSrc, java.lang.String inputFormat, java.lang.String[] sparql) throws java.io.IOException, com.ge.research.sadl.reasoner.ConfigurationException, NamedServiceNotFoundException, com.ge.research.sadl.reasoner.QueryParseException, com.ge.research.sadl.reasoner.ReasonerNotFoundException, SessionNotFoundException, com.ge.research.sadl.reasoner.InvalidNameException, com.ge.research.sadl.reasoner.QueryCancelledException
ISadlServer
atomicQuery
in interface ISadlServer
serviceName
- -- the name of the service, which is used to lookup the knowledgeBaseIdentifier and modelNamedataSrc
- -- the DataSource to supply instance data to the modelinputFormat
- -- "N-TRIPLE", "N3", or "RDF/XML"sparql
- -- a array of queries to be executedjava.io.IOException
com.ge.research.sadl.reasoner.ConfigurationException
NamedServiceNotFoundException
com.ge.research.sadl.reasoner.QueryParseException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
SessionNotFoundException
com.ge.research.sadl.reasoner.InvalidNameException
com.ge.research.sadl.reasoner.QueryCancelledException
public com.ge.research.sadl.reasoner.ResultSet[] atomicQueryCsvData(java.lang.String serviceName, javax.activation.DataSource csvDataSrc, boolean includesHeader, java.lang.String csvTemplate, java.lang.String[] sparql) throws java.io.IOException, com.ge.research.sadl.reasoner.ConfigurationException, NamedServiceNotFoundException, com.ge.research.sadl.reasoner.QueryParseException, com.ge.research.sadl.reasoner.ReasonerNotFoundException, SessionNotFoundException, com.ge.research.sadl.reasoner.InvalidNameException, com.ge.research.sadl.importer.TemplateException, com.ge.research.sadl.reasoner.QueryCancelledException
ISadlServer
atomicQueryCsvData
in interface ISadlServer
serviceName
- -- the name of the service, which is used to lookup the knowledgeBaseIdentifier and modelNamecsvDataSrc
- -- the CSV DataSource to supply instance data to the modelincludesHeader
- -- true if the CSV file contains header information in the first rowcsvTemplate
- -- template mapping data streamsparql
- -- a array of queries to be executedjava.io.IOException
com.ge.research.sadl.reasoner.ConfigurationException
NamedServiceNotFoundException
com.ge.research.sadl.reasoner.QueryParseException
com.ge.research.sadl.reasoner.ReasonerNotFoundException
SessionNotFoundException
com.ge.research.sadl.reasoner.InvalidNameException
com.ge.research.sadl.importer.TemplateException
com.ge.research.sadl.reasoner.QueryCancelledException
public java.lang.String setInstanceDataNamespace(java.lang.String namespace) throws com.ge.research.sadl.reasoner.InvalidNameException
ISadlServer
setInstanceDataNamespace
in interface ISadlServer
namespace
- -- the default instance data namespacecom.ge.research.sadl.reasoner.InvalidNameException
public java.lang.String getInstanceDataNamespace()
ISadlServer
getInstanceDataNamespace
in interface ISadlServer
public java.lang.String getInstanceModelName()
ISadlServer
getInstanceModelName
in interface ISadlServer
public java.lang.String createInstance(java.lang.String name, java.lang.String className) throws com.ge.research.sadl.reasoner.ConfigurationException, com.ge.research.sadl.reasoner.InvalidNameException, java.io.IOException
ISadlServer
createInstance
in interface ISadlServer
name
- -- the name of the new instance to be created. If only a local fragment is given (no namespace), the instance will be created in the default namespace.className
- -- the name of the OntClass to which the new Individual will belongcom.ge.research.sadl.reasoner.ConfigurationException
com.ge.research.sadl.reasoner.InvalidNameException
java.io.IOException
public void setQueryTimeout(long timeout) throws com.ge.research.sadl.reasoner.ReasonerNotFoundException, SessionNotFoundException
ISadlServer
setQueryTimeout
in interface ISadlServer
timeout
- (in milliseconds)com.ge.research.sadl.reasoner.ReasonerNotFoundException
SessionNotFoundException
public boolean clearCache() throws com.ge.research.sadl.reasoner.InvalidNameException, SessionNotFoundException
ISadlServer
clearCache
in interface ISadlServer
com.ge.research.sadl.reasoner.InvalidNameException
SessionNotFoundException