Package com.tietoenator.trip.jxp.data

# Class TdbGraphRecord

java.lang.Object
com.tietoenator.trip.jxp.session.TdbSessionObject
com.tietoenator.trip.jxp.TdbMessageProvider
com.tietoenator.trip.jxp.data.TdbRecord
com.tietoenator.trip.jxp.data.TdbGraphRecord

All Implemented Interfaces:
  `com.tietoenator.trip.jxp.internal.utils.DOMSink`

public class TdbGraphRecord extends TdbRecord
Container and manipulation logic for a record from a TRIP graph database.

THIS CLASS IS EXPERIMENTAL. METHOD SIGNATURES MAY CHANGE IN FUTURE RELEASES. USE WITH CAUTION.

Since:
  TRIPjxp 3.1-0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TdbGraphRecord(TdbSession session)`
  Constructor, creates a blank graph record container.
  `TdbGraphRecord(TdbSession session, TdbDatabaseDesign design)`
  Constructor, associates the graph record with the provided database design.
  `TdbGraphRecord(TdbSession session, String name)`
  Constructor, associates the record with the named graph database.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addKeyword(String keyword)`
  Add a keyword to this graph record.
  `TdbGraphRecordType`
  `getGraphRecordType()`
  Returns the type of the graph record
  `List<String>`
  `getKeywords()`
  Return a list of all keywords assigned to this graph record.
  `String`
  `getName()`
  Returns the name of the graph record.
  `String`
  `getProperty(String name)`
  Retrieve the value for a property.
  `int`
  `getPropertyCount()`
  Returns a count of the number of properties assigned to this graph database record.
  `String`
  `getPropertyName(int index)`
  Returns the name of the property at the specified index.
  `String`
  `getPropertyValue(int index)`
  Returns the value of the property at the specified index.
  `String`
  `getReferenceDatabase()`
  Returns the database name for the record referenced from this graph record.
  `int`
  `getReferenceRecordId()`
  Returns the record ID of the record referenced from this graph record.
  `String`
  `getSourceDatabase()`
  Returns the database name for record used as source vertex for this graph record.
  `int`
  `getSourceRecordId()`
  Returns the record ID of the record used as source vertex for this graph record.
  `String`
  `getTargetDatabase()`
  Returns the database name for record used as target vertex for this graph record.
  `int`
  `getTargetRecordId()`
  Returns the record ID of the record used as target vertex for this graph record.
  `double`
  `getWeight()`
  Returns the weight value for an edge record.
  `boolean`
  `isEdge()`
  Returns true if this record is an edge.
  `boolean`
  `isVertex()`
  Returns true if this record is a vertex.
  `void`
  `removeKeyword(int index)`
  Remove a keyword from this graph record.
  `void`
  `removeKeyword(String keyword)`
  Remove a keyword from this graph record.
  `void`
  `removeProperty(String name)`
  Removes a named property from this graph record.
  `void`
  `setGraphRecordType(TdbGraphRecordType type)`
  Set the type of the graph record.
  `void`
  `setName(String name)`
  Assigns the name of the record.
  `void`
  `setProperty(String name, String value)`
  Assign a property to this graph record.
  `void`
  `setReference(TdbRecord rec)`
  Set a reference to a pre-existing record.
  `void`
  `setReference(String databaseName, int recordId, String recordName)`
  Set a reference to a pre-existing record.
  `void`
  `setSourceRecord(int recordId, String recordName)`
  Set the source record for a graph edge.
  `void`
  `setSourceRecord(TdbRecord rec)`
  Set the source record for a graph edge.
  `void`
  `setSourceRecord(String databaseName, int recordId)`
  Set the source record for a graph edge.
  `void`
  `setTargetRecord(int recordId, String recordName)`
  Set the target record for a graph edge.
  `void`
  `setTargetRecord(TdbRecord rec)`
  Set the target record for a graph edge.
  `void`
  `setTargetRecord(String databaseName, int recordId)`
  Set the target record for a graph edge.
  `void`
  `setWeight(double weight)`
  Set the weight value for an edge record.

  ### Methods inherited from class com.tietoenator.trip.jxp.data.TdbRecord

  `addToTemplate, addToTemplate, addToTemplate, appendComponent, clear, commit, copy, copy, delete, deleteComponent, deleteComponent, get, get, getCategories, getComponent, getComponent, getDatabaseName, getFieldTemplates, getHead, getIndexOnCommit, getNlpInfo, getRank, getRawRank, getRecordId, getRecordName, getTimeStamp, insertAseList, isChanged, isDeleted, isGraphRecord, isXmlRecord, lock, parts, removeFromTemplate, setDatabaseName, setIndexOnCommit, setPartId, setPartNameField, setRecordId, setRecordName, setRecordNameField, setRecordNumberField, setRetrieveHead, setRetrieveParts, setTemplateMarkup, unlock, updateAseList`

  ### Methods inherited from class com.tietoenator.trip.jxp.TdbMessageProvider

  `codeList, getLastCode, getLastMessage, hasMessages, messageList, resetMessages`

  ### Methods inherited from class com.tietoenator.trip.jxp.session.TdbSessionObject

  `cancel, getSession, isCancelable, setCancelable`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TdbGraphRecord

    public TdbGraphRecord(TdbSession session) throws TdbException
    Constructor, creates a blank graph record container.
    Parameters:
      `session` - Active session
    Throws:
      `TdbException`

  - ### TdbGraphRecord

    public TdbGraphRecord(TdbSession session, TdbDatabaseDesign design) throws TdbException
    Constructor, associates the graph record with the provided database design.
    Parameters:
      `session` - Active session
      `design` - Database design
    Throws:
      `TdbException`

  - ### TdbGraphRecord

    public TdbGraphRecord(TdbSession session, String name) throws TdbException
    Constructor, associates the record with the named graph database.
    Parameters:
      `session` - Active session
      `name` - Name of the graph database.
    Throws:
      `TdbException`

- ## Method Details

  - ### isVertex

    public boolean isVertex()
    Returns true if this record is a vertex. A vertex record is a graph database record that either

  - ### isEdge

    public boolean isEdge()
    Returns true if this record is an edge.

  - ### setGraphRecordType

    public void setGraphRecordType(TdbGraphRecordType type) throws TdbException
    Set the type of the graph record.

    This method can only be called if the record has no assigned type and is not already committed to the graph database.

    Parameters:
      `type` - The type of the record to create
    Throws:
      `TdbException` - If assignment cannot be performed

  - ### getGraphRecordType

    public TdbGraphRecordType getGraphRecordType()
    Returns the type of the graph record

  - ### setName

    public void setName(String name) throws TdbException
    Assigns the name of the record.

    For an edge this is the name of the relation. For a vertex, this is a label that can is used to identify the vertex in illustrations, etc.

    Parameters:
      `name` - Name of edge or label of vertex
    Throws:
      `TdbException` - If assignment cannot be performed

  - ### getName

    public String getName() throws TdbException
    Returns the name of the graph record.

    For an edge this is the name of the relation. For a vertex, this is a label that can is used to identify the vertex in illustrations, etc.

    Throws:
      `TdbException` - If the value could not be retrieved

  - ### setReference

    public void setReference(TdbRecord rec) throws TdbException
    Set a reference to a pre-existing record.

    This assignment is only valid for vertex records. The referenced record can contain additional data about the vertex.

    Parameters:
      `rec` - Record to associate with the vertex record.
    Throws:
      `TdbException` - If assignment fails

  - ### setReference

    public void setReference(String databaseName, int recordId, String recordName) throws TdbException
    Set a reference to a pre-existing record.

    This assignment is only valid for vertex records. The referenced record can contain additional data about the vertex.

    Parameters:
      `databaseName` - Database in which the record is stored
      `recordId` - ID of the record
      `recordName` - Record name of record (pass null if none or not known)
    Throws:
      `TdbException` - If assignment fails

  - ### getReferenceRecordId

    public int getReferenceRecordId() throws TdbException
    Returns the record ID of the record referenced from this graph record.

    Only vertex records may contain a reference to another record.

    Returns:
      Record ID or 0 (zero) if no reference exists.
    Throws:
      `TdbException` - If the value could not be retrieved

  - ### getReferenceDatabase

    public String getReferenceDatabase() throws TdbException
    Returns the database name for the record referenced from this graph record.

    Only vertex records may contain a reference to another record.

    Returns:
      Database name or null if no reference exists.
    Throws:
      `TdbException` - If the value could not be retrieved

  - ### setWeight

    public void setWeight(double weight) throws TdbException
    Set the weight value for an edge record.
    Parameters:
      `weight` - Weight to set.
    Throws:
      `TdbException` - If the assignment fails

  - ### getWeight

    public double getWeight() throws TdbException
    Returns the weight value for an edge record.
    Throws:
      `TdbException` - If the record is not a graph edge

  - ### setSourceRecord

    public void setSourceRecord(TdbRecord rec) throws TdbException
    Set the source record for a graph edge.
    Parameters:
      `rec` - The record to assign as source, must have been committed prior to assignment.
    Throws:
      `TdbException`

  - ### setSourceRecord

    public void setSourceRecord(int recordId, String recordName) throws TdbException
    Set the source record for a graph edge. The source record must be a existing vertex record in the same database to which the edge is to be added.
    Parameters:
      `recordId` - The ID of the record
      `recordName` - The record name of the record
    Throws:
      `TdbException`

  - ### setSourceRecord

    public void setSourceRecord(String databaseName, int recordId) throws TdbException
    Set the source record for a graph edge. The source record must be a existing TRIP record and must not be located in a graph database.
    Parameters:
      `databaseName` - The name of the database in which the record resides
      `recordId` - The ID of the record
    Throws:
      `TdbException`

  - ### getSourceRecordId

    public int getSourceRecordId() throws TdbException
    Returns the record ID of the record used as source vertex for this graph record.

    This property is only valid for edge records.

    Returns:
      Record ID or 0 (zero) if no source was registered for this edge.
    Throws:
      `TdbException` - If the value could not be retrieved

  - ### getSourceDatabase

    public String getSourceDatabase() throws TdbException
    Returns the database name for record used as source vertex for this graph record.

    This property is only valid for edge records.

    Returns:
      Database name or null if no source was registered for this edge.
    Throws:
      `TdbException` - If the value could not be retrieved

  - ### setTargetRecord

    public void setTargetRecord(TdbRecord rec) throws TdbException
    Set the target record for a graph edge.
    Parameters:
      `rec` - The record to assign as target, must have been committed prior to assignment.
    Throws:
      `TdbException`

  - ### setTargetRecord

    public void setTargetRecord(int recordId, String recordName) throws TdbException
    Set the target record for a graph edge. The target record must be a existing vertex record in the same database to which the edge is to be added.
    Parameters:
      `recordId` - The ID of the record
      `recordName` - The record name of the record
    Throws:
      `TdbException`

  - ### setTargetRecord

    public void setTargetRecord(String databaseName, int recordId) throws TdbException
    Set the target record for a graph edge. The target record must be a existing TRIP record and must not be located in a graph database.
    Parameters:
      `databaseName` - The name of the database in which the record resides
      `recordId` - The ID of the record
    Throws:
      `TdbException`

  - ### getTargetRecordId

    public int getTargetRecordId() throws TdbException
    Returns the record ID of the record used as target vertex for this graph record.

    This property is only valid for edge records.

    Returns:
      Record ID or 0 (zero) if no target was registered for this edge.
    Throws:
      `TdbException` - If the value could not be retrieved

  - ### getTargetDatabase

    public String getTargetDatabase() throws TdbException
    Returns the database name for record used as target vertex for this graph record.

    This property is only valid for edge records.

    Returns:
      Database name or null if no target was registered for this edge.
    Throws:
      `TdbException` - If the value could not be retrieved

  - ### setProperty

    public void setProperty(String name, String value) throws TdbException
    Assign a property to this graph record. If the property name already exists, the previous value will be overwritten. No duplicate property names will be added.
    Parameters:
      `name` - Name of property
      `value` - Value of property
    Throws:
      `TdbException`

  - ### removeProperty

    public void removeProperty(String name) throws TdbException
    Removes a named property from this graph record.
    Parameters:
      `name` - Name of property to remove
    Throws:
      `TdbException`

  - ### getProperty

    public String getProperty(String name) throws TdbException
    Retrieve the value for a property.
    Parameters:
      `name` - Name of property whose value to retrieve.
    Returns:
      Property value or null if not found
    Throws:
      `TdbException`

  - ### getPropertyCount

    public int getPropertyCount() throws TdbException
    Returns a count of the number of properties assigned to this graph database record.
    Throws:
      `TdbException`

  - ### getPropertyName

    public String getPropertyName(int index) throws TdbException
    Returns the name of the property at the specified index.
    Parameters:
      `index` - Zero-based index of property whose name to retrieve
    Returns:
      Property name or null if not found
    Throws:
      `TdbException`

  - ### getPropertyValue

    public String getPropertyValue(int index) throws TdbException
    Returns the value of the property at the specified index.
    Parameters:
      `index` - Zero-based index of property whose value to retrieve
    Returns:
      Property value or null if not found
    Throws:
      `TdbException`

  - ### addKeyword

    public void addKeyword(String keyword) throws TdbException
    Add a keyword to this graph record. If the keyword already exists, no action will be taken.
    Parameters:
      `keyword` - Keyword to add
    Throws:
      `TdbException`

  - ### getKeywords

    public List<String> getKeywords() throws TdbException
    Return a list of all keywords assigned to this graph record.
    Throws:
      `TdbException`

  - ### removeKeyword

    public void removeKeyword(String keyword) throws TdbException
    Remove a keyword from this graph record.
    Parameters:
      `keyword` - Keyword to remove
    Throws:
      `TdbException`

  - ### removeKeyword

    public void removeKeyword(int index) throws TdbException
    Remove a keyword from this graph record.
    Parameters:
      `index` - Zero based index of keyword to remove
    Throws:
      `TdbException`