DomainEntityManagerLocal.java from Texai at Krugle
Show DomainEntityManagerLocal.java syntax highlighted
package org.texai.kb.ejb.session;
import com.sleepycat.je.Transaction;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import javax.ejb.Local;
import org.texai.kb.ejb.session.shared.TermFinderFacadeLocal;
import org.texai.kb.entity.AtomicTerm;
import org.texai.kb.entity.BinaryGAF;
import org.texai.kb.entity.Formula;
import org.texai.kb.entity.AbstractReifiedTerm;
import org.texai.kb.entity.Symbol;
import org.texai.kb.entity.AbstractTerm;
/**
* This is the business interface for DomainEntityManager enterprise bean.
*/
@Local
public interface DomainEntityManagerLocal {
// initialization
/** Sets the home directory of the Oracle Berkeley DB.
*
* @param environmentPathName the home directory of the Oracle Berkeley DB
*/
void setEnvironmentPathName(final String environmentPathName);
/** Injects the shared session bean dependencies when executed out of the container. */
void injectSharedBeanDependencies();
/** Sets the creator.
*
* @param creator the creator
*/
void setCreator(final AbstractReifiedTerm creator);
/** Gets the creator.
*
* @return the creator
*/
AbstractReifiedTerm getCreator();
/** Sets the creation purpose.
*
* @param creationPurpose the creation purpose
*/
void setCreationPurpose(final AbstractReifiedTerm creationPurpose);
/** Gets the creation purpose.
*
* @return the creation purpose
*/
AbstractReifiedTerm getCreationPurpose();
// transactions
/** Begins a new transaction. */
void beginTransaction();
/** Commits the current transaction. */
void commit();
/** Aborts the current transaction. */
void abort();
// facade methods from the term finder
/** Finds the AtomicTerm having the given termName or null if not found.
*
* @param termName the given term name
* @param kbPartition the KB partition, or null to search all partitions
* @return the AtomicTerm having the given termName or null if not found
*/
AtomicTerm findAtomicTermByTermName(final String termName, final AtomicTerm kbPartition);
/** Creates the Symbol having the given nameValue.
*
* @param nameValue the given name value
* @return the Symbol having the given nameValue
*/
Symbol createSymbolByNameValue(final String nameValue);
/** Creates the Formula having the given term list.
*
* @param termList the list of terms that constitute this formula
* @param kbPartition the KB partition
* @return the persisted Formula having the given term list
*/
Formula createFormulaByTermList(final List<AbstractTerm> termList, final AtomicTerm kbPartition);
/**
* Creates the defined atomic term.
*
* @param termName the term name
* @param prettyName the pretty name
* @param commentString the comment string
* @param isaTerms the list of isa (type) terms
* @param kbPartition the KB partition
* @return the specified defined term
*/
AtomicTerm createDefinedTerm(
final String termName,
final String prettyName,
final String commentString,
final List<AbstractReifiedTerm> isaTerms,
final AtomicTerm kbPartition);
/**
* Creates the specified binary predicate term with default list of isa (type) terms [BinaryPredicate, PredicateFocalInArg1],
* and list of genlPreds (super property) terms [conceptuallyRelated].
*
* @param termName the predicate name
* @param prettyName the pretty name
* @param commentString the comment string
* @param argConstraintTerms the list of argument constraint terms
* @param kbPartition the KB partition
* @return the specified binary predicate term
*/
AtomicTerm createBinaryPredicateTerm(
final String termName,
final String prettyName,
final String commentString,
final List<AbstractReifiedTerm> argConstraintTerms,
final AtomicTerm kbPartition);
/**
* Creates the specified binary predicate term.
*
*
* @param termName the predicate name
* @param prettyName the pretty name
* @param commentString the comment string
* @param isaTerms the list of isa (type) terms, defaults to [BinaryPredicate, PredicateFocalInArg1]
* @param genlPredTerms the list of genlPreds (super property) terms, defaults to [conceptuallyRelated]
* @param argConstraintTerms the list of argument constraint terms
* @param kbPartition the KB partition
* @return the specified binary predicate term
*/
AtomicTerm createBinaryPredicateTerm(
final String termName,
final String prettyName,
final String commentString,
final List<AbstractReifiedTerm> isaTerms,
final List<AbstractReifiedTerm> genlPredTerms,
final List<AbstractReifiedTerm> argConstraintTerms,
final AtomicTerm kbPartition);
/**
* Creates the specified collection term.
*
* @param termName the term name
* @param prettyName the pretty name
* @param commentString the comment string
* @param isaTerms the list of isa (type) terms
* @param genlsTerms the list of genls (superclass) terms
* @param kbPartition the KB partition
* @return the specified collection term
*/
AtomicTerm createCollectionTerm(
final String termName,
final String prettyName,
final String commentString,
final List<AbstractReifiedTerm> isaTerms,
final List<AbstractReifiedTerm> genlsTerms,
final AtomicTerm kbPartition);
/**
* Creates the specified context term.
*
* @param termName the term name
* @param prettyName the pretty name
* @param commentString the comment string
* @param isaTerms the list of isa (type) terms which defaults to [Microtheory] when empty
* @param genlMtTerms the list of genlMt (super context) terms which defaults to [BaseKB] when empty
* @param kbPartition the KB partition
* @return the specified collection term
*/
AtomicTerm createContextTerm(
final String termName,
final String prettyName,
final String commentString,
final List<AbstractReifiedTerm> isaTerms,
final List<AbstractReifiedTerm> genlMtTerms,
final AtomicTerm kbPartition);
// facade methods for the domain entity loader
/** Loads the domain entity from propositions in the knowledge base given the instance term that represents it.
*
* @param instanceTerm the atomic term that represents the domain entity
* @return the domain entity
*/
Object loadDomainEntity(final AtomicTerm instanceTerm);
/** Loads the domain entity from propositions in the knowledge base given its local term id.
*
* @param termId the local term id of the atomic term that represents the domain entity
* @return the domain entity
*/
Object loadDomainEntity(final int termId);
/** Loads the set of domain entities having the given property and value.
*
* @param property the given property
* @param value the value of the property
* @param domainEntityClass the class of the desired domain entity
* @return the domain entities having the given property and value
*/
Set<Object> loadDomainEntitiesByPropertyValue(
final AtomicTerm property,
final Object value,
final Class domainEntityClass);
/** Loads the domain entity from propositions in the knowledge base given an identifying property and value.
*
* @param property the identifying property
* @param value the value of the property which identifies the desired domain entity
* @param domainEntityClass the class of the desired domain entity
* @return the domain entity having the given property and value, or null if not found
*/
Object loadDomainEntityByIndentifyingPropertyValue(
final AtomicTerm property,
final Object value,
final Class domainEntityClass);
/** Returns an iterator over the set of domain entity terms that represent instances of the given domain entity class.
*
* @param domainEntityClass the given domain entity class
*/
Iterator<Object> domainEntityIterator(final Class domainEntityClass);
// facade methods for the domain entity persister
/** Persists the given domain entity as propositions in the knowledge base.
*
* @param domainEntity the domain entity
* @return the instance term that represents the domain entity
*/
AtomicTerm persistDomainEntity(final Object domainEntity);
/** Sets the indicator to validate persisted gafs as a well-formed formulas.
*
* @param validateWellFormedFormula the indicator to validate persisted gafs as a well-formed formulas
*/
void setValidateWellFormedFormula(boolean validateWellFormedFormula);
// facade methods for the domain entity persister
/** Deletes the given domain entity from the knowledge base.
*
* @param domainEntity the domain entity
*/
void deleteDomainEntity(final Object domainEntity);
// facade methods for the association finder
/** Returns an iterator over the set of binary gafs with the given predicate and given relevant context.
*
* @param predicate the predicate of matching binary gafs
* @param context the most specific context of those from which matching gafs are gathered
* @return an iterator over the binary ground atomic formulas having the given predicate and context
*/
Iterator<BinaryGAF> binaryGAFByPredicateIterator(
final AtomicTerm predicate,
final AbstractReifiedTerm context);
// accessors to the wrapped session beans
/** Gets the term finder facade.
*
* @return the term finder facade
*/
TermFinderFacadeLocal getTermFinderFacade();
}
See more files for this project here