Informační tok Funkční structura Datová struktura ER model Modulová struktura Typová struktura Relační model Dokumentace


[Celkový datový model] [Funkce] [Externí rohraní] [Stavové diagramy] [Datové elementy] [Entity] [Relace]
[Databáze] [Události] [Materiály] [Generovací funkce] [Vyhodnocovací funkce] [Konfigurace] [Uživatelé] [Projekt] [Home]



Vyhodnocovací funkce
Check_Relationships
(Relational Model)


Vytvořeno: 12-11-1995 12:50:56
Poslední změna: 12-10-2002 10:11:10

Checks all relationships shown in the specified relational model for missing or incomplete foreign key definitions, M:N cardinality, and missing user defined integrity rules.

Modul

Module: Relational Model

Zdrojový kód:

PROCEDURE Check_Relationships FOR RELAREA
BEGIN
/*
  check attributes of relationships:
  - completeness of foreign keys
  - integrity rules
  - semantic
*/
  PRINT {"ARIAL",12,BOLD} "Test vztahů v relačním modelu ";
  PRINT {"ARIAL",12,BOLD,ITALIC} CONV$(Relarea.Boxname),NL;

  found%=0;
  FOREACH Rellink WHERE Rellink.Area=Relarea.Name DO
    head%=0;
    FOR Relrship WHERE Relrship.Name=Rellink.Name AND
                       Relrship.Target=Rellink.Target AND
                       Relrship.Source=Rellink.Source DO
      IF Relrship.Cardinality="mn" THEN
        IF head%<>1 THEN
          head%=1;
          FOR Relation WHERE Name=Relrship.Source DO
            PRINT {"ARIAL",10,BOLD} NL,CONV$(Boxname)," ";
          END
          PRINT {"ARIAL",10,BOLD} CONV$(Relrship.Boxname);
          FOR Relation WHERE Name=Relrship.Target DO
            PRINT {"ARIAL",10,BOLD} " ",CONV$(Boxname),NL;
          END
        END
        PRINT {"ARIAL",10} TAB(4),"Nalezen vztah typu - N:M.",NL;
      END
      norel%=1;
      FOREACH Relrshipattribute WHERE Relrshipattribute.Rship=Relrship.Name AND
                                      Relrshipattribute.Source=Relrship.Source AND
                                      Relrshipattribute.Target=Relrship.Target DO
        norel%=0;
        BREAK;
      END
      IF norel%=0 THEN
        FOREACH Relattribute WHERE Relation=Relrship.Source
                               AND Pkey<>0 DO
          flag%=0;
          FOR Relrshipattribute WHERE Relrshipattribute.Rship=Relrship.Name AND
                                      Relrshipattribute.Source=Relrship.Source AND
                                      Relrshipattribute.Target=Relrship.Target AND
                                      Relrshipattribute.Sourceattribute=Relattribute.Name DO
              flag%=1;
          END
          IF flag%=0 THEN
            // primary key of source relation linked incompletely
            IF head%<>1 THEN
              head%=1;
              PRINT {"ARIAL",10,BOLD} NL,CONV$(Relrship.Boxname),NL;
            END
            found%=1;
            PRINT {"ARIAL",10} TAB(4),"Definice cizího klíče není úplná.",NL;
            BREAK;
          END
        END
      ELSE
        IF head%<>1 THEN
          head%=1;
          PRINT {"ARIAL",10,BOLD} NL,CONV$(Relrship.Boxname),NL;
        END
        found%=1;
        PRINT {"ARIAL",10} TAB(4),"Chybí definice cizího klíče.",NL;
      END
      
      IF Relrship.Integrity=76 AND Relrship.Userintegrity="" THEN
        IF head%<>1 THEN
          head%=1;
          PRINT {"ARIAL",10,BOLD} NL,CONV$(Relrship.Boxname),NL;
        END
        found%=1;
        PRINT {"ARIAL",10} TAB(4),"Porušena pravidla integrity.",NL;
      END
      IF Relrship.Semantic="" THEN
        IF head%<>1 THEN
          head%=1;
          PRINT {"ARIAL",10,BOLD} NL, CONV$(Relrship.Boxname),NL;
        END
        found%=1;
        PRINT {"ARIAL",10} TAB(4),"Nemá sémantiku.",NL;
      END
    END
  END

  IF found%=0 THEN
    PRINT {"ARIAL",10} NL,TAB(4),"Bez formálních chyb.",NL;
  END
  PRINT NL;


END


Generováno: 16.10.2003 7:41 Systém: C:\Documents and Settings\hajsman\Dokumenty\Vyuka\Irs2\Projekt case40\Projekt03.csf Generováno systémem case/4/0
Vygeneroval: Administrator Soubor: C:\Documents and Settings\hajsman\Dokumenty\Vyuka\Irs2\Projekt case40\html\34.htm (C) microTOOL GmbH 2002