w PSEFS@JE w PSEFS w JE w QSPEVDU@JE w VTFS@JE w QSPEVDU w JE w /BNFۺ query UserOrder { user { id name order { id product { id name } } } } w (SBQI2- 3&45ͱ(SBQI2-ͷҧ͍Կ͔ʁ type User { id: ID! name: String! order: Order! } type Order { id: ID! product: Product! } type Product { id: ID! name: String! }
w /PεΩʔϚͰެ։͞ΕͨൣғͰ͔͠ΫΤϦʔͰ͖ͳ͍ w 3&45ͱಉͷεΩʔϚͰ͋ΕɺͰ͖Δ͜ͱಉ͡ w ͭ·Γෳճ"1*Λ࣮ߦ͢Δ͔ɺ2VFSZΛ͛Δ͔ͷҧ͍͔͠ ͳ͍ type User { id: ID! name: String! order: Order! } type Order { id: ID! product: Product! } type Product { id: ID! name: String! } 9
3&45ͳΒෳճ"1*Λ࣮ߦ͢Δ͜ͱͰಉͷ ͜ͱ͕࣮ݱͰ͖Δ query UserOrder { user { id name order { id product { id name } } } } w 3&45"1* w VTFS w JE w OBNFZBNBEB w PSEFS@JE w PSEFS w JE w QSPEVDU@JE w VTFS@JE w QSPEVDU w JE w /BNFۺ VTFS PSEFS QSPEVDU ରԠ
%#ͷ 2VFSZͷ "1*Λ ΈཱͯΔ "1*Λ ΈཱͯΔ VTFS"1*Λ࣮ߦͯ͠ϨεϙϯεͷPSEFS@JEΛऔಘͯ͠ɺ PSEFSPSEFS@JE"1*Λ࣮ߦͯ͠ϨεϙϯεͷQSPEVDU@JEͰ QSPEVDUQSPEVDU@JE"1*Λ࣮ߦ͢Δ query UserOrder { user { id name order { id product { id name } } } } 2VFSZΛ͛Δ JEͷVTFSΛ%#͔ΒҾ͍ͯPSEFS@JEΛऔಘͯ͠ɺ JEPSEFS@JEͷPSEFSΛ%#͔ΒҾ͍ͯQSPEVDU@JEΛऔಘͯ͠ɺ *EQSPEVDU@JEͷQSPEVDUΛ%#͔Βऔಘ͢Δ ཉ͍͠ใΛૉʹهड़
"1*Λ ΈཱͯΔ query UserOrder { user { id name order { id product { id name } } } } Ϣʔεέʔεݻ༗ͷ"1*࣮ෆཁͰɺ ΫϥΠΞϯτ͕ΫΤϦʔΛॻ͘͜ͱͰ ରԠՄೳ (SBQI2-͕ޮతʹ"1*Λ ΈཱͯΔΛ୲ͬͯ͘ΕΔ (SBQI2-ͷ༷ͱϑϨʔϜϫʔΫΛ αʔόͷલ໘ʹڬΉ͜ͱͰޮతʹ ࣮Ͱ͖Δ
w BHFࡀ w JT"EVMUUSVF w VTFS w JE w OBNFUBOBLB w BHFࡀ w JT"EVMUGBMTF w ٯʹ(SBQI2-3&45Ҏ্ʹϏδωεϩδοΫΛόοΫΤϯυʹҕৡ͍͢͠ͷͰ͢ɻ w ྫ͑ɺVTFS͕ਓ͔Ͳ͏͔ఆ͢ΔϩδοΫ͕͋Δͱ͠·͢ɻ w ͜ͷͱ͖͠BHFΛݩʹΫϥΠΞϯταΠυͰϩδοΫΛॻ ͍ͯ͠·͏ͱɺϏδωεϩδοΫ͕࿙Εग़ͯ͠͠·͍·͢ɻ w ΘΓʹVTFSʹJT"EVMUϑΟʔϧυΛՃͯ͠ɺϨεϙϯεΛ ฦ͢ͱ͖ʹఆ݁ՌΛؚΊͯฦ͢ͱ͠·͢ɻ w ͜ΕͰదʹϏδωεϩδοΫόοΫΤϯυʹҠΓ·ͨ͠ w ͔͠͠ϑϩϯτΤϯυͷը໘ʹΑͬͯɺ໊લ͔͠ඞཁͳ͍ Մೳੑ͕͋Γ·͢ɻ w ͦͷ߹ɺJT"EVMUͷܭࢉ༨ܭͳ$16ϦιʔεΛফඅ͢Δ ͜ͱʹͳΓ·͢ɻ w JT"EVMUͷܭࢉ͘Β͍ͳΒޡࠩͰ͕͢ɺ͜ͷϩδοΫͷͨΊʹ ผͷ.JDSPTFSWJDFT֎෦ͷ"1*͔Βऔಘ͢Δ߹ʹɺ໊લ Λදࣔ͢Δͨͼʹॏ͍ॲཧ͕Δ͜ͱʹͳΓ·͢ɻ
} query UserAge { user { id age isAdult } } w ໊લΛදࣔ͢ΔΫΤϦʔ w ྸΛදࣔ͢ΔΫΤϦʔ JT"EVMUϑΟʔϧυΛऔಘ͠ͳ͚Εɺ ॏ͍ॲཧ͕࣮ߦ͞Εͳ͍ JT"EVMU͕ඞཁͳͱ͖͚ͩऔಘ͢Δ type User { id: ID! name: String! age: Int! isAdult: Boolean! } w (SBQI2-εΩʔϚ ύϑΥʔϚϯεͷӨڹ͕ग़ͳ͍ͨΊ 6TFSʹJT"EVMUϑΟʔϧυΛՃ͢Δ͜ ͱ͕༰қʹͳΔ ·ͨJT"EVMUઐ༻ͷϋϯυϥ͕ੜͰ͖ ΔͨΊɺطଘͷ6TFSΛҾ࣮͘ͷ Өڹͳ͍
2VFSZͷ "1*Λ ΈཱͯΔ query UserOrder { user { id name order { id product { id name } } } } 2VFSZΛ͛Δ ϏδωεϩδοΫ ͦͯ͠(SBQI2-ʹΑΓόοΫΤϯυ͕ ϩδοΫΛ͍࣋ͪ͢Έʹ ͳ͍ͬͯΔ