public final class Protempa extends Object implements AutoCloseable
| Constructor and Description |
|---|
Protempa(DataSource dataSource,
KnowledgeSource knowledgeSource,
AlgorithmSource algorithmSource,
TermSource termSource)
Constructor that configures PROTEMPA not to cache found abstract
parameters.
|
Protempa(DataSource dataSource,
KnowledgeSource knowledgeSource,
AlgorithmSource algorithmSource,
TermSource termSource,
boolean cacheFoundAbstractParameters)
Constructor that lets the user specify whether or not to cache found
abstract parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(ProtempaEventListener eventListener) |
Query |
buildQuery(QueryBuilder queryBuilder)
Convenience method for calling
QueryBuilder.build(org.protempa.KnowledgeSource, org.protempa.AlgorithmSource)
with this Protempa instance's knowledge source and algorithm source. |
void |
cancel()
Cancels an executing query.
|
void |
clear()
Clears resources created by this object and the data source, knowledge
source and algorithm source.
|
void |
close()
Closes resources created by this object and the data source, knowledge
source, and algorithm source.
|
void |
execute(Query query,
Destination destination)
Executes a query.
|
AlgorithmSource |
getAlgorithmSource()
Gets the algorithm source.
|
DataSource |
getDataSource()
Gets the data source.
|
KnowledgeSource |
getKnowledgeSource()
Gets the knowledge source.
|
String[] |
getSupportedPropositionIds(Destination destination) |
TermSource |
getTermSource()
Gets the term source.
|
static Protempa |
newInstance(SourceFactory sourceFactory) |
static Protempa |
newInstance(SourceFactory sourceFactory,
boolean useCache) |
static Protempa |
newInstance(String configurationId) |
static Protempa |
newInstance(String configurationsId,
boolean useCache) |
void |
removeEventListener(ProtempaEventListener eventListener) |
void |
validateDataSourceBackendConfigurations() |
DataValidationEvent[] |
validateDataSourceBackendData()
Runs each data source backend's data validation routine.
|
public Protempa(DataSource dataSource, KnowledgeSource knowledgeSource, AlgorithmSource algorithmSource, TermSource termSource) throws ProtempaStartupException
dataSource - a DataSource. Will be closed when
close() is called. May be null if you're not
retrieving data from a data source (for example, you're only working with
a persistent store).knowledgeSource - a KnowledgeSource. Will be closed when
close() is called.algorithmSource - an AlgorithmSource. Will be closed when
close() is called. May be null if you're not
computing any low-level abstractions.termSource - a TermSource. Will be closed when
close() is called. May be null if you're not using
terms.ProtempaStartupException - if an error occur in starting Protempa.
There frequently will be a nested exception that provides more detail.public Protempa(DataSource dataSource, KnowledgeSource knowledgeSource, AlgorithmSource algorithmSource, TermSource termSource, boolean cacheFoundAbstractParameters) throws ProtempaStartupException
dataSource - a DataSource. Will be closed when
close() is called. May be null if you're not
retrieving data from a data source (for example, you're only working with
a persistent store).knowledgeSource - a KnowledgeSource. Will be closed when
close() is called.algorithmSource - an AlgorithmSource. Will be closed when
close() is called. May be null if you're not
computing any low-level abstractions.termSource - a TermSource. Will be closed when
close() is called. May be null if you're not using
terms.cacheFoundAbstractParameters - true to cache found
abstract parameters, false not to cache found abstract
parameters.ProtempaStartupException - if an error occur in starting Protempa.
There frequently will be a nested exception that provides more detail.public static Protempa newInstance(String configurationId) throws ProtempaStartupException
ProtempaStartupExceptionpublic static Protempa newInstance(SourceFactory sourceFactory) throws ProtempaStartupException
ProtempaStartupExceptionpublic static Protempa newInstance(String configurationsId, boolean useCache) throws ProtempaStartupException
ProtempaStartupExceptionpublic static Protempa newInstance(SourceFactory sourceFactory, boolean useCache) throws ProtempaStartupException
ProtempaStartupExceptionpublic DataSource getDataSource()
DataSource. Will be closed when close() is
called.public KnowledgeSource getKnowledgeSource()
KnowledgeSource. Will be closed when close()
is called.public AlgorithmSource getAlgorithmSource()
AlgorithmSource. Will be closed when close()
is called.public TermSource getTermSource()
TermSource. Will be closed when close() is
calledpublic void addEventListener(ProtempaEventListener eventListener)
public void removeEventListener(ProtempaEventListener eventListener)
public Query buildQuery(QueryBuilder queryBuilder) throws QueryBuildException
QueryBuilder.build(org.protempa.KnowledgeSource, org.protempa.AlgorithmSource)
with this Protempa instance's knowledge source and algorithm source.queryBuilder - a query specification.QueryBuildException - if the query specification failed validation
or some other error occurred.public String[] getSupportedPropositionIds(Destination destination) throws GetSupportedPropositionIdsException
public void execute(Query query, Destination destination) throws QueryException
Query and the proposition ids returned from the
results handler's QueryResultsHandler#getPropositionIdsNeeded()
method.query - a Query. Cannot be null.destination - a destination. Cannot be null.QueryException - if an error occurred during query.public void cancel()
execute(org.protempa.query.Query, org.protempa.dest.Destination).public void validateDataSourceBackendConfigurations()
throws DataSourceValidationIncompleteException,
DataSourceFailedConfigurationValidationException
public DataValidationEvent[] validateDataSourceBackendData() throws DataSourceFailedDataValidationException, DataSourceValidationIncompleteException
DataSourceFailedDataValidationException - if validation failed.DataSourceValidationIncompleteException - if an error occurred
during validation that prevented its completion.public void close()
throws CloseException
close in interface AutoCloseableCloseException - if an error occurs while closing
resources.public void clear()
Copyright © 2012–2017 Emory University. All rights reserved.