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 and Description
    `TdbGraphRecord(TdbSession session)` Constructor, creates a blank graph record container.
    `TdbGraphRecord(TdbSession session, java.lang.String name)` Constructor, associates the record with the named graph database.
    `TdbGraphRecord(TdbSession session, TdbDatabaseDesign design)` Constructor, associates the graph record with the provided database design.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addKeyword(java.lang.String keyword)` Add a keyword to this graph record.
    `TdbGraphRecordType` | `getGraphRecordType()` Returns the type of the graph record
    `java.util.List<java.lang.String>` | `getKeywords()` Return a list of all keywords assigned to this graph record.
    `java.lang.String` | `getName()` Returns the name of the graph record.
    `java.lang.String` | `getProperty(java.lang.String name)` Retrieve the value for a property.
    `int` | `getPropertyCount()` Returns a count of the number of properties assigned to this graph database record.
    `java.lang.String` | `getPropertyName(int index)` Returns the name of the property at the specified index.
    `java.lang.String` | `getPropertyValue(int index)` Returns the value of the property at the specified index.
    `java.lang.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.
    `java.lang.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.
    `java.lang.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(java.lang.String keyword)` Remove a keyword from this graph record.
    `void` | `removeProperty(java.lang.String name)` Removes a named property from this graph record.
    `void` | `setGraphRecordType(TdbGraphRecordType type)` Set the type of the graph record.
    `void` | `setName(java.lang.String name)` Assigns the name of the record.
    `void` | `setProperty(java.lang.String name, java.lang.String value)` Assign a property to this graph record.
    `void` | `setReference(java.lang.String databaseName, int recordId, java.lang.String recordName)` Set a reference to a pre-existing record.
    `void` | `setReference(TdbRecord rec)` Set a reference to a pre-existing record.
    `void` | `setSourceRecord(int recordId, java.lang.String recordName)` Set the source record for a graph edge.
    `void` | `setSourceRecord(java.lang.String databaseName, int recordId)` Set the source record for a graph edge.
    `void` | `setSourceRecord(TdbRecord rec)` Set the source record for a graph edge.
    `void` | `setTargetRecord(int recordId, java.lang.String recordName)` Set the target record for a graph edge.
    `void` | `setTargetRecord(java.lang.String databaseName, int recordId)` Set the target record for a graph edge.
    `void` | `setTargetRecord(TdbRecord rec)` 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`

    - ### Methods inherited from interface com.tietoenator.trip.jxp.internal.utils.DOMSink

      `sinkNode`

- - ### Constructor Detail

    - #### 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,
                                java.lang.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 Detail

    - #### 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(java.lang.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 java.lang.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(java.lang.String databaseName,
                                   int recordId,
                                   java.lang.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 java.lang.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,
                                      java.lang.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(java.lang.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 java.lang.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,
                                      java.lang.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(java.lang.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 java.lang.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(java.lang.String name,
                                  java.lang.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(java.lang.String name)
                              throws TdbException

      Removes a named property from this graph record.
      Parameters:
        `name` - Name of property to remove
      Throws:
        `TdbException`

    - #### getProperty

          public java.lang.String getProperty(java.lang.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 java.lang.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 java.lang.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(java.lang.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 java.util.List<java.lang.String> getKeywords()
                                                       throws TdbException

      Return a list of all keywords assigned to this graph record.
      Throws:
        `TdbException`

    - #### removeKeyword

          public void removeKeyword(java.lang.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`