Class IntrinsicLink


  • public class IntrinsicLink
    extends BaseTable
    This class manages the table that keeps track of intrinsic relationships between documents.

    intrinsiclink
    FieldTypeDescription        
    jobidBIGINTReference:jobs.id
    linktypeVARCHAR(255)
    parentidhashVARCHAR(40)
    childidhashVARCHAR(40)
    isnewCHAR(1)
    processidVARCHAR(16)


    • Field Detail

      • LINKSTATUS_BASE

        protected static final int LINKSTATUS_BASE
        The standard value for this field. Means that the link existed prior to this scan, and no new link was found yet.
        See Also:
        Constant Field Values
      • LINKSTATUS_NEW

        protected static final int LINKSTATUS_NEW
        This value means that the link is brand-new; it did not exist before this pass.
        See Also:
        Constant Field Values
      • LINKSTATUS_EXISTING

        protected static final int LINKSTATUS_EXISTING
        This value means that the link existed before, and has been found during this scan.
        See Also:
        Constant Field Values
      • parentIDHashField

        public static final java.lang.String parentIDHashField
        See Also:
        Constant Field Values
      • childIDHashField

        public static final java.lang.String childIDHashField
        See Also:
        Constant Field Values
      • linkstatusMap

        protected static java.util.Map linkstatusMap
    • Method Detail

      • restart

        public void restart​(java.lang.String processID)
                     throws ManifoldCFException
        Reset, at startup time. Since links can only be added in a transactionally safe way by processing of documents, and cached records of hopcount are updated only when requested, it is safest to simply move any "new" or "new existing" links back to base state on startup. Then, the next time that page is processed, the links will be updated properly.
        Parameters:
        processID - is the process to restart.
        Throws:
        ManifoldCFException
      • recordReferences

        public java.lang.String[] recordReferences​(java.lang.Long jobID,
                                                   java.lang.String sourceDocumentIDHash,
                                                   java.lang.String[] targetDocumentIDHashes,
                                                   java.lang.String linkType,
                                                   java.lang.String processID)
                                            throws ManifoldCFException
        Record a references from source to targets. These references will be marked as either "new" or "existing".
        Returns:
        the target document ID's that are considered "new".
        Throws:
        ManifoldCFException
      • maxClausePerformExistsCheck

        protected int maxClausePerformExistsCheck​(java.lang.Long jobID,
                                                  java.lang.String linkType,
                                                  java.lang.String childIDHash)
        Calculate the max clauses for the exists check
      • performExistsCheck

        protected void performExistsCheck​(java.util.Set<java.lang.String> presentMap,
                                          java.lang.Long jobID,
                                          java.lang.String linkType,
                                          java.lang.String childIDHash,
                                          java.util.List<java.lang.String> list)
                                   throws ManifoldCFException
        Do the exists check, in batch.
        Throws:
        ManifoldCFException
      • removeDocumentLinks

        public void removeDocumentLinks​(java.lang.Long jobID,
                                        java.lang.String joinTableName,
                                        java.lang.String joinTableIDColumn,
                                        java.lang.String joinTableJobColumn,
                                        java.lang.String joinTableCriteria,
                                        java.util.ArrayList joinTableParams)
                                 throws ManifoldCFException
        Remove all links that mention a specific set of documents, as described by a join.
        Throws:
        ManifoldCFException
      • removeDocumentLinks

        public void removeDocumentLinks​(java.lang.Long jobID,
                                        java.lang.String[] documentIDHashes)
                                 throws ManifoldCFException
        Remove all links that mention a specific set of documents.
        Throws:
        ManifoldCFException
      • maxClausePerformRemoveDocumentLinks

        protected int maxClausePerformRemoveDocumentLinks​(java.lang.Long jobID)
      • performRemoveDocumentLinks

        protected void performRemoveDocumentLinks​(java.util.List<java.lang.String> list,
                                                  java.lang.Long jobID)
                                           throws ManifoldCFException
        Throws:
        ManifoldCFException
      • removeLinks

        public void removeLinks​(java.lang.Long jobID,
                                java.lang.String commonNewExpression,
                                java.util.ArrayList commonNewParams,
                                java.lang.String[] sourceDocumentIDHashes)
                         throws ManifoldCFException
        Remove all target links of the specified source documents that are not marked as "new" or "existing", and return the others to their base state.
        Throws:
        ManifoldCFException
      • maxClausePerformRemoveLinks

        protected int maxClausePerformRemoveLinks​(java.lang.Long jobID)
      • performRemoveLinks

        protected void performRemoveLinks​(java.util.List<java.lang.String> list,
                                          java.lang.Long jobID,
                                          java.lang.String commonNewExpression,
                                          java.util.ArrayList commonNewParams)
                                   throws ManifoldCFException
        Throws:
        ManifoldCFException
      • restoreLinks

        public void restoreLinks​(java.lang.Long jobID,
                                 java.lang.String[] sourceDocumentIDHashes)
                          throws ManifoldCFException
        Return all target links of the specified source documents to their base state.
        Throws:
        ManifoldCFException
      • maxClausesPerformRestoreLinks

        protected int maxClausesPerformRestoreLinks​(java.lang.Long jobID)
      • revertLinks

        public void revertLinks​(java.lang.Long jobID,
                                java.lang.String[] sourceDocumentIDHashes)
                         throws ManifoldCFException
        Throw away links added during (aborted) processing.
        Throws:
        ManifoldCFException
      • maxClausesPerformRevertLinks

        protected int maxClausesPerformRevertLinks​(java.lang.Long jobID)
      • getDocumentChildren

        public IResultSet getDocumentChildren​(java.lang.Long jobID,
                                              java.lang.String parentIDHash)
                                       throws ManifoldCFException
        Get document's children.
        Returns:
        rows that contain the children. Column names are 'linktype','childidentifier'.
        Throws:
        ManifoldCFException
      • getDocumentUniqueParents

        public java.lang.String[] getDocumentUniqueParents​(java.lang.Long jobID,
                                                           java.lang.String childIDHash)
                                                    throws ManifoldCFException
        Get document's parents.
        Returns:
        a set of document identifier hashes that constitute parents of the specified identifier.
        Throws:
        ManifoldCFException
      • stringToStatus

        public static int stringToStatus​(java.lang.String status)
        Convert string to link status.
      • statusToString

        public static java.lang.String statusToString​(int status)
        Convert link status to string