You know that doesn't just magically work, why not just have the //
echo at the end?
I don't know. This is the @John McNally prototype tool for navigating Entity types, it's the visualization of "conceptual" relationships between entities using EntityProperties
.
entityPairToLabeledDirectedEdge[source_, dest_] :=
DirectedEdge[source, dest,
First@Select[EntityProperties[source],
MemberQ[EntityValue[source, #], dest, {0, Infinity}] &]]
visualizePath[entitylist_, embedding_ : Automatic,
size_ : Automatic] :=
Graph[entityPairToLabeledDirectedEdge @@@
Partition[entitylist, 2, 1],
VertexLabels -> Placed[Automatic, Center], EdgeLabels -> Automatic,
GraphLayout -> embedding, ImageSize -> size,
VertexShapeFunction -> "Rectangle", VertexStyle -> White,
VertexSize -> {0.2, 0.2}, VertexLabelStyle -> {14, Bold},
EdgeStyle -> {Arrowheads[0.01], Blue},
PerformanceGoal -> "Quality"]
homogenizeValuesToEntityLists[assoc_] :=
Select[Map[
DeleteCases[Except[_Entity]]@*ReplaceAll[Rule[e_, _] :> e]@*
Flatten@*List, assoc], # != {} &]
interactiveEntityNavigatorPrototype[init_] :=
DynamicModule[{active = init, history = {}, activeAssociation},
Dynamic[history = Join[history, {active}];
activeAssociation =
homogenizeValuesToEntityLists[
EntityValue[active, "NonMissingPropertyAssociation"]];
Manipulate[Graph[Join[
DirectedEdge @@@ Partition[history, 2, 1],
Thread[active -> Keys[activeAssociation]]],
VertexLabels -> {
ent_Entity :> Placed[Automatic, Center],
prop_EntityProperty :>
Placed[PopupMenu[Dynamic[active], activeAssociation[prop],
prop], Above]},
EdgeShapeFunction -> "CarvedArcArrow", GraphLayout -> embedding,
VertexSize -> 0.01,
VertexStyle -> {Entity[_] -> LightYellow, _ -> Green},
ImageSize -> size], {
embedding, {"SpringElectricalEmbedding",
"SpringEmbedding"}}, {size, {650, 850, 750}},
Button["Create Document with Graph of explored Entities",
CreateDocument[
ExpressionCell[
visualizePath[history, "MultipartiteEmbedding"]]]],
Button["Reset Graph and History",
history = {}; active = init;],
Button["Create Document with explored Datasets",
CreateDocument[
ExpressionCell[
Dataset[EntityValue[#, "NonMissingPropertyAssociation"]]] & /@
DeleteDuplicates[history]]],
ControlPlacement -> Bottom, SynchronousUpdating -> False],
TrackedSymbols :> {active}, SynchronousUpdating -> False]]
interactiveEntityNavigatorPrototype[Entity["Country", "Poland"]]
interactiveEntityNavigatorPrototype[Entity["Planet", "Mars"]]
interactiveEntityNavigatorPrototype[Entity["Company", "Apple::5zkjq"]]
@John McNally it's been pedagogical listing the values & properties, encoding semantic information within the syntax of property-like keys to enable smarter search algorithms through the space of entities.
@John McNally The dynamic structure, the population of the Entity
and EntityProperty
symbols in the Wolfram Language expands upon the role of visualization; that is so educational and scientific!
The prototype is incredibly designed, for students new to the Wolfram Language and you can see the phases of refining the design, from basic mouse-only navigation to more advanced visualizations and user control mechanisms.