Annotation Research ツールのスキーマ (EDM サンプル アプリケーション)

このアプリケーションで実装されるエンティティは、エンティティ データ モデル (EDM) を使用し、概念スキーマ定義言語 (CSDL) で宣言および定義されます。3 つのエンティティを使用して、Web 参照、参照記述子、および連絡先に関するデータが格納されます。4 番目のエンティティは、参照および連絡先を接続する識別子のペアを格納するために必要です。エンティティとアソシエーションの詳細については、「EDM 仕様」を参照してください。

各連絡先ユーザーは多くの参照に関連付けることができ、連絡先と参照間のアソシエーションは多対多のアソシエーションとして実装する必要があります。各参照記述子には 1 つのみの Web 参照に関するデータが含まれますが、参照は数多くの参照記述子に関連付けることができます。参照および参照記述子間のアソシエーションは、多対一として実装されます。

以下のスキーマ セグメントでは、Reference エンティティの宣言を示します。Key プロパティは ReferenceID プロパティとして指定されます。3 つの追加のプロパティとして、DocumentTypeDocumentText、および Locator が存在します。Locator プロパティには、Web 参照を検索するために使用する URL が含まれています。DocumentType および DocumentText はこの例のアプリケーション コードでは使用されません。これらは SQL Server のフルテキスト検索機能を使用するその他の例のために提供されています。スキーマの詳細については、「スキーマ (EDM)」を参照してください。

RefDescriptors という名前のナビゲーション プロパティは、Reference 型のインスタンスに関連する ReferenceDescriptor エンティティのインスタンスへのショートカットをアプリケーション コード内で提供します。ナビゲーション プロパティの詳細については、「ナビゲーション プロパティ (EDM)」を参照してください。

  <EntityType Name="Reference">
    <Key>
      <PropertyRef Name="ReferenceID" />
    </Key>
    <Property Name="ReferenceID" Type="Guid" Nullable="false" />
    <Property Name="DocumentType" Type="String" MaxLength="8" />
    <Property Name="DocumentText" Type="String" MaxLength="4000" />
    <Property Name="Locator" Type="String" Nullable="false"
         MaxLength="500" />
    <NavigationProperty Name="RefDescriptors"
         Relationship="Self.ReferenceDescriptor_Reference"
         FromRole="Reference" ToRole="ReferenceDescriptor" />
  </EntityType>

ReferenceDescriptor エンティティは、次のスキーマ セグメントで宣言し、定義しています。

  <EntityType Name="ReferenceDescriptor">
    <Key>
      <PropertyRef Name="DescriptorID" />
    </Key>
    <Property Name="DescriptorID" Type="Guid" Nullable="false" />
    <Property Name="Annotation" Type="String" MaxLength="2000" />
    <Property Name="Keyword" Type="String" MaxLength="50" />
    <NavigationProperty Name="Reference"
          Relationship="Self.ReferenceDescriptor_Reference"
          FromRole="ReferenceDescriptor" ToRole="Reference" />
  </EntityType>

このエンティティは、Annotation プロパティと Keyword プロパティを含んでいます。これらのどちらかまたは両方を使用して、Web ページの Reference を分類し、記述できます。どちらかのプロパティを NULL にすることはできますが、どちらか片方は割り当てる必要があります。アプリケーション内のユーザー インターフェイスで、それが必要であるかどうかを検証できます。

Reference エンティティのナビゲーション プロパティは、次のスキーマ セグメントで定義されている Association を使用します。

  <Association Name="ReferenceDescriptor_Reference">
    <End Role="Reference" Type="ResearchCollaborationDataModel.Reference" Multiplicity="1" />
    <End Role="ReferenceDescriptor"
       Type="ResearchCollaborationDataModel.ReferenceDescriptor"
       Multiplicity="*" />
  </Association>

このアソシエーションで使用される <End> タグは、一対多のリレーションシップにおける Reference エンティティと ReferenceDescriptor エンティティを示します。各 Reference は、任意の数の記述子を使用して記述できます。オブジェクト モデルが構築されている場合、ナビゲーション プロパティは RefDescriptor インスタンスのコレクションのように機能します。ナビゲーション プロパティは、プログラミング可能なデータ モデル内で ObjectQuery として構築されます。

このアソシエーション内の EndRole の定義は同義です。

多対多のアソシエーションの実装

任意の数の References を任意の数の Contacts に関連付けることができるので、これらのエンティティ間のアソシエーションは多対多のアソシエーションとして実装する必要があります。多対多のアソシエーションには、ストレージ実装内のリンク テーブルと、リンク テーブルを表すための概念スキーマおよびストレージ メタデータの両方でのエンティティの宣言が必要です。その後、アソシエーションがリンク エンティティおよび Contact エンティティと Reference エンティティの両方との間で宣言されます。

CSDL での次のエンティティ宣言では、データベース内のリンク テーブルを使用します。ストア スキーマ定義言語 (SSDL) での類似の宣言は、リンク テーブルにメタデータを提供します。

  <EntityType Name="ContactPersonReference">
    <Key>
      <PropertyRef Name="ContactPersonRefID" />
    </Key>
    <Property Name="ContactPersonRefID" Type="Guid" Nullable="false" />
      <NavigationProperty Name="RelatedReference"
          Relationship="Self.LinkTable_Reference"
          FromRole="ContactPersonReference" ToRole="Reference" />
      <NavigationProperty Name="RelatedContact"
          Relationship="Self.LinkTable_ContactPerson"
          FromRole="ContactPersonReference" ToRole="ContactPerson" />
  </EntityType>

ID Key は、このスキーマで宣言される唯一のプロパティです。ナビゲーション プロパティは、関連する Reference インスタンスと関連する ContactPerson インスタンスのコレクションを表します。データ テーブルには、ReferenceID GUID と ContactPersonID GUID のペアを含む列があります。

LinkTable_Reference および LinkTable_ContactPerson という 2 つのアソシエーションは多対多のリレーションシップをサポートします。これらのアソシエーションは、次の構文で定義されます。

  <AssociationSet Name="LinkTable_Reference"
      Association="ResearchCollaborationDataModel.LinkTable_Reference">
    <End Role="Reference" EntitySet="Reference" />
    <End Role="ContactPersonReference"
       EntitySet="ContactPersonReference" />
  </AssociationSet>

  <Association Name="LinkTable_ContactPerson">
    <End Role="ContactPerson" Type="ResearchCollaborationDataModel.ContactPerson" Multiplicity="1" />
    <End Role="ContactPersonReference"
       Type="ResearchCollaborationDataModel.ContactPersonReference"
       Multiplicity="*" />
  </Association>

これらの各アソシエーションは一対多として定義されますが、リンク エンティティのナビゲーション プロパティは Reference/ContactPerson ペアのコレクションを接続します。

完全なスキーマおよびマッピングの仕様

次のセクションでは、この例で使用するスキーマとマッピングの仕様を示します。

概念スキーマ (CSDL)

アプリケーションが使用するエンティティとアソシエーションは、CSDL で定義されます。オブジェクト モデルはこのデザイン スキーマから構築されます。

<?xml version="1.0" encoding="utf-8"?>
   <Schema Namespace="ResearchCollaborationDataModel" Alias="Self"
        xmlns="https://schemas.microsoft.com/ado/2006/04/edm">

  <EntityType Name="Reference">
    <Key>
      <PropertyRef Name="ReferenceID" />
    </Key>
    <Property Name="ReferenceID" Type="Guid" Nullable="false" />
    <Property Name="DocumentType" Type="String" />
    <Property Name="DocumentText" Type="String" />
    <Property Name="Locator" Type="String" Nullable="false" />
    <NavigationProperty Name="RefDescriptors"
 Relationship="Self.ReferenceDescriptor_Reference" FromRole="Reference"
 ToRole="ReferenceDescriptor" />
  </EntityType>

  <EntityType Name="ReferenceDescriptor">
    <Key>
      <PropertyRef Name="DescriptorID" />
    </Key>
    <Property Name="DescriptorID" Type="Guid" Nullable="false" />
    <Property Name="Annotation" Type="String" />
    <Property Name="Keyword" Type="String" />
    <NavigationProperty Name="Reference"
        Relationship="Self.ReferenceDescriptor_Reference"
        FromRole="ReferenceDescriptor" ToRole="Reference" />
  </EntityType>

  <EntityType Name="ContactPerson">
    <Key>
      <PropertyRef Name="ContactPersonID" />
    </Key>
    <Property Name="ContactPersonID" Type="Guid" Nullable="false" />
    <Property Name="LastName" Type="String" Nullable="false" />
    <Property Name="FirstName" Type="String" Nullable="false" />
    <Property Name="Title" Type="String" />
    <Property Name="Email" Type="String" Nullable="false" />
  </EntityType>

  <EntityType Name="ContactPersonReference">
    <Key>
      <PropertyRef Name="ContactPersonRefID" />
    </Key>
    <Property Name="ContactPersonRefID" Type="Guid" Nullable="false" />
      <NavigationProperty Name="RelatedReference" Relationship="Self.LinkTable_Reference"
            FromRole="ContactPersonReference" ToRole="Reference" />
      <NavigationProperty Name="RelatedContact" Relationship="Self.LinkTable_ContactPerson"
        FromRole="ContactPersonReference" ToRole="ContactPerson" />
  </EntityType>

  <Association Name="ReferenceDescriptor_Reference">
    <End Role="Reference" Type="ResearchCollaborationDataModel.Reference" Multiplicity="1" />
    <End Role="ReferenceDescriptor" Type="ResearchCollaborationDataModel.ReferenceDescriptor" Multiplicity="*" />
  </Association>

  <Association Name="LinkTable_ContactPerson">
    <End Role="ContactPerson" Type="ResearchCollaborationDataModel.ContactPerson" Multiplicity="1" />
    <End Role="ContactPersonReference" Type="ResearchCollaborationDataModel.ContactPersonReference" Multiplicity="*" />
  </Association>

  <Association Name="LinkTable_Reference">
    <End Role="Reference" Type="ResearchCollaborationDataModel.Reference" Multiplicity="1" />
    <End Role="ContactPersonReference"
 Type="ResearchCollaborationDataModel.ContactPersonReference"
 Multiplicity="*" />
  </Association>

  <EntityContainer Name="ResearchCollaborationData">
      
    <EntitySet Name="ContactPerson"
 EntityType="ResearchCollaborationDataModel.ContactPerson" />
    <EntitySet Name="ContactPersonReference"
 EntityType="ResearchCollaborationDataModel.ContactPersonReference" />
    <EntitySet Name="Reference" EntityType="ResearchCollaborationDataModel.Reference" />
    <EntitySet Name="ReferenceDescriptor"
 EntityType="ResearchCollaborationDataModel.ReferenceDescriptor" />
    
    <AssociationSet Name="LinkTable_ContactPerson"
 Association="ResearchCollaborationDataModel.LinkTable_ContactPerson">
      <End Role="ContactPerson" EntitySet="ContactPerson" />
      <End Role="ContactPersonReference"
           EntitySet="ContactPersonReference" />
    </AssociationSet>
    
    <AssociationSet Name="LinkTable_Reference"
 Association="ResearchCollaborationDataModel.LinkTable_Reference">
      <End Role="Reference" EntitySet="Reference" />
      <End Role="ContactPersonReference"
            EntitySet="ContactPersonReference" />
    </AssociationSet>
    
    <AssociationSet Name="ReferenceDescriptor_Reference"
 Association="ResearchCollaborationDataModel.ReferenceDescriptor_Reference">
      <End Role="Reference" EntitySet="Reference" />
      <End Role="ReferenceDescriptor" EntitySet="ReferenceDescriptor" />
    </AssociationSet>

  </EntityContainer>

</Schema>

ストレージ メタデータ スキーマ (SSDL)

EDM アプリケーションが使用するストレージ構造のメタデータは、SSDL を使用して定義します。

<?xml version="1.0" encoding="utf-8"?>
  <Schema Namespace="ResearchCollaborationDataTarget" Alias="Self"
      Provider="System.Data.SqlClient"
      ProviderManifestToken="2005"
      xmlns="https://schemas.microsoft.com/ado/2006/04/edm/ssdl">

  <EntityType Name="ContactPerson">
    <Key>
      <PropertyRef Name="ContactPersonID" />
    </Key>
    <Property Name="ContactPersonID" Type="uniqueidentifier"
         Nullable="false" />
    <Property Name="LastName" Type="nvarchar" Nullable="false"
         MaxLength="50" />
    <Property Name="FirstName" Type="nvarchar" Nullable="false"
         MaxLength="50" />
    <Property Name="Title" Type="nvarchar" MaxLength="50" />
    <Property Name="Email" Type="nvarchar" Nullable="false"
         MaxLength="50" />
  </EntityType>

  <EntityType Name="ContactPersonReference">
    <Key>
      <PropertyRef Name="ContactPersonRefID" />
    </Key>
    <Property Name="ContactPersonID" Type="uniqueidentifier"
          Nullable="false" />
    <Property Name="ReferenceID" Type="uniqueidentifier"
          Nullable="false" />
    <Property Name="ContactPersonRefID" Type="uniqueidentifier"
          Nullable="false" />
  </EntityType>

  <EntityType Name="Reference">
    <Key>
      <PropertyRef Name="ReferenceID" />
    </Key>
    <Property Name="ReferenceID" Type="uniqueidentifier"
         Nullable="false" />
    <Property Name="DocumentType" Type="nvarchar" MaxLength="8" />
    <Property Name="DocumentText" Type="nvarchar" MaxLength="4000" />
    <Property Name="Locator" Type="nvarchar" Nullable="false"
         MaxLength="500" />
  </EntityType>

  <EntityType Name="ReferenceDescriptor">
    <Key>
      <PropertyRef Name="DescriptorID" />
    </Key>
    <Property Name="DescriptorID" Type="uniqueidentifier"
           Nullable="false" />
    <Property Name="ReferenceID" Type="uniqueidentifier"
           Nullable="false" />
    <Property Name="Annotation" Type="nvarchar" MaxLength="2000" />
    <Property Name="Keyword" Type="nvarchar" MaxLength="50" />
  </EntityType>

  <Association Name="LinkTable_ContactPerson">
    <End Role="ContactPerson"
          Type="ResearchCollaborationDataTarget.ContactPerson" Multiplicity="1"/>
    <End Role="ContactPersonReference"
       Type="ResearchCollaborationDataTarget.ContactPersonReference"
       Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="ContactPerson">
        <PropertyRef Name="ContactPersonID" />
      </Principal>
      <Dependent Role="ContactPersonReference">
        <PropertyRef Name="ContactPersonID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="LinkTable_Reference">
    <End Role="Reference"
         Type="ResearchCollaborationDataTarget.Reference"
         Multiplicity="1" />
    <End Role="ContactPersonReference"
       Type="ResearchCollaborationDataTarget.ContactPersonReference"
       Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Reference">
        <PropertyRef Name="ReferenceID" />
      </Principal>
      <Dependent Role="ContactPersonReference">
        <PropertyRef Name="ReferenceID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ReferenceDescriptor_Reference">
    <End Role="Reference"
   Type="ResearchCollaborationDataTarget.Reference" Multiplicity="1" />
    <End Role="ReferenceDescriptor"
           Type="ResearchCollaborationDataTarget.ReferenceDescriptor"
           Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Reference">
        <PropertyRef Name="ReferenceID" />
      </Principal>
      <Dependent Role="ReferenceDescriptor">
        <PropertyRef Name="ReferenceID" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <EntityContainer Name="dbo">
    <EntitySet Name="ContactPerson"
       EntityType="ResearchCollaborationDataTarget.ContactPerson" />
    <EntitySet Name="ContactPersonReference"
 EntityType="ResearchCollaborationDataTarget.ContactPersonReference"/>
    <EntitySet Name="Reference"
       EntityType="ResearchCollaborationDataTarget.Reference" />
    <EntitySet Name="ReferenceDescriptor"
   EntityType="ResearchCollaborationDataTarget.ReferenceDescriptor"/>

    <AssociationSet Name="LinkTable_ContactPerson"
  Association="ResearchCollaborationDataTarget.LinkTable_ContactPerson">
      <End Role="ContactPerson" EntitySet="ContactPerson" />
      <End Role="ContactPersonReference"
          EntitySet="ContactPersonReference" />
    </AssociationSet>
    <AssociationSet Name="LinkTable_Reference"
    Association="ResearchCollaborationDataTarget.LinkTable_Reference">
      <End Role="Reference" EntitySet="Reference" />
      <End Role="ContactPersonReference"
          EntitySet="ContactPersonReference" />
    </AssociationSet>

    <AssociationSet Name="ReferenceDescriptor_Reference"
 Association="ResearchCollaborationDataTarget.ReferenceDescriptor_Reference">
      <End Role="Reference" EntitySet="Reference" />
      <End Role="ReferenceDescriptor" EntitySet="ReferenceDescriptor" />
    </AssociationSet>
  </EntityContainer>

</Schema>

マッピング スキーマ (MSL)

CSDL で定義されているエンティティおよびアソシエーションは、マッピング スキーマ言語 (MSL) を使用して SSDL のストレージ メタデータにマップされます。

<?xml version="1.0" encoding="utf-8"?>
<Mapping Space="C-S"
    xmlns:edm="urn:schemas-microsoft-com:windows:storage:mapping:CS"
    xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">

  <edm:EntityContainerMapping
           CdmEntityContainer="ResearchCollaborationData"
           StorageEntityContainer="dbo">
    <edm:EntitySetMapping Name="ContactPerson">
      <edm:EntityTypeMapping
         TypeName="ResearchCollaborationDataModel.ContactPerson">
        <edm:MappingFragment StoreEntitySet="ContactPerson">
          <edm:ScalarProperty Name="ContactPersonID"
               ColumnName="ContactPersonID" />
          <edm:ScalarProperty Name="LastName" ColumnName="LastName"/>
          <edm:ScalarProperty Name="FirstName" 
               ColumnName="FirstName" />
          <edm:ScalarProperty Name="Title" ColumnName="Title" />
          <edm:ScalarProperty Name="Email" ColumnName="Email" />
        </edm:MappingFragment>
      </edm:EntityTypeMapping>
    </edm:EntitySetMapping>
    <edm:EntitySetMapping Name="ContactPersonReference">
      <edm:EntityTypeMapping
    TypeName="ResearchCollaborationDataModel.ContactPersonReference">
        <edm:MappingFragment StoreEntitySet="ContactPersonReference">
          <edm:ScalarProperty Name="ContactPersonRefID"
              ColumnName="ContactPersonRefID" />
        </edm:MappingFragment>
      </edm:EntityTypeMapping>
    </edm:EntitySetMapping>
    <edm:EntitySetMapping Name="Reference">
      <edm:EntityTypeMapping
            TypeName="ResearchCollaborationDataModel.Reference">
        <edm:MappingFragment StoreEntitySet="Reference">
          <edm:ScalarProperty Name="ReferenceID"
               ColumnName="ReferenceID" />
          <edm:ScalarProperty Name="DocumentType"
               ColumnName="DocumentType" />
          <edm:ScalarProperty Name="DocumentText"
               ColumnName="DocumentText" />
          <edm:ScalarProperty Name="Locator" 
               ColumnName="Locator" />
        </edm:MappingFragment>
      </edm:EntityTypeMapping>
    </edm:EntitySetMapping>
    <edm:EntitySetMapping Name="ReferenceDescriptor">
      <edm:EntityTypeMapping
       TypeName="ResearchCollaborationDataModel.ReferenceDescriptor">
        <edm:MappingFragment StoreEntitySet="ReferenceDescriptor">
          <edm:ScalarProperty Name="DescriptorID"
               ColumnName="DescriptorID" />
          <edm:ScalarProperty Name="Annotation" 
               ColumnName="Annotation" />
          <edm:ScalarProperty Name="Keyword" ColumnName="Keyword" />
        </edm:MappingFragment>
      </edm:EntityTypeMapping>
    </edm:EntitySetMapping>
    <edm:AssociationSetMapping Name="LinkTable_ContactPerson"
      TypeName="ResearchCollaborationDataModel.LinkTable_ContactPerson"
        StoreEntitySet="ContactPersonReference">
      <edm:EndProperty Name="ContactPerson">
        <edm:ScalarProperty Name="ContactPersonID"
              ColumnName="ContactPersonID" />
      </edm:EndProperty>
      <edm:EndProperty Name="ContactPersonReference">
        <edm:ScalarProperty Name="ContactPersonRefID"
             ColumnName="ContactPersonRefID" />
      </edm:EndProperty>
      <edm:Condition ColumnName="ContactPersonID" IsNull="false" />
    </edm:AssociationSetMapping>
    <edm:AssociationSetMapping Name="LinkTable_Reference"
         TypeName="ResearchCollaborationDataModel.LinkTable_Reference"
         StoreEntitySet="ContactPersonReference">
      <edm:EndProperty Name="Reference">
        <edm:ScalarProperty Name="ReferenceID" 
              ColumnName="ReferenceID" />
      </edm:EndProperty>
      <edm:EndProperty Name="ContactPersonReference">
        <edm:ScalarProperty Name="ContactPersonRefID"
             ColumnName="ContactPersonRefID" />
      </edm:EndProperty>
      <edm:Condition ColumnName="ReferenceID" IsNull="false" />
    </edm:AssociationSetMapping>
    <edm:AssociationSetMapping Name="ReferenceDescriptor_Reference"
  TypeName="ResearchCollaborationDataModel.ReferenceDescriptor_Reference"
  StoreEntitySet="ReferenceDescriptor">
      <edm:EndProperty Name="Reference">
        <edm:ScalarProperty Name="ReferenceID" 
            ColumnName="ReferenceID" />
      </edm:EndProperty>
      <edm:EndProperty Name="ReferenceDescriptor">
        <edm:ScalarProperty Name="DescriptorID"
            ColumnName="DescriptorID" />
      </edm:EndProperty>
      <edm:Condition ColumnName="ReferenceID" IsNull="false" />
    </edm:AssociationSetMapping>
  </edm:EntityContainerMapping>
</Mapping>

次のスクリプトを使用すると、この例で使用するデータベースを作成できます。SQL Server Management Studio で ResearchCollaborationData データベースおよびスキーマを作成するには、次の手順に従います。

  1. [ファイル] メニューの [新規作成] をポイントし、[データベース エンジン クエリ] をクリックします。

  2. [データベース エンジンへの接続] ダイアログ ボックスで「localhost」と入力するか、または SQL Server インスタンスの名前を入力し、[接続] をクリックします。

  3. クエリ ウィンドウに次の Transact-SQL スクリプトを貼り付けて、[実行] をクリックします。

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

USE [master];
GO

IF EXISTS (SELECT * FROM sys.databases 
WHERE name = 'ResearchCollaborationData')
DROP DATABASE ResearchCollaborationData;
GO

-- Create the database.
CREATE DATABASE ResearchCollaborationData;
GO

USE ResearchCollaborationData;
GO

IF NOT EXISTS (SELECT * FROM sys.objects 
WHERE object_id = OBJECT_ID(N'[dbo].[ContactPerson]') 
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ContactPerson](
[ContactPersonID] [uniqueidentifier] NOT NULL,
[LastName] [nvarchar](50) NOT NULL,
[FirstName] [nvarchar](50) NOT NULL,
[Title] [nvarchar](50) NULL,
[Email] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_ContactPerson] PRIMARY KEY CLUSTERED 
(
[ContactPersonID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects 
WHERE object_id = OBJECT_ID(N'[dbo].[Reference]') 
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Reference](
[ReferenceID] [uniqueidentifier] NOT NULL,
[DocumentType] [nvarchar](8) NULL,
[DocumentText] [nvarchar](max) NULL,
[Locator] [nvarchar](500) NOT NULL,
 CONSTRAINT [PK_Reference] PRIMARY KEY CLUSTERED 
(
[ReferenceID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects 
WHERE object_id = OBJECT_ID(N'[dbo].[ContactPersonReference]') 
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ContactPersonReference](
[ContactPersonID] [uniqueidentifier] NOT NULL,
[ReferenceID] [uniqueidentifier] NOT NULL,
[ContactPersonRefID] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_ContactPersonReference] PRIMARY KEY CLUSTERED 
(
[ContactPersonRefID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects 
WHERE object_id = OBJECT_ID(N'[dbo].[ReferenceDescriptor]') 
AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ReferenceDescriptor](
[DescriptorID] [uniqueidentifier] NOT NULL,
[ReferenceID] [uniqueidentifier] NOT NULL,
[Annotation] [nvarchar](2000) NULL,
[Keyword] [nvarchar](50) NULL,
 CONSTRAINT [PK_ReferenceDescriptor] PRIMARY KEY CLUSTERED 
(
[DescriptorID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys 
WHERE object_id = OBJECT_ID(N'[dbo].[LinkTable_ContactPerson]') AND parent_object_id = 
OBJECT_ID(N'[dbo].[ContactPersonReference]'))
ALTER TABLE [dbo].[ContactPersonReference]  
WITH CHECK ADD  CONSTRAINT [LinkTable_ContactPerson] FOREIGN KEY([ContactPersonID])
REFERENCES [dbo].[ContactPerson] ([ContactPersonID])
GO
ALTER TABLE [dbo].[ContactPersonReference] CHECK CONSTRAINT [LinkTable_ContactPerson]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys 
WHERE object_id = OBJECT_ID(N'[dbo].[LinkTable_Reference]') AND parent_object_id = 
OBJECT_ID(N'[dbo].[ContactPersonReference]'))
ALTER TABLE [dbo].[ContactPersonReference]  
WITH CHECK ADD  CONSTRAINT [LinkTable_Reference] FOREIGN KEY([ReferenceID])
REFERENCES [dbo].[Reference] ([ReferenceID])
GO
ALTER TABLE [dbo].[ContactPersonReference] CHECK CONSTRAINT [LinkTable_Reference]
GO
IF NOT EXISTS (SELECT * FROM sys.foreign_keys 
WHERE object_id = OBJECT_ID(N'[dbo].[ReferenceDescriptor_Reference]') 
AND parent_object_id = OBJECT_ID(N'[dbo].[ReferenceDescriptor]'))
ALTER TABLE [dbo].[ReferenceDescriptor]  
WITH CHECK ADD  CONSTRAINT [ReferenceDescriptor_Reference] FOREIGN KEY([ReferenceID])
REFERENCES [dbo].[Reference] ([ReferenceID])
GO
ALTER TABLE [dbo].[ReferenceDescriptor] CHECK CONSTRAINT [ReferenceDescriptor_Reference]
GO

USE ResearchCollaborationData
GO

INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('12b18fe1-be82-486c-b248-00183aad2c88', '', '', 'https://msdn2.microsoft.com/en-us/data/aa937722.aspx')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('34bf3c5f-202a-45fe-af42-0a1d9bf489e2', '', '', 'https://msdn2.microsoft.com/en-us/library/190bkk9s.aspx')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('cfc4a592-296d-4b6f-b8fe-0e7a42b4a29a', '', '', 'https://blogs.msdn.com/adonet/archive/2007/01/30/entity-data-model-part-1.aspx')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('aad24f4c-c461-4d62-8723-6b52574311d1', '', '', 'https://www.microsoft.com/windows/directx/productinfo/overview/default.mspx')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('7d4a1c27-3046-4866-974f-81b1e4642719', '', '', 'https://msdn2.microsoft.com/en-us/library/ms269115.aspx')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('7b217f44-3ed0-492f-aaf6-8c064e3e8c75', '', '', 'https://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=49271')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('dbd5d613-990b-4280-b739-8d1ad4476a5f', '', '', 'https://www.microsoft.com/windows/directx/default.mspx')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('4f267ad7-c1e8-469c-aff7-9a766952c40c', '', '', 'https://www.microsoft.com/windowsvista/features/foreveryone/networking.mspx')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('1ca96c96-cd2a-48b2-998f-a3fd0b98234e', '', '', 'https://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('f22e9a75-727c-4829-80dd-bbfdaaad49dc', '', '', 'https://www.microsoft.com/windows/embedded/about.mspx')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('3d5da450-28eb-4741-80a7-c748f72522a9', '', '', 'https://www.microsoft.com/windows/windowsmedia/default.mspx')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('6edd9142-ce7f-440d-9769-cde1ccbdf317', '', '', 'https://www.microsoft.com/windows/embedded/default.mspx')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('79bb7135-1516-43cb-9054-da83b9ecda29', '', '', 'http://members.microsoft.com/CustomerEvidence/search/EvidenceDetails.aspx?EvidenceID=13673&LanguageID=1')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('c387fdcc-cea9-45ce-90b8-e4ac1bd4cc28', '', '', 'https://msdn.microsoft.com/vstudio/')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('b4271f82-4ac5-4955-868e-f24d1b0f5bb1', '', '', 'https://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=49271')
INSERT INTO dbo.Reference(ReferenceId, DocumentType, DocumentText, Locator)
VALUES ('6e862d8d-88e4-4d86-8119-ffc53db0a17a', '', '', 'https://blogs.msdn.com/adonet/archive/2006/09/27/ADONET_vNext_EDM_Designer.aspx')


INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('93790357-1fb2-4314-a26a-0187ad5ccb6f', 'The power of multimedia in Windows, DirectX gives you the best possible experience with graphics, sound, music, and 3-D animation.', 'DirectX', 'dbd5d613-990b-4280-b739-8d1ad4476a5f')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('b796b125-dc94-4a7a-86a2-10f3ac6ad0b3', 'Windows embedded', 'embedded', 'f22e9a75-727c-4829-80dd-bbfdaaad49dc')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('c13b2689-cb3a-4a2c-a4ca-14a1c8a02f71', 'Windows media', 'Windows Media', '3d5da450-28eb-4741-80a7-c748f72522a9')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('d4c4f616-cfb3-4799-889d-15cca8f7709f', 'Results:
ADO.NET
The designer in this CTP is an early prototype and only supports designing the “Conceptual” layer. The designer can also generate an Entity Data Model with 1:1 mappings from an existing database that you can use right away in your application while also graphically visualizing the “Conceptual” layer. Please take a look at the walkthroughs in the Overview document included with the Entity Data Model Designer prototype for more details.
https://blogs.msdn.com/adonet/archive/2006/09/27/ADONET_vNext_EDM_Designer.aspx

ADO.NET 2.0

https://msdn2.microsoft.com/en-us/data/aa937722.aspx

EDM
Generate an Entity Data Model with 1:1 mappings from an existing database that you can use right away in your application while also graphically visualizing the “Conceptual” layer. To aid brainstorming and to better understand typical developer scenarios, the ADO.NET team created an internal prototype of a designer to let developers model the ADO.NET vNext “Conceptual” layer.
https://blogs.msdn.com/adonet/archive/2006/09/27/ADONET_vNext_EDM_Designer.aspx

Entity Data Model 101
Most developers are familiar with the Object/Relational Mapping (ORM) problem: databases use the abstraction of rows in tables, but application programs use the abstraction of classes and objects. Existing ORM frameworks tend to address this mismatch by allowing programming classes to be annotated in order to relate them to the database. 
The intent with ADO.NET is more ambitious: We view the ORM problem as just one of a number of services we want to build on the database. Other services include reporting, synchronization, backup, and so on. In order to cover all of these services, we have designed a data model that is similar to the object-oriented idiom that programmers use, while remaining independent of any particular programming language or programming platform. This data model is the Entity Data Model (EDM).

https://blogs.msdn.com/adonet/archive/2007/01/30/entity-data-model-part-1.aspx
', 'Visual Studio pre-release product, '1ca96c96-cd2a-48b2-998f-a3fd0b98234e')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('e01d0af6-cc8c-4ccd-b1dd-17d2fac19878', 'The designer in this CTP is an early prototype and only supports designing the “Conceptual” layer. The designer can also generate an Entity Data Model with 1:1 mappings from an existing database that you can use right away in your application while also graphically visualizing the “Conceptual” layer. Please take a look at the walkthroughs in the Overview document included with the Entity Data Model Designer prototype for more details.', 'ADO.NET', '6e862d8d-88e4-4d86-8119-ffc53db0a17a')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('255291b6-6377-4b26-9cbd-3dd58d921ef0', 'ADO.NET', 'ADO.NET 2.0', '12b18fe1-be82-486c-b248-00183aad2c88')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('42598bdb-849a-4af9-96ee-61b8ecbc6931', 'Generate an Entity Data Model with 1:1 mappings from an existing database that you can use right away in your application while also graphically visualizing the “Conceptual” layer. To aid brainstorming and to better understand typical developer scenarios, the ADO.NET team created an internal prototype of a designer to let developers model the ADO.NET vNext “Conceptual” layer.', 'EDM', '6e862d8d-88e4-4d86-8119-ffc53db0a17a')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('4dd38a1f-6aad-412c-880b-72b83b686040', 'Hilton Hotels needed to develop a forecasting system to improve its business analysis process by establishing more accurate pricing and financial planning. It first created its OnQ Forecast Management System built using Microsoft® SQL Server™ 2000 to help forecast guestroom business. To extend the existing application, Hilton Hotels built a solution based on the Microsoft .NET Framework version 2.0 using the Microsoft Visual Studio® 2005 development system. Major solution components include: Microsoft SQL Server 2005 running on the Microsoft Windows Server™ 2003 operating system, both part of Microsoft Windows Server System™ integrated server software; and SQL Server 2005 Analysis Services, Reporting Services, and Integration Services. ', 'SQL Server', '79bb7135-1516-43cb-9054-da83b9ecda29')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('34a25e0e-1ed8-4d25-bc94-7c0da669c10a', 'Visual Studio is the development tool for creating drivers, applications and services across the Windows Embedded family of operating systems. Join the Visual Studio Community to get assistance with your coding projects.', 'embedded', '6edd9142-ce7f-440d-9769-cde1ccbdf317')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('cba41151-26f0-4d87-ab3a-9dab2f42b328', 'Most developers are familiar with the Object/Relational Mapping (ORM) problem: databases use the abstraction of rows in tables, but application programs use the abstraction of classes and objects. Existing ORM frameworks tend to address this mismatch by allowing programming classes to be annotated in order to relate them to the database. 
The intent with ADO.NET is more ambitious: We view the ORM problem as just one of a number of services we want to build on the database. Other services include reporting, synchronization, backup, and so on. In order to cover all of these services, we have designed a data model that is similar to the object-oriented idiom that programmers use, while remaining independent of any particular programming language or programming platform. This data model is the Entity Data Model (EDM).
', 'Entity Data Model 101', 'cfc4a592-296d-4b6f-b8fe-0e7a42b4a29a')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('5b7c783c-41a4-435a-8e18-b10851af1163', 'Microsoft DirectX is an advanced suite of multimedia application programming interfaces (APIs) built into Microsoft Windows; operating systems. DirectX provides a standard development platform for Windows-based PCs by enabling software developers to access specialized hardware features without having to write hardware-specific code.', 'DirectX', 'aad24f4c-c461-4d62-8723-6b52574311d1')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('485489f8-b5f8-4866-ad77-d8390c01a872', 'NASDAQ, which became the world’s first electronic stock market in 1971, and remains the largest U.S. electronic stock market, is constantly looking for more-efficient ways to serve its members. As the organization prepared to retire its aging Tandem mainframes, it deployed Microsoft® SQL Server™ 2005 on two 4-node Dell PowerEdge 6850 clusters to support its Market Data Dissemination System (MDDS). Every trade that is processed in the NASDAQ marketplace goes through the MDDS system, with SQL Server 2005 handling some 5,000 transactions per second at market open. SQL Server 2005 simultaneously handles about 100,000 queries a day, using SQL Server 2005 Snapshot Isolation to support real-time queries against the data without slowing the database. NASDAQ is enjoying a lower total cost of ownership compared to the Tandem Enscribe system that the SQL Server 2005 deployment has replaced.', 'SQL Server', '7b217f44-3ed0-492f-aaf6-8c064e3e8c75')
INSERT INTO dbo.ReferenceDescriptor(DescriptorID, Annotation, Keyword, ReferenceID)
VALUES ('c92409cd-4fa9-45e1-ba03-ff4b2386aa37', 'Pre-Release product 2 includes most of the products found in the Visual Studio product line. As with all prerelease software, we encourage you only to install these on a secondary machine, or in a virtual machine, as they are not supported by Microsoft Services support teams. As the goal of these previews is to gather feedback from the developer community, please use Microsoft Connect <http://connect.microsoft.com/visualstudio/> to report any issues, or to suggest improvements. MSDN Subscribers can also download these files from MSDN Subscriber Downloads <https://msdn2.microsoft.com/subscriptions/default.aspx>.', 'Visual Studio pre-release', '1ca96c96-cd2a-48b2-998f-a3fd0b98234e')


INSERT INTO dbo.ContactPerson(ContactPersonID, Email, FirstName, LastName, Title)
VALUES ('4887ae30-9820-408b-b4d7-061b7f1493b1', 'dankbac@adatum.com', 'Dan K', 'Bacon Jr.', 'Developer')
INSERT INTO dbo.ContactPerson(ContactPersonID, Email, FirstName, LastName, Title)
VALUES ('f8ff60e3-2b61-46d8-ac51-6a949f535127', 'kkelly@adatum.com', 'Kevin', 'Kelly', 'PM')
INSERT INTO dbo.ContactPerson(ContactPersonID, Email, FirstName, LastName, Title)
VALUES ('9a9d9c1c-0d70-4518-a279-937e272e6126', 'ravitart@adatum.com', 'Ravital', 'Artman', 'PUM')
INSERT INTO dbo.ContactPerson(ContactPersonID, Email, FirstName, LastName, Title)
VALUES ('1e08378d-51cb-4ca9-b39e-bd0679c85658', 'etienjac@adatum.com', 'Etienne P.', 'Jacques', 'Game Developer')
INSERT INTO dbo.ContactPerson(ContactPersonID, Email, FirstName, LastName, Title)
VALUES ('c6e87603-23ff-425f-9979-c0be2bd7f1c9', 'hodixon@adatum.com', 'Holly', 'Dixon', 'Programming Writer')
INSERT INTO dbo.ContactPerson(ContactPersonID, Email, FirstName, LastName, Title)
VALUES ('099380da-2ab8-4d45-a023-d137c885e6c9', 'bscholl@adatum.com', 'Boris', 'Scholl', 'Network Administrator')
INSERT INTO dbo.ContactPerson(ContactPersonID, Email, FirstName, LastName, Title)
VALUES ('bcc99ee4-b177-4183-82cd-d2977b21375e', 'jessicaarn@adatum.com', 'Jessica', 'Arnold', 'PM')


INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('56872a7b-4df1-45c9-b32c-1f4cf70161a5', 'bcc99ee4-b177-4183-82cd-d2977b21375e', '3d5da450-28eb-4741-80a7-c748f72522a9')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('70a2a910-8445-4583-9efa-32625f24b447', '4887ae30-9820-408b-b4d7-061b7f1493b1', '34bf3c5f-202a-45fe-af42-0a1d9bf489e2')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('7bdf4546-baee-4d0e-8c75-403f363d30d9', 'c6e87603-23ff-425f-9979-c0be2bd7f1c9', '6e862d8d-88e4-4d86-8119-ffc53db0a17a')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('c6b9bbd8-1c95-4e64-bef1-50ac841b6e66', '1e08378d-51cb-4ca9-b39e-bd0679c85658', 'aad24f4c-c461-4d62-8723-6b52574311d1')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('b7af3437-9d6c-4e80-ba2a-5aad08f33bc9', '9a9d9c1c-0d70-4518-a279-937e272e6126', '3d5da450-28eb-4741-80a7-c748f72522a9')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('a5901fb1-17ec-4151-9f66-689385f2cde2', 'f8ff60e3-2b61-46d8-ac51-6a949f535127', 'b4271f82-4ac5-4955-868e-f24d1b0f5bb1')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('c7447067-46fc-46ae-9484-6bedbbb1bdce', 'bcc99ee4-b177-4183-82cd-d2977b21375e', '6e862d8d-88e4-4d86-8119-ffc53db0a17a')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('21ec9fb4-eedb-469e-95b7-799ecea5a336', '099380da-2ab8-4d45-a023-d137c885e6c9', '4f267ad7-c1e8-469c-aff7-9a766952c40c')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('9bf1b016-137a-4d64-83b8-a24dd43b0a7c', 'c6e87603-23ff-425f-9979-c0be2bd7f1c9', 'dbd5d613-990b-4280-b739-8d1ad4476a5f')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('40c6579e-2e78-4442-877f-b88ff8d2146d', '4887ae30-9820-408b-b4d7-061b7f1493b1', '7d4a1c27-3046-4866-974f-81b1e4642719')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('0d3591d5-ebcf-4f18-84a8-f2e6f464ffb5', '4887ae30-9820-408b-b4d7-061b7f1493b1', 'c387fdcc-cea9-45ce-90b8-e4ac1bd4cc28')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('f27879b2-c2b7-4f2c-b0eb-f4aafe388345', '9a9d9c1c-0d70-4518-a279-937e272e6126', 'f22e9a75-727c-4829-80dd-bbfdaaad49dc')
INSERT INTO dbo.ContactPersonReference(ContactPersonRefID, ContactPersonID, ReferenceID)
VALUES ('c85f4e11-2060-4ab4-98e2-fc8ff33ecea0', '9a9d9c1c-0d70-4518-a279-937e272e6126', '6edd9142-ce7f-440d-9769-cde1ccbdf317')

参照

概念

Annotation and Research Collaboration ツール (EDM サンプル アプリケーション)
Annotation Research ツールのアプリケーション コード (EDM サンプル アプリケーション)
アソシエーション (EDM)
エンティティ型 (EDM)

その他のリソース

EDM 仕様
スキーマおよびマッピング スキーマ (Entity Framework)