Package org.molgenis.vibe.core.formats
Class Entity
- java.lang.Object
-
- org.molgenis.vibe.core.formats.Entity
-
- All Implemented Interfaces:
Comparable<Entity>,AllFieldsEquals,ResourceUri
- Direct Known Subclasses:
BiologicalEntity,GeneSymbol,PubmedEvidence
public abstract class Entity extends Object implements ResourceUri, Comparable<Entity>, AllFieldsEquals
Describes an entity. Be sure to update toString() to include all new fields when subclassing! Please refer to org.molgenis.vibe.rdf_processing.GenesForPhenotypeRetrieverTester within the test code for more information.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanallFieldsEquals(Object o)intcompareTo(Entity o)booleanequals(Object o)StringgetFormattedId()StringgetId()protected abstract StringgetIdPrefix()The entity prefix.protected abstract StringgetIdRegex()StringgetName()protected abstract intgetRegexIdGroup()The group within the regular expression the actualidis stored in.URIgetUri()protected abstract StringgetUriPrefix()The String describing the URI prefix it should match with.inthashCode()protected StringretrieveIdFromString(String fullString)Validates and retrieves the ID from aStringdescribing an id (that also includes other information such as a prefix).protected voidsetName(String name)StringtoString()While uniqueness is based on theid(as eachidshould only occur once and data belonging to it should be consistent),toString()can be used for testing whether data retrieval from external sources yielded the expected results.
-
-
-
Method Detail
-
getIdPrefix
protected abstract String getIdPrefix()
The entity prefix.- Returns:
- a
Stringcontaining the prefix.
-
getIdRegex
protected abstract String getIdRegex()
- Returns:
-
getRegexIdGroup
protected abstract int getRegexIdGroup()
The group within the regular expression the actualidis stored in.- Returns:
-
getUriPrefix
protected abstract String getUriPrefix()
The String describing the URI prefix it should match with.- Returns:
-
getName
public String getName()
-
setName
protected void setName(String name)
-
getUri
public URI getUri()
- Specified by:
getUriin interfaceResourceUri
-
retrieveIdFromString
protected String retrieveIdFromString(String fullString) throws InvalidStringFormatException
Validates and retrieves the ID from aStringdescribing an id (that also includes other information such as a prefix).- Parameters:
fullString- theStringto be digested- Returns:
- a
Stringcontaining the id only - Throws:
InvalidStringFormatException- iffullStringdid not adhere to the regular expression
-
toString
public String toString()
While uniqueness is based on theid(as eachidshould only occur once and data belonging to it should be consistent),toString()can be used for testing whether data retrieval from external sources yielded the expected results.
-
allFieldsEquals
public boolean allFieldsEquals(Object o)
- Specified by:
allFieldsEqualsin interfaceAllFieldsEquals
-
compareTo
public int compareTo(Entity o)
- Specified by:
compareToin interfaceComparable<Entity>
-
-