Code Search for Developers
 
 
  

AbstractGAFInfo.java from Texai at Krugle


Show AbstractGAFInfo.java syntax highlighted

/*
 * AbstractGAFInfo.java
 *
 * Created on October 25, 2006, 11:16 AM
 *
 * Description:
 *
 * Copyright (C) 2006 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.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
import org.texai.kb.Constants;

/**
 * Entity class AbstractGAFInfo
 *
 * @author reed
 */
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class AbstractGAFInfo implements Serializable {

  /**
   * Determines if a de-serialized file is compatible with this class.
   *
   * Maintainers must change this value if and only if the new version
   * of this class is not compatible with old versions. See Sun docs
   * for <a href=http://java.sun.com/products/jdk/1.1/docs/guide
   * /serialization/spec/version.doc.html> details. </a>
   *
   * Not necessary to include in first version of the class, but
   * included here as a reminder of its importance.
   */
  @Transient
  private static final long serialVersionUID = 1L;

  /** the id */
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private Long gafInfoId;

  /** the assertion context (i.e. Cyc microtheory)
   * @serial
   */
  @ManyToOne(optional=false, cascade=CascadeType.PERSIST)
  private AbstractReifiedTerm context;

  /** the assertion strength
   * @serial
   */
  @Basic(fetch=FetchType.LAZY)
  private Double strength;

  /** the generated phrase for this ground atomic formula
   * @serial
   */
  @Basic(fetch=FetchType.LAZY)
  private String generatedPhrase;

  /** the creator of this ground atomic formula */
  @ManyToOne(optional=false, cascade=CascadeType.PERSIST, fetch=FetchType.LAZY)
  private AbstractReifiedTerm creator;
  
  /** the creation purpose of this ground atomic formula */
  @ManyToOne(optional=false, cascade=CascadeType.PERSIST, fetch=FetchType.LAZY)
  private AbstractReifiedTerm creationPurpose;
  
  /** the creation time point of this ground atomic formula */
  @ManyToOne(optional=false, cascade=CascadeType.PERSIST, fetch=FetchType.LAZY)
  private TimePoint creationTimePoint;
  
  /** Creates a new instance of AbstractGAFInfo. */
  public AbstractGAFInfo() {
    super();
  }

  /**
   * Creates a new instance of AbstractGAFInfo.
   * 
   * @param context the assertion context (i.e. Cyc microtheory)
   * @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 creationTimePoint the creation time point
   */
  public AbstractGAFInfo(
          final AbstractReifiedTerm context,
          final Double strength,
          final String generatedPhrase,
          final AbstractReifiedTerm creator,
          final AbstractReifiedTerm creationPurpose,
          final TimePoint creationTimePoint) {
    super();
    //Preconditions
    assert context != null : "context must not be null";
    assert strength != null : "strength must not be null";
    assert creator != null : "creator must not be null";
    assert creationPurpose != null : "creationPurpose must not be null";
    assert creationTimePoint != null : "creationTimePoint must not be null";

    this.context = context;
    this.strength = strength;
    this.generatedPhrase = generatedPhrase;
    this.creator = creator;
    this.creationPurpose = creationPurpose;
    this.creationTimePoint = creationTimePoint;
  }

  /** Gets the id of this AbstractGAFInfo.
   *
   * @return the id
   */
  public Long getGAFInfoId() {
    return this.gafInfoId;
  }

  /** Gets the predicate.
   *
   * @return the predicate
   */
  public abstract  AtomicTerm getPredicate();
  
  /** Returns the arguments.
   *
   * @return the arguments
   */
  public abstract List<AbstractTerm> getArgs();

  /** Returns the assertion context (i.e. Cyc microtheory).
   *
   * @return the assertion context (i.e. Cyc microtheory)
   */
  public AbstractReifiedTerm getContext() {
    return context;
  }

  /** Sets the assertion context (i.e. Cyc microtheory).
   *
   * @param context the assertion context (i.e. Cyc microtheory)
   */
  public void setContext(final AbstractReifiedTerm context) {
    //Preconditions
    assert context != null : "context must not be null";

    this.context = context;
  }

  /** Returns the generated phrase for this ground atomic formula.
   *
   * @return the generated phrase for this ground atomic formula
   */
  public String getGeneratedPhrase() {
    return generatedPhrase;
  }

  /** Sets the generated phrase for this ground atomic formula.
   *
   * @param generatedPhrase the generated natural language phrase
   */
  public void setGeneratedPhrase(final String generatedPhrase) {
    //Preconditions
    assert generatedPhrase != null : "generatedPhrase must not be null";

    this.generatedPhrase = generatedPhrase;
  }

  /** Gets the assertion strength
   *
   * @return the assertion strength
   */
  public Double getStrength() {
    return strength;
  }

  /** Sets the assertion strength.
   *
   * @param strength the assertion strength
   */
  public void setStrength(final Double strength) {
    //Preconditions
    assert strength != null : "strength must not be null";

    this.strength = strength;
  }

  /** Gets the creator.
   *
   * @return the creator
   */
  public AbstractReifiedTerm getCreator() {
    return creator;
  }

  /** Sets the creator.
   *
   * @param creator the creator
   */
  public void setCreator(final AbstractReifiedTerm creator) {
    //Preconditions
    assert creator != null : "creator must not be null";
    
    this.creator = creator;
  }

  /** Gets the creation purpose.
   *
   * @return the creation purpose
   */
  public AbstractReifiedTerm getCreationPurpose() {
    return creationPurpose;
  }

  /** Sets the creation purpose.
   *
   * @param creationPurpose the creation purpose
   */
  public void setCreationPurpose(final AbstractReifiedTerm creationPurpose) {
    //Preconditions
    assert creationPurpose != null : "creationPurpose must not be null";
    
    this.creationPurpose = creationPurpose;
  }

  /** Gets the creation time point.
   *
   * @return the creation time point
   */
  public TimePoint getCreationTimePoint() {
    return creationTimePoint;
  }

  /** Sets the creation time point.
   *
   * @param creationTimePoint the creation time point
   */
  public void setCreationTimePoint(final TimePoint creationTimePoint) {
    //Preconditions
    assert creationTimePoint != null : "creationTimePoint must not be null";
    
    this.creationTimePoint = creationTimePoint;
  }

  /** Returns a string representation of this object.
   *
   * @return a string representation of this object
   */
  @Override
  public String toString() {
    final StringBuilder stringBuilder = new StringBuilder(Constants.STRING_BUILDER_SIZE);
    stringBuilder.append(getPredicate().toString());
    stringBuilder.append("(");
    final List<AbstractTerm> args = getArgs();
    final int arity = args.size();
    for (int i = 0; i < arity; i++) {
      stringBuilder.append(args.get(i).toString());
      if (i < arity - 1) {
        stringBuilder.append(", ");
      }
    }
    stringBuilder.append(")");
    return stringBuilder.toString();
  }

  /** Returns a CycL representation of this object.
   *
   * @return a CycL representation of this object
   */
  public String toCycLString() {
    final StringBuilder stringBuilder = new StringBuilder(2000);
    stringBuilder.append("(");
    stringBuilder.append(getPredicate().toCycLString());
    final List<AbstractTerm> args = getArgs();
    final int arity = args.size();
    for (int i = 0; i < arity; i++) {
      stringBuilder.append(" ");
      stringBuilder.append(args.get(i).toCycLString());
    }
    stringBuilder.append(")");
    return stringBuilder.toString();
  }

}




See more files for this project here

Texai

Texai is an chatbot that intelligently seeks to acquire knowledge and friendly behaviors.

Project homepage: http://sourceforge.net/projects/texai
Programming language(s): Java,Shell Script,XML
License: other

  AbstractGAF.java
  AbstractGAFInfo.java
  AbstractReifiedTerm.java
  AbstractTerm.java
  AtomicTerm.java
  AtomicTermInfo.java
  BinaryGAF.java
  BinaryGAFInfo.java
  Formula.java
  FormulaArgument.java
  FormulaInfo.java
  NonAtomicTerm.java
  NonAtomicTermInfo.java
  PBlob.java
  PBlobInfo.java
  PCharacter.java
  PCharacterInfo.java
  PClob.java
  PClobInfo.java
  PDate.java
  PDateInfo.java
  PDouble.java
  PDoubleInfo.java
  PLong.java
  PLongInfo.java
  PString.java
  PStringInfo.java
  PVariable.java
  PVariableInfo.java
  QuaternaryGAF.java
  QuaternaryGAFInfo.java
  QuintaryGAF.java
  QuintaryGAFInfo.java
  Rule.java
  RuleInfo.java
  Symbol.java
  SymbolInfo.java
  TernaryGAF.java
  TernaryGAFInfo.java
  TimePoint.java
  TimePointInfo.java
  UnaryGAF.java
  UnaryGAFInfo.java
  package.html