diff --git a/labs/02-data-flow_messages/lib/xchart-3.5.2.jar b/labs/02-data-flow_messages/lib/xchart-3.5.2.jar new file mode 100644 index 000000000..19b30f7d8 Binary files /dev/null and b/labs/02-data-flow_messages/lib/xchart-3.5.2.jar differ diff --git a/labs/02-data-flow_messages/notebooks/data-flow/s02catalog/components-01-catalog.ipynb b/labs/02-data-flow_messages/notebooks/data-flow/s02catalog/components-01-catalog.ipynb index f51a0eb24..19cbcdc44 100644 --- a/labs/02-data-flow_messages/notebooks/data-flow/s02catalog/components-01-catalog.ipynb +++ b/labs/02-data-flow_messages/notebooks/data-flow/s02catalog/components-01-catalog.ipynb @@ -126,7 +126,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "88c7d869-c27c-4f49-a548-62f5256eca52", + "model_id": "1553b31d-3362-4da7-bb86-791b7de45195", "version_major": 2, "version_minor": 0 }, @@ -398,7 +398,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "5f7ca27a-3889-43fa-89a5-20c42735ef63", + "model_id": "ee23ed2d-8bb6-44f9-bcb5-5c53fefe7ca4", "version_major": 2, "version_minor": 0 }, @@ -409,7 +409,7 @@ } ], "source": [ - "%classpath add jar ../../../../src/lib/xchart-3.5.2.jar" + "%classpath add jar ../../../lib/xchart-3.5.2.jar" ] }, { @@ -424,7 +424,7 @@ { "data": { "text/plain": [ - "com.twosigma.beaker.javash.bkr6d4c32e1.ChartBubbleComponent" + "com.twosigma.beaker.javash.bkrba9cd7a8.ChartBubbleComponent" ] }, "execution_count": 7, diff --git a/labs/02-data-flow_messages/notebooks/data-flow/s02catalog/components-02-whitebox.ipynb b/labs/02-data-flow_messages/notebooks/data-flow/s02catalog/components-02-whitebox.ipynb index de4784564..71e134430 100644 --- a/labs/02-data-flow_messages/notebooks/data-flow/s02catalog/components-02-whitebox.ipynb +++ b/labs/02-data-flow_messages/notebooks/data-flow/s02catalog/components-02-whitebox.ipynb @@ -4,9 +4,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Filtros em Componentes\n", + "# Visão Interna dos Componentes (WhiteBox)\n", "\n", - "Reveja abaixo alguns componentes do notebook anterior:" + "A seguir é apresentada a implementação de cada um dos componentes do notebook anterior." ] }, { @@ -18,9 +18,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.ITableProducer" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public interface ITableProducer {\n", " String[] requestAttributes();\n", @@ -30,9 +41,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.IDataSetProperties" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public interface IDataSetProperties {\n", " public String getDataSource();\n", @@ -42,9 +64,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.IDataSet" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public interface IDataSet extends IDataSetProperties, ITableProducer {\n", "}" @@ -52,9 +85,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.DataSetComponent" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import java.io.BufferedReader;\n", "import java.io.FileReader;\n", @@ -126,9 +170,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.ITableReceptacle" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public interface ITableReceptacle {\n", " public void connect(ITableProducer producer);\n", @@ -137,9 +192,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.IConsoleUpdate" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public interface IConsoleUpdate {\n", " public void update();\n", @@ -148,9 +214,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.IConsole" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public interface IConsole extends ITableReceptacle, IConsoleUpdate {\n", "}" @@ -158,9 +235,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.ConsoleComponent" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public class ConsoleComponent implements IConsole {\n", " private ITableProducer iProducer;\n", @@ -194,14 +282,89 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Projeção" + "# Revendo a Composição de Dois Componentes\n", + "\n", + "A seguir retomamos o exemplo do notebook anterior em que o DataSet é conectado ao Console." ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "=== Attributes ===\n", + "name, age, paralysis, yellow_tong, member_loss, chest_pain, trembling_finger, severe_anger, history_bacteria, diagnostic, days_recovery, has_disease\n", + "\n", + "=== Instances ===\n", + "Rot Donnadd, 43, t, t, f, f, f, f, f, bacterial_infection, 9, t\n", + "Pid Mught, 38, f, t, f, f, f, f, f, bacterial_infection, 7, t\n", + "Thulk Lebbimp, 63, f, t, f, f, t, f, t, bite_deficit, 10, t\n", + "Bouvossam Damme, 71, f, t, t, f, t, f, f, bite_deficit, 13, t\n", + "Pirg Zall, 48, f, f, t, t, f, f, f, viral_infection, 4, t\n", + "Nullon Rackindock, 23, f, f, t, f, f, t, f, fights, 8, f\n", + "Shor Splitturch, 35, f, f, f, f, f, t, f, nothing, 0, f\n", + "Ger Ackeng, 66, f, f, f, f, t, f, f, bite_deficit, 11, t\n", + "Gleldo Shruck, 45, f, t, f, t, f, f, f, bacterial_infection, 8, t\n", + "Nadross Pilch, 60, f, f, f, t, f, f, f, viral_infection, 8, t\n", + "Sadrent Pemmir, 73, f, t, t, f, f, f, t, bite_deficit, 14, t\n", + "Read Rait, 55, t, t, f, f, f, f, f, bacterial_infection, 9, t\n", + "Dallun Whadder, 15, f, f, f, t, f, f, t, viral_infection, 2, t\n", + "Eapplar Thorg, 25, f, f, t, f, f, f, f, fights, 5, f\n", + "Blottork Patter, 68, f, t, f, f, t, f, t, bite_deficit, 12, t\n", + "Darrutt Bottall, 75, f, t, t, f, t, f, f, bite_deficit, 16, t\n", + "Gallir Shauch, 20, f, f, f, t, f, f, f, fights, 12, f\n", + "Dirpe Polnay, 39, f, t, f, f, f, f, f, bacterial_infection, 7, t\n", + "Harrimp Fottiem, 65, f, f, f, f, t, f, f, bite_deficit, 9, t\n" + ] + }, + { + "data": { + "text/plain": [ + "null" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "IDataSet dataset = new DataSetComponent();\n", + "dataset.setDataSource(\"../../../db/zombie/zombie-health-spreadsheet.csv\");\n", + "\n", + "IConsole console = new ConsoleComponent();\n", + "console.connect(dataset);\n", + "\n", + "console.update();" + ] + }, + { + "cell_type": "markdown", "metadata": {}, - "outputs": [], + "source": [ + "# Projeção" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.IProjectionProperties" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public interface IProjectionProperties {\n", " String[] getAttributes();\n", @@ -211,9 +374,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.IProjection" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public interface IProjection extends IProjectionProperties, ITableProducer, ITableReceptacle {\n", "}" @@ -221,9 +395,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.ProjectionComponent" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public class ProjectionComponent implements IProjection {\n", " private ITableProducer provider;\n", @@ -283,22 +468,6 @@ "}" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exercício\n", - "\n", - "Conecte o componente `DataSet` aos componentes de projeção e console para mostrar na tela as seguintes colunas: `name` e `age`." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "metadata": {}, @@ -308,9 +477,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.ISelectionProperties" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public interface ISelectionProperties {\n", " String getAttribute();\n", @@ -326,9 +506,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.ISelection" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public interface ISelection extends ISelectionProperties, ITableProducer, ITableReceptacle {\n", "}" @@ -336,9 +527,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.SelectionComponent" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import java.util.ArrayList;\n", "\n", @@ -452,38 +654,6 @@ "}" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exercício\n", - "\n", - "Conecte o componente `DataSet` aos componentes de seleção e console para mostrar na tela aquelas instâncias cujo diagnóstico seja `bacterial_infection`." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exercício\n", - "\n", - "Conecte os componentes que você achar necessário para mostrar no console o nome e a idade de zumbis com infecção bacteriana." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "metadata": {}, @@ -493,9 +663,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.IChartProperties" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "public interface IChartProperties {\n", " String getTitle();\n", @@ -509,9 +690,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.IRun" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\n", "public interface IRun {\n", @@ -522,9 +714,20 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.IChart" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "\n", "public interface IChart extends ITableReceptacle, IRun, IChartProperties {\n", @@ -534,18 +737,42 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "3b1e48f0-c16d-4f5c-ba16-a2ba99784e73", + "version_major": 2, + "version_minor": 0 + }, + "method": "display_data" + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "%classpath add jar ../../../../src/lib/xchart-3.5.2.jar" + "%classpath add jar ../../../lib/xchart-3.5.2.jar" ] }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "com.twosigma.beaker.javash.bkre3c6118d.ChartBubbleComponent" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import java.util.ArrayList;\n", "import java.util.Hashtable;\n", @@ -696,58 +923,6 @@ " \n", "}" ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exercício\n", - "\n", - "Usando os componentes crie um gráfico conforme o exemplo a seguir:\n", - "\n", - "![Graph](example1.png)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exercício\n", - "\n", - "Usando os componentes crie um gráfico conforme o exemplo a seguir:\n", - "\n", - "![Graph](example2.png)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Exercício\n", - "\n", - "Construa o mesmo gráfico do exercício anterior mostrando apenas aqueles zumbis que têm bacterial infection." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -762,7 +937,20 @@ "mimetype": "", "name": "Java", "nbconverter_exporter": "", - "version": "1.8.0_212" + "version": "11.0.8" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": false, + "sideBar": false, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": false, + "toc_window_display": false } }, "nbformat": 4,