AggregatedEntityClass[class,"prop"f]
関数 f を指定の実体クラス全体に適用した結果を値とする特性 prop を持つ,単一の実体を含む実体クラスを表す.
AggregatedEntityClass[class,{"prop1"f1,"prop2"f2,…}]
fiを class に適用して得られた複数の特性 propiを構築する.
AggregatedEntityClass[class,propspec,gprop]
特性 gprop の値に従って class の要素のグループを作り,次にこれら各グループの実体で実体クラスを生成する.
AggregatedEntityClass[class,propspec,"pname"f]
実体関数 f を適用して得られた値に従って,pname という名前の結果の特性を使ってグループを作る.
AggregatedEntityClass[class,propspec,{gspec1,gspec2,…}]
gspeciによって定義された値の集合が重ならないグループを作る.
AggregatedEntityClass
AggregatedEntityClass[class,"prop"f]
関数 f を指定の実体クラス全体に適用した結果を値とする特性 prop を持つ,単一の実体を含む実体クラスを表す.
AggregatedEntityClass[class,{"prop1"f1,"prop2"f2,…}]
fiを class に適用して得られた複数の特性 propiを構築する.
AggregatedEntityClass[class,propspec,gprop]
特性 gprop の値に従って class の要素のグループを作り,次にこれら各グループの実体で実体クラスを生成する.
AggregatedEntityClass[class,propspec,"pname"f]
実体関数 f を適用して得られた値に従って,pname という名前の結果の特性を使ってグループを作る.
AggregatedEntityClass[class,propspec,{gspec1,gspec2,…}]
gspeciによって定義された値の集合が重ならないグループを作る.
詳細
- AggregatedEntityClass[class,"prop"f]の関数 f は,EntityFunction[…]オブジェクトあるいはEntityFunction[x,fun[x["prop"]]]として扱われる関数 fun でよい.
- AggregatedEntityClass[class,propspec]の propspec 内のEntityFunctionオブジェクトは,事実上,値が class 内の実体についての値のリストである特性の連想に適用される.
- AggregatedEntityClassの第2引数に現れるEntityFunction式は,第3引数が存在しない場合は第1引数の単一の実体ではなく第1引数全体に,あるいは第3引数によるグループ化によって得られた実体クラスに適用される.
- AggregatedEntityClassの第3引数に現れるEntityFunction式は,第1引数の各実体に別々に適用される.
- GroupByとは異なり,AggregatedEntityClass[class,propspec,{prop1,prop2,…}]は,その第3引数がリストの場合は階層的グループ化は行わず,EntityValue[class,{prop1,prop2,…}]の固有な値で与えられた数多くの実体でクラスを作る.
- EntityProperties[AggregatedEntityClass[class,{"name1"->entityfunc1,"name2"->entityfunc2,…},{"prop1","prop2",…}]]は{EntityProperty[agg,"name1"],EntityProperty[agg,"name2"],…,EntityProperty[agg,"prop1"],EntityProperty[agg,"prop2"],…}を返す.ただし,agg は AggregatedEntityClass式全体である.
例題
すべて開く すべて閉じる例 (3)
AggregatedEntityClass["Country", "TotalArea" -> EntityFunction[e, Total[e["Area"]]]]["TotalArea"]Total[EntityValue["Country", "Area"]]AggregatedEntityClass["Element", "AtomicMass" -> Mean, "Period"]["AtomicMass"]リレーショナルデータベースがバックエンドの実体と一緒に使われた場合,引数が2つのAggregatedEntityClassは,SELECT文で集約関数を使うことに相当する:
EntityRegister[EntityStore[RelationalDatabase[FindFile["ExampleData/ecommerce-database.sqlite"]]]]AggregatedEntityClass["payments", "amount" -> Total]["amount"]国ごとの最大クレジット限度額を計算する(SQL言語のGROUP BY文に似ている):
AggregatedEntityClass["customers", "creditLimit" -> Max, "country"][{"country", "creditLimit"}]スコープ (4)
第3引数はEntityFunctionでよい:
AggregatedEntityClass["Country", "MeanArea" -> EntityFunction[e, Mean[e["Area"]]], "RoundedPopulation" -> EntityFunction[c, Round[c["Population"], 100000000]]][{"RoundedPopulation", "MeanArea"}]AggregatedEntityClass[["G7"], "AggregatedPopulation" -> EntityFunction[e, f[e[EntityProperty["Country", "Population"]]]]]["AggregatedPopulation"]AggregatedEntityClass[["G7"], "MeanPopulation" -> EntityFunction[e, Mean[e[EntityProperty["Country", "Population"]]]]]["MeanPopulation"]//NAggregatedEntityClass[["G7"], "PopulationChart" -> EntityFunction[e, PieChart[e[EntityProperty["Country", "Population"]]]]]["PopulationChart"]AggregatedEntityClass[EntityClass["Country", "Europe"], {"Area" -> Total, "Population" -> Total}][{"Population", "Area"}]多面体をキラルか凹面かどうかでグループ化し,各グループの長さを計算する:
AggregatedEntityClass["Polyhedron", "Count" -> EntityFunction[e, Length[e]], {"Chiral", "Concave"}]["Count", "EntityAssociation"]特性と関係 (2)
AggregatedEntityClassは,群に対応する実体を生成する:
EntityList[AggregatedEntityClass["Element", "AtomicNumber" -> Mean, "Period"]]AggregatedEntityClassから得られた単一の実体は,事実上,陰的実体に対応する:
Entity["Food",
{
EntityProperty["Food", "FoodType"] -> ContainsExactly[{Entity["FoodType", "IceCream"]}], EntityProperty["Food", "AddedFoodTypes"] -> ContainsExactly[{}], EntityProperty["Food", "Flavor"] -> Entity["FoodFlavor", "Chocolate"]
}
]["RelativeTotalCaloriesContent"]AggregatedEntityClass[EntityClass["Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{Entity["FoodType", "IceCream"]}], EntityProperty["Food", "AddedFoodTypes"] -> ContainsExactly[{}], EntityProperty["Food", "Flavor"] -> Entity["FoodFlavor", "Chocolate"]}], "RelativeTotalCaloriesContent" -> Median @* DeleteMissing]["RelativeTotalCaloriesContent"]おもしろい例題 (1)
多面体を頂点数と凸状かどうかでグループ化し,「コラージュ」特性を指定する:
polys = AggregatedEntityClass["Polyhedron", "collage" -> EntityFunction[e, ImageCollage[e["Image"]]], {"VertexCount", "Convex"}];グループを頂点数でソートし,コラージュをTabularで表示する:
SortedEntityClass[polys, "VertexCount"][{"collage"}, "Tabular"]テクニカルノート
関連するガイド
テキスト
Wolfram Research (2019), AggregatedEntityClass, Wolfram言語関数, https://reference.wolfram.com/language/ref/AggregatedEntityClass.html.
CMS
Wolfram Language. 2019. "AggregatedEntityClass." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AggregatedEntityClass.html.
APA
Wolfram Language. (2019). AggregatedEntityClass. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AggregatedEntityClass.html
BibTeX
@misc{reference.wolfram_2026_aggregatedentityclass, author="Wolfram Research", title="{AggregatedEntityClass}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/AggregatedEntityClass.html}", note=[Accessed: 17-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_aggregatedentityclass, organization={Wolfram Research}, title={AggregatedEntityClass}, year={2019}, url={https://reference.wolfram.com/language/ref/AggregatedEntityClass.html}, note=[Accessed: 17-August-2026]}