class NodeDynamicLabelOrphanChainStartCheck implements RecordCheck<DynamicRecord, DynamicLabelConsistencyReport>,
        ComparativeRecordChecker<DynamicRecord, DynamicRecord, DynamicLabelConsistencyReport> {

    @Override
    public void check( DynamicRecord record,
                       CheckerEngine<DynamicRecord, DynamicLabelConsistencyReport> engine,
                       RecordAccess records )
    {
        if ( record.inUse() && record.isStartRecord() )
        {
            Long ownerId = readOwnerFromDynamicLabelsRecord( record );
            if ( null == ownerId )
            {
                // no owner but in use indicates a broken record
                engine.report().orphanDynamicLabelRecord();
            }
            else
            {
                // look at owning node record to verify consistency
                engine.comparativeCheck( records.node( ownerId ), VALID_NODE_RECORD );
            }
        }
    }

}