Show Person.java syntax highlighted
/*
* Person.java
*
* Created on August 16, 2007, 3:50 PM
*
* Description: Provides a class to represent a person 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 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:Person")
public class Person extends Agent {
/** the first name of this person */
@RDFProperty(predicate="foaf:firstName")
private String firstName;
/** the family name of this person */
@RDFProperty(predicate="foaf:familyName")
private String familyName;
/** Creates a new instance of Person. */
public Person() {
}
public String getFirstName() {
return firstName;
}
public void setFirstName(final String firstName) {
this.firstName = firstName;
}
public String getFamilyName() {
return familyName;
}
public void setFamilyName(final String familyName) {
this.familyName = familyName;
}
/** 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 Person) {
final Person that = (Person) 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