no.uio.edd.model.geo
Class GeoModelLink

java.lang.Object
  extended by no.uio.edd.model.geo.GeoModelLink
All Implemented Interfaces:
GeoModelLinkable

public class GeoModelLink
extends java.lang.Object
implements GeoModelLinkable

A class for storing links between nodes.

Author:
oeide

Field Summary
(package private)  ExtendableObjectList corefBackList
           
 
Constructor Summary
GeoModelLink(GeoModelLinkSet inGeoModelLinkSet, int linkId)
          Create an empty link object with only the ID value set.
GeoModelLink(GeoModelLinkSet inGeoModelLinkSet, int linkId, GeoModelLinkable from, GeoModelLinkable to, java.lang.String type, long createdDate)
          Create a non-empty link object.
 
Method Summary
 boolean addCorefBacklink(java.lang.String corefId)
          Add a link to the list of objects corefering to this.
(package private)  void dump()
          For debugging
 java.lang.String[] getCorefBacklinkList()
          Return the list of object IDs corefering to this.
 java.lang.String getCorefId()
          Any linkable object has a global ID that can be used in co-reference work.
 GeoModelLinkable getFrom()
           
 java.lang.String getHtmlTableTr()
          Returns a string with a line for a HTML table giving core information about the object: 1) ID. 2) textual representation. 3) main paragraph level connection (if applicable). 4) page (if applicable).
 java.lang.String getId()
          Find the global ID value for this object.
 java.lang.String getIdOfPara()
          Return the id of the paragraph element this object is connected to, if applicable.
 java.lang.String getInfoHtml()
          Returns a string with a fact sheet on the object in HTML.
 int getLinkIdNum()
           
 java.lang.String getLinkIdString()
           
 java.lang.String getLinkTypeHtmlTable()
           
 java.lang.String getName()
           
 org.w3c.dom.Document getParsedInfo()
          Return a formalised version of this object.
(package private)  java.lang.String getParsedType()
           
 java.lang.String getRdf()
           
 GeoModelLinkable getTo()
           
 java.lang.String getType()
           
(package private)  boolean isEmpty()
           
 boolean removeCorefBacklink(java.lang.String corefId)
          Remove a link from the list of objects corefering to this.
 boolean removeObject()
          Remove this object from the data set.
 boolean setCorefId(java.lang.String corefId)
          Any linkable object has a global ID that can be used in co-reference work.
(package private)  boolean setParsedType(java.lang.String xmlFragment)
           
(package private)  void setType(java.lang.String type)
          Update the type of a link object.
(package private)  void setValues(GeoModelLinkable from, GeoModelLinkable to, java.lang.String type)
          Set the values of a link object and sets it to non-empty.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

corefBackList

ExtendableObjectList corefBackList
Constructor Detail

GeoModelLink

GeoModelLink(GeoModelLinkSet inGeoModelLinkSet,
             int linkId)
Create an empty link object with only the ID value set.

Parameters:
linkId - The integer version of the ID for this link

GeoModelLink

GeoModelLink(GeoModelLinkSet inGeoModelLinkSet,
             int linkId,
             GeoModelLinkable from,
             GeoModelLinkable to,
             java.lang.String type,
             long createdDate)
       throws java.lang.NullPointerException
Create a non-empty link object.

Parameters:
linkId - The integer version of the ID for this link
from - The object linked from (source)
to - The object linked to (target)
type - The type of the link.
createdDate - The creation time of this object as the number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.
Throws:
java.lang.NullPointerException
Method Detail

setValues

void setValues(GeoModelLinkable from,
               GeoModelLinkable to,
               java.lang.String type)
Set the values of a link object and sets it to non-empty.

Parameters:
from - The object linked from (source).
to - The object linked to (target).
type - The type of the link.

setType

void setType(java.lang.String type)
Update the type of a link object.

Parameters:
type - The type of the link.

setParsedType

boolean setParsedType(java.lang.String xmlFragment)
                throws GeoModelLinkException
Throws:
GeoModelLinkException

getParsedInfo

public org.w3c.dom.Document getParsedInfo()
Return a formalised version of this object. This can be a ISO version of length, a degree version of a direction, etc. TODO: Make this tunable in order to deliver different data sets depending on tweaking of the data. This could be for instance different interpretations of what "east" means.

Returns:
A document with a DOM representation which will depend on the object type.

getParsedType

java.lang.String getParsedType()
                         throws GeoModelLinkException
Throws:
GeoModelLinkException

getFrom

public GeoModelLinkable getFrom()
Returns:
The object linked from (source).

getTo

public GeoModelLinkable getTo()
Returns:
The object linked to (target).

getType

public java.lang.String getType()
Returns:
The type of the link.

getLinkIdNum

public int getLinkIdNum()
Returns:
The ID of this link as an integer.

getLinkIdString

public java.lang.String getLinkIdString()
Returns:
The string version of the ID of this link.

getRdf

public java.lang.String getRdf()
Returns:
An XML version of this link object. TODO: Change this into RDF.

isEmpty

boolean isEmpty()
Returns:
True if the values of the object are not yet set.

dump

void dump()
For debugging


removeObject

public boolean removeObject()
Description copied from interface: GeoModelLinkable
Remove this object from the data set.

Specified by:
removeObject in interface GeoModelLinkable
Returns:
True if removed, false if the object is not removable.

getCorefId

public java.lang.String getCorefId()
Description copied from interface: GeoModelLinkable
Any linkable object has a global ID that can be used in co-reference work. In some cases (e.g. person elements) this is the object's own ID. In other cases, such as rs'es, it is the ID of a person or place element, or even another rs or name referring to the same real world object.

Specified by:
getCorefId in interface GeoModelLinkable
Returns:
The co-reference ID value.

getId

public java.lang.String getId()
Description copied from interface: GeoModelLinkable
Find the global ID value for this object.

Specified by:
getId in interface GeoModelLinkable
Returns:
The ID value for the linkable object.

setCorefId

public boolean setCorefId(java.lang.String corefId)
Description copied from interface: GeoModelLinkable
Any linkable object has a global ID that can be used in co-reference work. In some cases (e.g. person elements) this is the object's own ID. In other cases, such as rs'es, it is the ID of a person or place element, or even another rs or name referring to the same real world object.

Specified by:
setCorefId in interface GeoModelLinkable
Parameters:
corefId - The new co-reference ID value.
Returns:
True on success.

getInfoHtml

public java.lang.String getInfoHtml()
Returns a string with a fact sheet on the object in HTML. TODO: Include all information.

Specified by:
getInfoHtml in interface GeoModelLinkable
Returns:
The HTML string.

addCorefBacklink

public boolean addCorefBacklink(java.lang.String corefId)
Description copied from interface: GeoModelLinkable
Add a link to the list of objects corefering to this.

Specified by:
addCorefBacklink in interface GeoModelLinkable
Parameters:
corefId - The ID of the coref.
Returns:
True on success.

getCorefBacklinkList

public java.lang.String[] getCorefBacklinkList()
Description copied from interface: GeoModelLinkable
Return the list of object IDs corefering to this.

Specified by:
getCorefBacklinkList in interface GeoModelLinkable
Returns:
The list.

removeCorefBacklink

public boolean removeCorefBacklink(java.lang.String corefId)
Description copied from interface: GeoModelLinkable
Remove a link from the list of objects corefering to this.

Specified by:
removeCorefBacklink in interface GeoModelLinkable
Parameters:
corefId - The ID of the coref.
Returns:
True on success.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getIdOfPara

public java.lang.String getIdOfPara()
Description copied from interface: GeoModelLinkable
Return the id of the paragraph element this object is connected to, if applicable.

Specified by:
getIdOfPara in interface GeoModelLinkable
Returns:
The ID of the para element. Null if not applicable.

getHtmlTableTr

public java.lang.String getHtmlTableTr()
Description copied from interface: GeoModelLinkable
Returns a string with a line for a HTML table giving core information about the object: 1) ID. 2) textual representation. 3) main paragraph level connection (if applicable). 4) page (if applicable).

Specified by:
getHtmlTableTr in interface GeoModelLinkable
Returns:
A tr html fragment.

getLinkTypeHtmlTable

public java.lang.String getLinkTypeHtmlTable()

getName

public java.lang.String getName()
Specified by:
getName in interface GeoModelLinkable
Returns:
A name representing this object. Can be an empty string if it has no name.