0

これは、コアデータデータベースのデータモデルです。コアデータを使用して2つのエンティティを1つに結合する

これで、すべてのICD9オブジェクト(病気と手技の両方)を取得する必要があります。 2つのエンティティを検索するフェッチをセットアップできません。したがって、2つの別々のものではなく、1つのICD9オブジェクトにこれらをマージできますか?

enter image description here

エラーメッセージ:

Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x12ed7300 {metadata=<CFBasicHash 0x12ed5d20 [0x2f6eb38]>{type = immutable dict, count = 7, 
entries => 
    2 : <CFString 0x12ed45b0 [0x2f6eb38]>{contents = "NSStoreModelVersionIdentifiers"} = <CFArray 0x12ed4d80 [0x2f6eb38]>{type = immutable, count = 1, values = (
    0 : <CFString 0x2f69cd8 [0x2f6eb38]>{contents = ""} 
)} 
    4 : <CFString 0x12ed4740 [0x2f6eb38]>{contents = "NSPersistenceFrameworkVersion"} = <CFNumber 0x12ed4da0 [0x2f6eb38]>{value = +320, type = kCFNumberSInt64Type} 
    6 : <CFString 0x12ed48d0 [0x2f6eb38]>{contents = "NSStoreModelVersionHashes"} = <CFBasicHash 0x12ed53c0 [0x2f6eb38]>{type = immutable dict, count = 5, 
entries => 
    0 : <CFString 0x12ed4c10 [0x2f6eb38]>{contents = "CPT"} = <CFData 0x12f7ce50 [0x2f6eb38]>{length = 32, capacity = 32, bytes = 0xbadc4637a7c1885cd19a176755d1fecf ... 29f23ba15836dff2} 
    1 : <CFString 0x12ed4f10 [0x2f6eb38]>{contents = "ICD9Disease"} = <CFData 0x12f7cea0 [0x2f6eb38]>{length = 32, capacity = 32, bytes = 0x7cf87b9141b2c154fda8fa973b11aba4 ... 471f47adf2a60a63} 
    2 : <CFString 0x12ed50a0 [0x2f6eb38]>{contents = "ICD9Procedure"} = <CFData 0x12f7d040 [0x2f6eb38]>{length = 32, capacity = 32, bytes = 0x05909fa15f0da3d0d9a4329e31da816a ... fe44e8c0de14354b} 
    3 : <CFString 0x12ed5230 [0x2f6eb38]>{contents = "MedicalCode"} = <CFData 0x12f7d090 [0x2f6eb38]>{length = 32, capacity = 32, bytes = 0x7d1d70878edb9c839f9586011ad1726f ... e7a60fcde779e490} 
    6 : <CFString 0x12ed5250 [0x2f6eb38]>{contents = "HCPCS"} = <CFData 0x12f7d0e0 [0x2f6eb38]>{length = 32, capacity = 32, bytes = 0x9d052e1525b4357a1cd9b6c1d6481bbf ... 7ef40429b86137c0} 
} 

    7 : <CFString 0x1a16aa8 [0x2f6eb38]>{contents = "NSStoreUUID"} = <CFString 0x12ed3f70 [0x2f6eb38]>{contents = "EC3CEFE5-2414-431F-ABCE-C67DE6471874"} 
    8 : <CFString 0x1a16948 [0x2f6eb38]>{contents = "NSStoreType"} = <CFString 0x1a16958 [0x2f6eb38]>{contents = "SQLite"} 
    9 : <CFString 0x12ed4a60 [0x2f6eb38]>{contents = "NSStoreModelVersionHashesVersion"} = <CFNumber 0xb8283f0 [0x2f6eb38]>{value = +3, type = kCFNumberSInt32Type} 
    10 : <CFString 0x12ed4bf0 [0x2f6eb38]>{contents = "_NSAutoVacuumLevel"} = <CFString 0x12ed5570 [0x2f6eb38]>{contents = "2"} 
} 
, reason=The model used to open the store is incompatible with the one used to create the store}, { 
    metadata =  { 
     NSPersistenceFrameworkVersion = 320; 
     NSStoreModelVersionHashes =   { 
      CPT = <badc4637 a7c1885c d19a1767 55d1fecf de75bb71 1198e89c 29f23ba1 5836dff2>; 
      HCPCS = <9d052e15 25b4357a 1cd9b6c1 d6481bbf 3ee5bbef 7d67313a 7ef40429 b86137c0>; 
      ICD9Disease = <7cf87b91 41b2c154 fda8fa97 3b11aba4 49984cd5 b8b4694e 471f47ad f2a60a63>; 
      ICD9Procedure = <05909fa1 5f0da3d0 d9a4329e 31da816a 0f76d10e 54122f9c fe44e8c0 de14354b>; 
      MedicalCode = <7d1d7087 8edb9c83 9f958601 1ad1726f 0ced7e49 2a139a20 e7a60fcd e779e490>; 
     }; 
     NSStoreModelVersionHashesVersion = 3; 
     NSStoreModelVersionIdentifiers =   (
      "" 
     ); 
     NSStoreType = SQLite; 
     NSStoreUUID = "EC3CEFE5-2414-431F-ABCE-C67DE6471874"; 
     "_NSAutoVacuumLevel" = 2; 
    }; 
    reason = "The model used to open the store is incompatible with the one used to create the store"; 
} 
+0

こんにちは私はこのデータモデルを認識しています...あなたは 'MedicalCode'に由来する' ICD9'という別の抽象的なエンティティを作成できます。それで 'ICD9Disease'と' ICD9Procedure'は具体的なサブクラスです。共通のプロパティを抽象的な 'ICD9'クラスまで移動するだけです。 –

+0

こんにちはアダム;)。私は上記のモデルの新しい写真を追加しました。それは良い見えますか? – Jon

+0

ええ、それは私が想像していたものです。これで、すべてのICD9エンティティに対するフェッチ要求を実行し、疾患と手順の両方を受け取ることができます。 –

答えて

2

あなたはMedicalCodeから下降ICD9と呼ばれる別の抽象エンティティを作成することができモデルを更新しました

enter image description here

。次にICD9DiseaseICD9Procedureは具体的なサブクラスです。共通のプロパティを抽象的なICD9クラスまで移動するだけです。

すべてのICD9エンティティに対してフェッチ要求を実行し、両方のサブエンティティを戻すことができます。

+0

こんにちはマーク、私は実際に新しい変更でクラッシュします。私は、アプリを削除しようとしたシミュレータをリセットし、ビルをクリーニングするが運がない。問題のエラーメッセージを投稿しました。 – Jon

+0

データモデルの新しいバージョンを作成しなかったためですか?むしろ、新しいクラスのICD9オブジェクトを既存のクラスに追加し、オブジェクトクラスを再生成しましたか? – Jon

+0

クラッシュで質問を更新できますか?あなたは例外を取得していますか? –

0

古いモデルで作成したデータストアを削除してみてください。おそらくあなたのライブラリディレクトリにあなたのためにアプリケーションがあります。プログラムを再度実行すると、エラーなしでストアが再作成されます。

関連する問題