Code Search for Developers
 
 
  

CategoryConstruction.java from Texai at Krugle


Show CategoryConstruction.java syntax highlighted

/*
 * CategoryConstruction.java
 *
 * Created on January 29, 2007, 8:50 AM
 *
 * Description: Provides a construction with a categorical constituent.
 *
 * Copyright (C) 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.grammar.domainEntity;

import net.jcip.annotations.NotThreadSafe;
import org.openrdf.model.URI;
import org.texai.grammar.Constituent;
import org.texai.grammar.understanding.ActiveCategoryConstruction;
import org.texai.grammar.understanding.ActiveConstituent;
import org.texai.kb.Constants;
import org.texai.kb.persistence.RDFEntity;
import org.texai.kb.persistence.RDFNamespace;
import org.texai.kb.persistence.RDFProperty;

/** Provides a construction with a categorical constituent.
 *
 * @author reed
 */
@RDFEntity(
namespaces={
  @RDFNamespace(prefix="texai", namespaceURI=Constants.TEXAI_NAMESPACE),
  @RDFNamespace(prefix="cyc", namespaceURI=Constants.CYC_NAMESPACE)},
subject="texai:org.texai.grammar.domainEntity.CategoryConstruction", type="cyc:LinguisticObjectType", subClassOf="texai:CxgComposedConstruction", context="texai:EnglishConstructionGrammarDomainContext")
@NotThreadSafe  // but effectively immutable
public class CategoryConstruction extends AbstractComposedConstruction {
  
    /** the constituent construction category */
  @RDFProperty(predicate="texai:cxgConstuctionCategory")
  private URI constituentCategory;

  /** Creates a new instance of CategoryConstruction. */
  public CategoryConstruction() {
    super();
    setLoggerUsingClass(this.getClass());
  }
  
  /** Creates a new instance of CategoryConstruction.
   *
   * @param name the construction name that identifies this instance
   * @param naturalLanguage the natural language to which this construction applies
   */
  public CategoryConstruction(final String name, final URI naturalLanguage) {
    super(name, naturalLanguage);
    setLoggerUsingClass(this.getClass());
  }
  
  /** Sets the constituent construction category.
   *
   * @param constituentCategory the constituent construction category
   */
  public void setConstituentCategory(final URI constituentCategory) {
    //Preconditions
    assert constituentCategory != null : "constituentCategory must not be null";
    
    this.constituentCategory = constituentCategory;
  }
  
  /** Gets the constituent construction category.
   *
   * @return the constituent construction category
   */
  public URI getConstituentCategory() {
    return constituentCategory;
  }
    
 /** Decorates this construction with an active construction that contains the 
   * behavior and transient state for parsing text.
   *
   * @return an ActiveCategoryConstruction that decorates this object
   */
  public ActiveConstituent decorate() {
    return new ActiveCategoryConstruction(this);
  }
  
  /** Returns the constituent adapter that contains the given child constituent.
   *
   * @param constituent the given child constituent
   * @return the constituent adapter that contains the given child constituent, or null if not found 
   */
  public ConstituentAdapter findAdapter(final Constituent constituent) {
    //Preconditions
    assert constituent != null : "constituent must not be null";
    
    return null;
  }
  
  /** Returns a hash code for this object.
   *
   * @return a hash code for this object
   */
  @Override
  public int hashCode() {
    if (getId() == null) {
      return super.hashCode();
    } else {
      return getId().hashCode();
    }
  }
  
  /** Returns whether the given object is equal to this object.
   *
   * @param obj the given object
   * @return whether the given object is equal to this object
   */
  @Override
  public boolean equals(final Object obj) {
    if (obj instanceof CategoryConstruction) {
      final CategoryConstruction that = (CategoryConstruction) obj;
      return this.getId().equals(that.getId());
    } else {
      return false;
    } 
  }
  
}




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

  AbstractComposedConstruction.java
  AbstractConstruction.java
  AlternativeConstruction.java
  CategoryConstruction.java
  ConstituentAdapter.java
  OptionalConstruction.java
  RegularExpression.java
  RegularExpression_GroupVariableInfo.java
  RepetitiveConstruction.java
  SequenceConstruction.java
  SimpleConstruction.java
  ValidateGrammarEntities.java
  WordFormConstruction.java
  WordSenseConstruction.java
  XMLTagWord.java