Show Agent.java syntax highlighted
/*
* Agent.java
*
* Created on August 16, 2007, 3:50 PM
*
* Description: Provides a class to represent an agent in the FOAF ontology.
*
* Copyright (C) August 16, 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.persistence.sample;
import java.util.List;
import java.util.Set;
import javax.persistence.Id;
import org.texai.kb.Constants;
import org.texai.kb.persistence.RDFEntity;
import org.texai.kb.persistence.RDFNamespace;
import org.texai.kb.persistence.RDFProperty;
/**
*
* @author reed
*/
@RDFEntity(
namespaces={
@RDFNamespace(prefix="foaf", namespaceURI=Constants.FOAF_NAMESPACE)},
subject="foaf:Agent")
public class Agent {
/** This is the URI string that identifies this person. If null, then it is automatically generated when
* this instance is persisted. When a subclass is instantiated, this field is ignored. */
@Id
private String agentId;
/** the name of this agent */
@RDFProperty(predicate="foaf:name")
private String name;
/** the birthday of this Agent, represented in mm-dd string form, eg. '12-31' */
@RDFProperty(predicate="foaf:birthday")
private String birthday;
/** the gender of this Agent (typically but not necessarily 'male' or 'female') */
@RDFProperty(predicate="foaf:gender")
private String gender;
/** the set of some things that were made by this agent */
@RDFProperty(predicate="foaf:Made")
private Set<Object> thingsMade;
/** Creates a new instance of Agent. */
public Agent() {
}
public String getAgentId() {
return agentId;
}
public void setAgentId(final String agentId) {
this.agentId = agentId;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(final String birthday) {
this.birthday = birthday;
}
public String getGender() {
return gender;
}
public void setGender(final String gender) {
this.gender = gender;
}
public Set<Object> getThingsMade() {
return thingsMade;
}
public void setThingsMade(final Set<Object> thingsMade) {
this.thingsMade = thingsMade;
}
/** 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 Agent) {
final Agent that = (Agent) obj;
return this.getAgentId().equals(that.getAgentId());
} else {
return false;
}
}
/** Returns a hash code for this object.
*
* @return a hash code for this object
*/
@Override
public int hashCode() {
if (getAgentId() == null) {
return super.hashCode();
} else {
return getAgentId().hashCode();
}
}
}
See more files for this project here