TermManagerLocal.java from Texai at Krugle
Show TermManagerLocal.java syntax highlighted
/*
* TermManagerLocal.java
*
* Created on April 25, 2007, 10:23 AM
*
* Description: Defines the interface for the TermManagerBean that gathers all the
* term accessing interfaces: TermFinderFacadeLocal, TermDeleterFacadeLocal,
* TermDefinitionAccessorLocal, AssociationFinderLocal and AssociationEditorLocal.
*
* Copyright (C) April 25, 2007 Stephen L. Reed.
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.texai.kb.ejb.session.shared;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.texai.kb.entity.AbstractReifiedTerm;
import org.texai.kb.entity.AbstractTerm;
import org.texai.kb.entity.AtomicTerm;
import org.texai.kb.entity.BinaryGAF;
import org.texai.kb.entity.Formula;
import org.texai.kb.entity.NonAtomicTerm;
import org.texai.kb.entity.PByteArray;
import org.texai.kb.entity.PDate;
import org.texai.kb.entity.PDouble;
import org.texai.kb.entity.PLong;
import org.texai.kb.entity.PString;
import org.texai.kb.entity.PVariable;
import org.texai.kb.entity.QuaternaryGAF;
import org.texai.kb.entity.QuintaryGAF;
import org.texai.kb.entity.Rule;
import org.texai.kb.entity.Symbol;
import org.texai.kb.entity.TernaryGAF;
import org.texai.kb.entity.UnaryGAF;
/**
*
* @author reed
*/
public interface TermManagerLocal {
// from TermFinderFacadeLocal
/** Finds the term having the given value.
*
* @param value the given value object
* @param kbPartition the KB partition
* @return the term having the given value
*/
AbstractTerm findTermByValue(final Object value, final AtomicTerm kbPartition);
/** Finds the Term having the given termType and termId.
*
* @param termType the given term type
* @param termId the given term id
* @param kbPartition the KB partition
* @return the Term having the given termType and termId
* @throws TexaiException if the term is not found
*/
AbstractTerm findTermByTermTypeAndId(final byte termType, final int termId, final AtomicTerm kbPartition);
/** Finds the Symbol having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the Symbol having the given termId
* @throws TexaiException if the term is not found
*/
Symbol findSymbolByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the Symbol having the given nameValue or null if not found.
*
* @param nameValue the given name value
* @param kbPartition the KB partition
* @return the Symbol having the given nameValue or null if not found
*/
Symbol findSymbolByNameValue(final String nameValue, final AtomicTerm kbPartition);
/** Finds the PVariable having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the PVariable having the given termId
* @throws TexaiException if the term is not found
*/
PVariable findPVariableByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the PVariable having the given nameValue or null if not found.
*
* @param kbPartition the KB partition
* @param nameValue the given name value
* @return the PVariable having the given nameValue or null if not found
*/
PVariable findPVariableByNameValue(final String nameValue, final AtomicTerm kbPartition);
/** Finds the PLong having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the PLong having the given termId
* @throws TexaiException if the term is not found
*/
PLong findPLongByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the PLong having the given longValue or null if not found.
*
* @param longValue the given long value
* @param kbPartition the KB partition
* @return the PLong having the given nameValue or null if not found
*/
PLong findPLongByLongValue(final Long longValue, final AtomicTerm kbPartition);
/** Finds the PDouble having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the PDouble having the given termId
* @throws TexaiException if the term is not found
*/
PDouble findPDoubleByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the PDouble having the given doubleValue or null if not found.
*
* @param doubleValue the given double value
* @return the PDouble having the given doubleValue or null if not found
*/
PDouble findPDoubleByDoubleValue(final Double doubleValue, final AtomicTerm kbPartition);
/** Finds the PString having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the PString having the given termId
* @throws TexaiException if the term is not found
*/
PString findPStringByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the PString having the given stringValue or null if not found.
*
* @param kbPartition the KB partition
* @param stringValue the given string value
* @return the PString having the given stringValue or null if not found
*/
PString findPStringByStringValue(final String stringValue, final AtomicTerm kbPartition);
/** Finds the PByteArray having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the PByteArray having the given termId
* @throws TexaiException if the term is not found
*/
PByteArray findPByteArrayByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the PDate having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the PDate having the given termId
* @throws TexaiException if the term is not found
*/
PDate findPDateByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the PDate having the given dateValue or null if not found.
*
* @param dateValue the given date value
* @return the PDate having the given dateValue or null if not found
*/
PDate findPDateByDateValue(final Date dateValue, final AtomicTerm kbPartition);
/** Finds the AtomicTerm having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the AtomicTerm having the given termId
* @throws TexaiException if the term is not found
*/
AtomicTerm findAtomicTermByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the AtomicTerm having the given termName or null if not found.
*
* @param termName the given term name
* @param kbPartition the KB partition
* @return the AtomicTerm having the given termName or null if not found
*/
AtomicTerm findAtomicTermByTermName(final String termName, final AtomicTerm kbPartition);
/** Finds the NonAtomicTerm having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the NonAtomicTerm having the given termId
* @throws TexaiException if the term is not found
*/
NonAtomicTerm findNonAtomicTermByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the NonAtomicTerm having the given termName or null if not found.
*
* @param termName the given term name
* @param kbPartition the KB partition
* @return the NonAtomicTerm having the given termName or null if not found
*/
NonAtomicTerm findNonAtomicTermByTermName(final String termName, final AtomicTerm kbPartition);
/** Finds the Formula having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the Formula having the given termId
* @throws TexaiException if the term is not found
*/
Formula findFormulaByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the Formula having the given term list or null if not found.
*
* @param termList the given term list
* @param kbPartition the KB partition
* @return the Formula having the given term list or null if not found
*/
Formula findFormulaByTermList(final List<AbstractTerm> termList, final AtomicTerm kbPartition);
/** Finds the Formula having the given formulaString or null if not found.
*
* @param formulaString the given formula string
* @param kbPartition the KB partition
* @return the Formula having the given formulaString or null if not found
*/
Formula findFormulaByFormulaString(final String formulaString, final AtomicTerm kbPartition);
/** Finds the Rule having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the Rule having the given termId
* @throws TexaiException if the term is not found
*/
Rule findRuleByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the Rule having the given formula or null if not found.
*
* @param formula the given formula
* @param kbPartition the KB partition
* @return the Rule having the given formula or null if not found
*/
Rule findRuleByFormula(final Formula formula, final AtomicTerm kbPartition);
/** Finds the UnaryGAF having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the UnaryGAF having the given termId
* @throws TexaiException if the term is not found
*/
UnaryGAF findUnaryGAFByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the UnaryGAF having the given constitutents or null if not found.
*
* @param predicate the given predicate
* @param args the argument list
* @param context the context
* @param kbPartition the KB partition
* @return the UnaryGAF having the given constitutents or null if not found
*/
UnaryGAF findUnaryGAFByConstituents(
final AbstractReifiedTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Finds the BinaryGAF having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the BinaryGAF having the given termId
* @throws TexaiException if the term is not found
*/
BinaryGAF findBinaryGAFByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the BinaryGAF having the given constitutents or null if not found.
*
* @param predicate the given predicate
* @param args the argument list
* @param context the context
* @param kbPartition the KB partition
* @return the BinaryGAF having the given constitutents or null if not found
*/
BinaryGAF findBinaryGAFByConstituents(
final AbstractReifiedTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Finds the TernaryGAF having the given termId.
*
* @param termId the given term id
* @return the TernaryGAF having the given termId
* @param kbPartition the KB partition
* @throws TexaiException if the term is not found
*/
TernaryGAF findTernaryGAFByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the TernaryGAF having the given constitutents or null if not found.
*
* @param predicate the given predicate
* @param args the argument list
* @param context the context
* @param kbPartition the KB partition
* @return the TernaryGAF having the given constitutents or null if not found
*/
TernaryGAF findTernaryGAFByConstituents(
final AbstractReifiedTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Finds the QuaternaryGAF having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the QuaternaryGAF having the given termId
* @throws TexaiException if the term is not found
*/
QuaternaryGAF findQuaternaryGAFByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the QuaternaryGAF having the given constitutents or null if not found.
*
* @param predicate the given predicate
* @param args the argument list
* @param context the context
* @param kbPartition the KB partition
* @return the QuaternaryGAF having the given constitutents or null if not found
*/
QuaternaryGAF findQuaternaryGAFByConstituents(
final AbstractReifiedTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Finds the QuintaryGAF having the given termId.
*
* @param termId the given term id
* @param kbPartition the KB partition
* @return the QuintaryGAF having the given termId
* @throws TexaiException if the term is not found
*/
QuintaryGAF findQuintaryGAFByTermId(final int termId, final AtomicTerm kbPartition);
/** Finds the QuintaryGAF having the given constitutents or null if not found.
*
* @param predicate the given predicate
* @param args the argument list
* @param context the context
* @param kbPartition the KB partition
* @return the QuintaryGAF having the given constitutents or null if not found
*/
QuintaryGAF findQuintaryGAFByConstituents(
final AbstractReifiedTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Creates the Symbol having the given nameValue.
*
* @param nameValue the given name value
* @param kbPartition the KB partition
* @return the Symbol having the given nameValue
*/
Symbol createSymbolByNameValue(final String nameValue, final AtomicTerm kbPartition);
/** Creates the Symbol having the given nameValue.
*
* @param termId the given term id
* @param nameValue the given name value
* @param kbPartition the KB partition
* @return the Symbol having the given nameValue
*/
Symbol createSymbolByNameValue(final int termId, final String nameValue, final AtomicTerm kbPartition);
/** Creates the PVariable having the given nameValue.
*
* @param nameValue the given name value
* @param kbPartition the KB partition
* @return the PVariable having the given nameValue
*/
PVariable createPVariableByNameValue(final String nameValue, final AtomicTerm kbPartition);
/** Creates the PVariable having the given nameValue.
*
* @param termId the given term id
* @param nameValue the given name value
* @param kbPartition the KB partition
* @return the PVariable having the given nameValue
*/
PVariable createPVariableByNameValue(final int termId, final String nameValue, final AtomicTerm kbPartition);
/** Creates the PLong having the given longValue.
*
* @param longValue the given long value
* @param kbPartition the KB partition
* @return the PLong having the given nameValue
*/
PLong createPLongByLongValue(final Long longValue, final AtomicTerm kbPartition);
/** Creates the PLong having the given longValue.
*
* @param termId the given term id
* @param longValue the given long value
* @param kbPartition the KB partition
* @return the PLong having the given nameValue
*/
PLong createPLongByLongValue(final int termId, final Long longValue, final AtomicTerm kbPartition);
/** Creates the PDouble having the given doubleValue.
*
* @param doubleValue the given double value
* @param kbPartition the KB partition
* @return the PLong having the given doubleValue
*/
PDouble createPDoubleByDoubleValue(final Double doubleValue, final AtomicTerm kbPartition);
/** creates the PDouble having the given doubleValue.
*
* @param termId the given term id
* @param doubleValue the given double value
* @param kbPartition the KB partition
* @return the PLong having the given doubleValue
*/
PDouble createPDoubleByDoubleValue(final int termId, final Double doubleValue, final AtomicTerm kbPartition);
/** Creates the PString having the given stringValue.
*
* @param stringValue the given double value
* @param kbPartition the KB partition
* @return the PLong having the given doubleValue
*/
PString createPStringByStringValue(final String stringValue, final AtomicTerm kbPartition);
/** Creates the PString having the given stringValue.
*
* @param termId the given term id
* @param stringValue the given double value
* @param kbPartition the KB partition
* @return the PLong having the given doubleValue
*/
PString createPStringByStringValue(final int termId, final String stringValue, final AtomicTerm kbPartition);
/** Creates the PDate having the given dateValue.
*
* @param dateValue the given date value
* @param kbPartition the KB partition
* @return the PDate having the given dateValue
*/
PDate createPDateByDateValue(final Date dateValue, final AtomicTerm kbPartition);
/** creates the PDate having the given dateValue.
*
* @param termId the given term id
* @param dateValue the given date value
* @param kbPartition the KB partition
* @return the PDate having the given dateValue
*/
PDate createPDateByDateValue(final int termId, final Date dateValue, final AtomicTerm kbPartition);
/** Creates the AtomicTerm having the given termName.
*
* @param uuid the UUID
* @param termName the term name
* @param prettyName the pretty name
* @param kbPartition the KB partition
* @return the AtomicTerm having the given termName
*/
AtomicTerm createBootstrapAtomicTerm(
final UUID uuid,
final String termName,
final String prettyName,
final AtomicTerm kbPartition);
/** Creates the AtomicTerm having the given termName.
*
* @param termName the term name
* @param prettyName the pretty name
* @param creator the creator
* @param creationPurpose the creation purpose
* @param kbPartition the KB partition
* @return the AtomicTerm having the given termName
*/
AtomicTerm createAtomicTermByTermName(
final String termName,
final String prettyName,
final AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
final AtomicTerm kbPartition);
/** Creates the NonAtomicTerm having the given termName.
*
* @param termName the term name
* @param prettyName the pretty name
* @param formula the formula
* @param creator the creator
* @param creationPurpose the creation purpose
* @param kbPartition the KB partition
* @return the NonAtomicTerm having the given termName or a new one having
* the given constituents
*/
NonAtomicTerm createNonAtomicTermByTermName(
final String termName,
final String prettyName,
final Formula formula,
final AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
final AtomicTerm kbPartition);
/** Creates the Formula having the given term list.
*
* @param formulaTerms the list of terms that constitute this formula
* @param creator the creator
* @param creationPurpose the creation purpose
* @param kbPartition the KB partition
* @return the persisted Formula having the given term list
*/
Formula createFormulaByTermList(
final List<AbstractTerm> formulaTerms,
final AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
final AtomicTerm kbPartition);
/** Creates (with the term list omitted) the Formula having the given formulaString.
*
* @param formulaString the given formula string
* @param creator the creator
* @param creationPurpose the creation purpose
* @param kbPartition the KB partition
* @return the persisted Formula having the given formulaString or a new Formula having the
* given term list
*/
Formula createFormulaByFormulaString(
final String formulaString,
final AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
final AtomicTerm kbPartition);
/** Creates the Rule having the given formula.
*
* @param formula the given formula
* @param context the context
* @param strength the strength
* @param creator the creator
* @param creationPurpose the creation purpose
* @param kbPartition the KB partition
* @return the Rule having the given formulaString
*/
Rule createRuleByFormula(
final Formula formula,
final AbstractReifiedTerm context,
final Double strength,
final AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
final AtomicTerm kbPartition);
/** Creates the UnaryGAF having the given constitutents.
*
* @param predicate the given predicate
* @param args the argument list
* @param context the context
* @param strength the assertion strength
* @param generatedPhrase the generated phrase for this ground atomic formula
* @param creator the creator
* @param creationPurpose the creation purpose
* @param kbPartition the KB partition
* @return the UnaryGAF having the given constitutents
*/
UnaryGAF createUnaryGAFByConstituents(
final AbstractReifiedTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final Double strength,
final String generatedPhrase,
final AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
final AtomicTerm kbPartition);
/**
* Creates the BinaryGAF having the given constitutents.
*
* @param predicate the given predicate
* @param args the argument list
* @param context the context
* @param strength the assertion strength
* @param generatedPhrase the generated phrase for this ground atomic formula
* @param validateWellFormedFormula the indicator to validate the gaf as a well-formed formula
* @param creator the creator
* @param creationPurpose the creation purpose
* @param kbPartition the KB partition
* @return the BinaryGAF having the given constitutents
*/
BinaryGAF createBinaryGAFByConstituents(
final AbstractReifiedTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final Double strength,
final String generatedPhrase,
boolean validateWellFormedFormula,
final AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
final AtomicTerm kbPartition);
/** Creates the TernaryGAF having the given constitutents.
*
* @param predicate the given predicate
* @param args the argument list
* @param context the context
* @param strength the assertion strength
* @param generatedPhrase the generated phrase for this ground atomic formula
* @param creator the creator
* @param creationPurpose the creation purpose
* @param kbPartition the KB partition
* @return the TernaryGAF having the given constitutents
*/
TernaryGAF createTernaryGAFByConstituents(
final AbstractReifiedTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final Double strength,
final String generatedPhrase,
final AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
final AtomicTerm kbPartition);
/** Creates the QuaternaryGAF having the given constitutents.
*
* @param predicate the given predicate
* @param args the argument list
* @param context the context
* @param strength the assertion strength
* @param generatedPhrase the generated phrase for this ground atomic formula
* @param creator the creator
* @param creationPurpose the creation purpose
* @param kbPartition the KB partition
* @return the QuaternaryGAF having the given constitutents
*/
QuaternaryGAF createQuaternaryGAFByConstituents(
final AbstractReifiedTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final Double strength,
final String generatedPhrase,
final AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
final AtomicTerm kbPartition);
/** Creates the QuintaryGAF having the given constitutents.
*
* @param predicate the given predicate
* @param args the argument list
* @param context the context
* @param strength the assertion strength
* @param generatedPhrase the generated phrase for this ground atomic formula
* @param creator the creator
* @param creationPurpose the creation purpose
* @param kbPartition the KB partition
* @return the QuintaryGAF having the given constitutents
*/
QuintaryGAF createQuintaryGAFByConstituents(
final AbstractReifiedTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final Double strength,
final String generatedPhrase,
final AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
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 creator the creator
* @param creationPurpose the creation purpose
* @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 AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
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 creator the creator
* @param argConstraintTerms the list of argument constraint terms
* @param creationPurpose the creation purpose
* @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 AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
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 creator the creator
* @param creationPurpose the creation purpose
* @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 AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
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 creator the creator
* @param creationPurpose the creation purpose
* @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 AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
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 creator the creator
* @param creationPurpose the creation purpose
* @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 AbstractReifiedTerm creator,
final AbstractReifiedTerm creationPurpose,
final AtomicTerm kbPartition);
/** Returns a description of why the given formula is not well formed, or an empty string if the formula is well formed.
*
* @param predicate the predicate
* @param args the argument list
* @param context the context
* @param kbPartition the KB partition
*/
String getReasonWhyFormulaIsNotWellFormed(
final AbstractReifiedTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
// from TermDeleterFacadeLocal
/** Deletes the given AtomicTerm.
*
* @param atomicTerm the given atomic term
* @param kbPartition the KB partition
*/
public void deleteAtomicTerm(final AtomicTerm atomicTerm, final AtomicTerm kbPartition);
/**
* Deletes the given domain instance term and the binary GAFs which persist its fields.
*
* @param domainInstanceTerm the domain instance term to delete
* @param kbPartition the KB partition
*/
void deleteDomainInstanceTerm(final AtomicTerm domainInstanceTerm, final AtomicTerm kbPartition);
/** Deletes the given unary ground atomic formula.
*
* @param unaryGAF the given unary ground atomic formula
* @param kbPartition the KB partition
*/
void deleteUnaryGAF(final UnaryGAF unaryGAF, final AtomicTerm kbPartition);
/** Deletes the given binary ground atomic formula.
*
* @param binaryGAF the given binary ground atomic formula
* @param kbPartition the KB partition
*/
void deleteBinaryGAF(final BinaryGAF binaryGAF, final AtomicTerm kbPartition);
/** Deletes the given ternary ground atomic formula.
*
* @param ternaryGAF the given ternary ground atomic formula
* @param kbPartition the KB partition
*/
void deleteTernaryGAF(final TernaryGAF ternaryGAF, final AtomicTerm kbPartition);
/** Deletes the given quaternary ground atomic formula.
*
* @param quaternaryGAF the given quaternary ground atomic formula
* @param kbPartition the KB partition
*/
void deleteQuaternaryGAF(final QuaternaryGAF quaternaryGAF, final AtomicTerm kbPartition);
/** Deletes the given quintary ground atomic formula.
*
* @param quintaryGAF the given quintary ground atomic formula
* @param kbPartition the KB partition
*/
void deleteQuintaryGAF(final QuintaryGAF quintaryGAF, final AtomicTerm kbPartition);
/** Delete matching binary ground atomic formulas from all contexts relevant to the given context.
*
* @param predicate the predicate that gafs must match
* @param args the arguments that gafs must match
* @param context the context the given context
* @param kbPartition the KB partition
*/
public void deleteBinaryGAFsFromRelevantContexts(
final AtomicTerm predicate,
final List<AbstractTerm> args,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
// from TermDefinitionAccessorLocal
/** Gathers the types for which the given term is a direct instance from the given context.
*
* @param term the given term
* @param context the most specific context of those from which types are gathered
* @param kbPartition the KB partition
* @return the types for which the given term is a direct instance from the given context
*/
Set<AbstractReifiedTerm> gatherTypesForTerm(
final AbstractReifiedTerm term,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Gathers the types for which the given term is a direct instance within every context.
*
* @param term the given term
* @param kbPartition the KB partition
* @return the types for which the given term is a direct instance within every context
*/
Set<AbstractReifiedTerm> gatherTypesForTerm(final AbstractReifiedTerm term, final AtomicTerm kbPartition);
/** Gathers the types for which the given term is a direct or indirect instance from the given context.
*
* @param term the given term
* @param context the most specific context of those from which types are gathered
* @param kbPartition the KB partition
* @return the types for which the given term is an instance from the given context
*/
Set<AbstractReifiedTerm> gatherAllTypesForTerm(
final AbstractReifiedTerm term,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Gathers the instances of the given collectin term from the given context.
*
* @param term the given term
* @param context the most specific context of those from which instances are gathered
* @param kbPartition the KB partition
* @return the instances of the given collectin term from the given context
*/
Set<AbstractReifiedTerm> gatherInstancesForTerm(
final AbstractReifiedTerm term,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Returns the arity of the given predicate.
*
* @param predicate the given predicate
* @param kbPartition the KB partition
* @return the arity of the given predicate
*/
int predicateArity(final AbstractReifiedTerm predicate, final AtomicTerm kbPartition);
/** Returns the list argument constraints of the given predicate, one for each
* corresponding argument position.
*
* @param predicate the given predicate
* @param kbPartition the KB partition
* @return the list argument constraints of the given predicate, one for each
* corresponding argument position
*/
List<AbstractReifiedTerm> predicateArgConstraints(final AbstractReifiedTerm predicate, final AtomicTerm kbPartition);
// from AssociationFinderLocal
/** Gets the sole term from the arg1 position of the matching binary ground atomic formula or null if not
* found.
*
* @param predicate the predicate of the matching binary gaf
* @param arg2 the second argument term of the matching binary gaf
* @param context the most specific context of those from which the matching gaf is gathered
* @param kbPartition the KB partition
* @return the sole term from the arg1 position of the matching binary ground atomic formula or null if not
* found
*/
AbstractTerm getArg1TermFromBinaryGAF(
final AtomicTerm predicate,
final AbstractTerm arg2,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Gathers the terms from the arg1 position of matching binary ground atomic formulas.
*
* @param predicate the predicate of matching binary gafs
* @param arg2 the second argument term of matching binary gafs
* @param context the most specific context of those from which matching gafs are gathered
* @param kbPartition the KB partition
* @return the terms from the arg1 position of match binary ground atomic formulas
*/
Set<AbstractTerm> gatherArg1TermsFromBinaryGAFs(
final AtomicTerm predicate,
final AbstractTerm arg2,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Gets the sole term from the arg2 position of the matching binary ground atomic formula or null if not
* found.
*
* @param predicate the predicate of the matching binary gaf
* @param arg1 the first argument term of the matching binary gaf
* @param kbPartition the KB partition
* @return the sole term from the arg2 position of the matching binary ground atomic formula or null if not
* found
*/
AbstractTerm getArg2TermFromBinaryGAF(
final AtomicTerm predicate,
final AbstractTerm arg1,
final AtomicTerm kbPartition);
/** Gets the sole term from the arg2 position of the matching binary ground atomic formula or null if not
* found.
*
* @param predicate the predicate of the matching binary gaf
* @param arg1 the first argument term of the matching binary gaf
* @param context the most specific context of those from which the matching gaf is gathered
* @param kbPartition the KB partition
* @return the sole term from the arg2 position of the matching binary ground atomic formula or null if not
* found
*/
AbstractTerm getArg2TermFromBinaryGAF(
final AtomicTerm predicate,
final AbstractTerm arg1,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Gathers the terms from the arg2 position of matching binary ground atomic formulas.
*
* @param predicate the predicate of matching binary gafs
* @param arg1 the first argument term of matching binary gafs
* @param context the most specific context of those from which matching gafs are gathered
* @param kbPartition the KB partition
* @return the terms from the arg2 position of match binary ground atomic formulas
*/
Set<AbstractTerm> gatherArg2TermsFromBinaryGAFs(
final AtomicTerm predicate,
final AbstractTerm arg1,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Gathers the ordered list of terms and corresponding strengths from the arg1 position of matching binary ground atomic formulas.
* The ordering is currently limited to the termId of the arg1s.
*
* @param predicate the predicate of matching binary gafs
* @param arg2 the second argument term of matching binary gafs
* @param context the most specific context of those from which matching gafs are gathered
* @param kbPartition the KB partition
* @return the terms and corresponding strengths from the arg1 position of matching binary ground atomic formulas
*/
List<List<Object>> gatherArg1TermsAndStrengthsFromBinaryGAFs(
final AtomicTerm predicate,
final AbstractTerm arg2,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Gathers the terms and corresponding strengths from the arg2 position of matching binary ground atomic formulas.
*
* @param predicate the predicate of matching binary gafs
* @param arg1 the first argument term of matching binary gafs
* @param context the most specific context of those from which matching gafs are gathered
* @param kbPartition the KB partition
* @return the terms and corresponding strengths from the arg2 position of matching binary ground atomic formulas
*/
List<List<Object>> gatherArg2TermsAndStrengthsFromBinaryGAFs(
final AtomicTerm predicate,
final AbstractTerm arg1,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Gathers the terms from the arg2 position of matching binary ground atomic formulas in every context.
*
* @param predicate the predicate of matching binary gafs
* @param arg1 the first argument term of matching binary gafs
* @param kbPartition the KB partition
* @return the terms from the arg2 position of match binary ground atomic formulas
*/
Set<AbstractTerm> gatherArg2TermsFromBinaryGAFs(
final AtomicTerm predicate,
final AbstractTerm arg1,
final AtomicTerm kbPartition);
/** Gathers the terms and contexts from the arg1 position of matching binary ground atomic formulas in every context.
*
* @param predicate the predicate of matching binary gafs
* @param arg2 the first argument term of matching binary gafs
* @param kbPartition the KB partition
* @return the set of pairs of terms from the arg1 position of matching binary ground atomic formulas and
* the context in which they were found
*/
Set<List<AbstractTerm>> gatherArg1TermsAndContextsFromBinaryGAFs(
final AtomicTerm predicate,
final AbstractTerm arg2,
final AtomicTerm kbPartition);
/** Gathers the terms and contexts from the arg2 position of matching binary ground atomic formulas in every context.
*
* @param predicate the predicate of matching binary gafs
* @param arg1 the first argument term of matching binary gafs
* @param kbPartition the KB partition
* @return the set of pairs of terms from the arg2 position of matching binary ground atomic formulas and
* the context in which they were found
*/
Set<List<AbstractTerm>> gatherArg2TermsAndContextsFromBinaryGAFs(
final AtomicTerm predicate,
final AbstractTerm arg1,
final AtomicTerm kbPartition);
/** Gathers ordered list of the terms, strengths and contexts from the arg1 position of matching
* binary ground atomic formulas in every context.
*
* @param predicate the predicate of matching binary gafs
* @param arg2 the second argument term of matching binary gafs
* @param kbPartition the KB partition
* @return the ordered list of triples of terms from the arg1 position of matching binary ground atomic formulas, the strength and
* the context in which they were found
*/
List<List<Object>> gatherArg1TermsStrengthsAndContextsFromBinaryGAFs(
final AtomicTerm predicate,
final AbstractTerm arg2,
final AtomicTerm kbPartition);
/** Gathers ordered list of the terms, strengths and contexts from the arg2 position of matching
* binary ground atomic formulas in every context.
*
* @param predicate the predicate of matching binary gafs
* @param arg1 the first argument term of matching binary gafs
* @param kbPartition the KB partition
* @return the list of triples of terms from the arg2 position of matching binary ground atomic formulas, the strength and
* the context in which they were found
*/
List<List<Object>> gatherArg2TermsStrengthsAndContextsFromBinaryGAFs(
final AtomicTerm predicate,
final AbstractTerm arg1,
final AtomicTerm kbPartition);
/** Gathers the terms from the arg2 position of matching binary ground atomic formulas that
* occur only in the given context.
*
* @param predicate the predicate of matching binary gafs
* @param arg1 the first argument term of matching binary gafs
* @param context the most specific context of those from which matching gafs are gathered
* @param kbPartition the KB partition
* @return the terms from the arg2 position of match binary ground atomic formulas
*/
Set<AbstractTerm> gatherArg2TermsFromBinaryGAFsWithinContext(
final AtomicTerm predicate,
final AbstractTerm arg1,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Gathers the term ids from the arg1 position of matching binary ground atomic formulas that
* occur only in the given context.
*
* @param predicate the predicate of matching binary gafs
* @param arg2 the first argument term of matching binary gafs
* @param context the most specific context of those from which matching gafs are gathered
* @param kbPartition the KB partition
* @return the term ids from the arg1 position of match binary ground atomic formulas
*/
Set<Byte[]> gatherArg1TermIdsFromBinaryGAFsWithinContext(
final AtomicTerm predicate,
final AbstractTerm arg2,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Gathers the binary ground atomic formulas having the given arg1 or arg2 from all contexts.
*
* @param arg the first or second argument term of matching binary gafs
* @param kbPartition the KB partition
* @return the binary ground atomic formulas having the given arg
*/
Set<BinaryGAF> gatherBinaryGAFsByArgTerm(final AbstractTerm arg, final AtomicTerm kbPartition);
/** Gathers the binary ground atomic formulas having the given arg1 and context.
*
* @param arg1 the first argument term of matching binary gafs
* @param context the most specific context of those from which matching gafs are gathered
* @param kbPartition the KB partition
* @return the binary ground atomic formulas having the given arg1 and context
*/
Set<BinaryGAF> gatherBinaryGAFsByArg1Term(
final AbstractTerm arg1,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Gathers the binary ground atomic formulas having the given arg1 and context.
*
* @param arg1 the first argument term of matching binary gafs
* @param context the most specific context of those from which matching gafs are gathered
* @param kbPartition the KB partition
* @return the binary ground atomic formulas having the given arg1 and context
*/
Set<BinaryGAF> gatherBinaryGAFsByArg1TermWithinContext(
final AbstractTerm arg1,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Inclusively gathers the relevant context term ids visible from the given context.
*
* @param context the given context
* @param kbPartition the KB partition
* @return the set of relevant context term ids visible from the given context, including the given context
*/
Set<Byte[]> gatherContextTermIdsRelevantFrom(final AbstractReifiedTerm context, final AtomicTerm kbPartition);
/** Inclusively gathers the relevant contexts visible from the given context. The genlMt propositions are found
* mostly in the context UniversalVocabularyMt, but additionally some are found in the context BaseKB.
*
* @param context the given context
* @param kbPartition the KB partition
* @return the set of relevant contexts visible from the given context, including the given context
*/
Set<AbstractReifiedTerm> gatherContextsRelevantFrom(final AbstractReifiedTerm context, final AtomicTerm kbPartition);
/** Exclusively gathers the immediately relevant contexts visible from the given context.
*
* @param context the given context
* @param kbPartition the KB partition
* @return the set of immediately relevant contexts visible from the given context
*/
Set<AbstractReifiedTerm> gatherContextsImmediatelyRelevantFrom(final AbstractReifiedTerm context, final AtomicTerm kbPartition);
/** Exclusively gathers the closure of the given transitive binary predicate visible from the given context and reified arg1 term from
* the given context.
*
* @param predicate the given transitive predicate
* @param arg1 the given arg1
* @param context the given context
* @param kbPartition the KB partition
* @return the set of relevant contexts visible from the given context, including the given context
*/
Set<AbstractReifiedTerm> gatherTransitiveClosureFrom(
final AtomicTerm predicate,
final AbstractReifiedTerm arg1,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** 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
* @param kbPartition the KB partition
* @return an iterator over the binary ground atomic formulas having the given predicate and context
*/
Iterator<BinaryGAF> binaryGAFByPredicateIterator(
final AtomicTerm predicate,
final AbstractReifiedTerm context,
final AtomicTerm kbPartition);
/** Returns an iterator over the set of binary gafs with the given predicate and given relevant context, whose arg1 term ids
* are members of the given set of constraint term ids.
*
* @param predicate the predicate of matching binary gafs
* @param context the most specific context of those from which matching gafs are gathered
* @param arg1ConstraintTermIdSet the set of arg1 constraint term ids
* @param kbPartition the KB partition
* @return an iterator over the binary ground atomic formulas having the given predicate and context
*/
public Iterator<BinaryGAF> binaryGAFByPredicateAndConstraintSetIterator(
final AtomicTerm predicate,
final AbstractReifiedTerm context,
final Set<Byte[]> arg1ConstraintTermIdSet,
final AtomicTerm kbPartition);
// from AssociationEditorLocal
/**
* Edits the given binary ground atomic formula.
*
* @param oldPredicate the predicate of the old binary gaf
* @param newPredicate the predicate of the new binary gaf or null if no change
* @param oldoldArgse argument terms of the old binary gaf
* @param newArgs the argument terms of the new binary gaf or null if no change
* @param oldContext the context of the old binary gaf
* @param newContext the context of the new binary gaf or null if no change
* @param newStrength the strength of the new binary gaf or null if no change
* @param newCreator the creator of the new binary gaf or null if no change
* @param newCreationPurpose the creation purpose of the new binary gaf or null if no change
* @param kbPartition the KB partition
* @return the new binary gaf having the same term id
*/
BinaryGAF editBinaryGAF(
final AtomicTerm oldPredicate,
final AtomicTerm newPredicate,
final List<AbstractTerm> oldArgs,
final List<AbstractTerm> newArgs,
final AbstractReifiedTerm oldContext,
final AbstractReifiedTerm newContext,
final Double newStrength,
final AtomicTerm newCreator,
final AtomicTerm newCreationPurpose,
final AtomicTerm kbPartition);
/**
* Persists the given binary ground atomic formula.
*
* @param binaryGAF the given binary ground atomic formula
* @param kbPartition the KB partition
*/
void editBinaryGAF(final BinaryGAF binaryGAF, final AtomicTerm kbPartition);
}
See more files for this project here