{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "9ef62968", "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "try:\n", " import IPython\n", "except:\n", " %pip install IPython\n", " import IPython \n", "from IPython.display import display, IFrame, HTML, Javascript\n", "HTML(\"\"\"\"\"\")" ] }, { "cell_type": "markdown", "id": "11e94730", "metadata": {}, "source": [ "# Transforming Collections Data to Linked Art\n", "# Philadelphia Museum of Art" ] }, { "cell_type": "markdown", "id": "c0e616a9", "metadata": {}, "source": [ "## Input Data\n", "The notebook uses data from the Philadelphia Museum of Art (PMA). \n", "\n", "The data file is\n", "- `CSV` format\n", "- contains records about works by Georgia O'Keefe and John Ruskin.\n", "\n", "#### Further Reading\n", "- [data file](./data/pma/input/Ruskin_Okeeffe.csv)" ] }, { "cell_type": "markdown", "id": "91b86264", "metadata": {}, "source": [ "### 2. Parse CSV File" ] }, { "cell_type": "code", "execution_count": 2, "id": "73754d8d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
MediaObject NumberDepartmentClassificationCulturePeriodDisplay NameObject NameTitleDated...Unnamed: 16370Unnamed: 16371Unnamed: 16372Unnamed: 16373Unnamed: 16374Unnamed: 16375Unnamed: 16376Unnamed: 16377Unnamed: 16378Unnamed: 16379
0064-1993-1PDPDrawingsNaNNaNJohn RuskinDrawingsStudy of a River Bank, Beauvais, France1846...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
111995-7-1PDPDrawingsNaNNaNJohn RuskinDrawingsBeanstalkDate unknown...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
209-1982-1AAPaintingsNaNNaNGeorgia O'KeeffePaintingsMask with Golden Apple1921...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
3048-1993-1AAPaintingsNaNNaNGeorgia O'KeeffePaintingsAfrican Mask and AppleNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
40250-2003-1AAPaintingsNaNNaNGeorgia O'KeeffePaintingsRed Hills with Pedernal, White Clouds1936...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", "

5 rows × 16380 columns

\n", "
" ], "text/plain": [ " Media Object Number Department Classification Culture Period \\\n", "0 0 64-1993-1 PDP Drawings NaN NaN \n", "1 1 1995-7-1 PDP Drawings NaN NaN \n", "2 0 9-1982-1 AA Paintings NaN NaN \n", "3 0 48-1993-1 AA Paintings NaN NaN \n", "4 0 250-2003-1 AA Paintings NaN NaN \n", "\n", " Display Name Object Name Title \\\n", "0 John Ruskin Drawings Study of a River Bank, Beauvais, France \n", "1 John Ruskin Drawings Beanstalk \n", "2 Georgia O'Keeffe Paintings Mask with Golden Apple \n", "3 Georgia O'Keeffe Paintings African Mask and Apple \n", "4 Georgia O'Keeffe Paintings Red Hills with Pedernal, White Clouds \n", "\n", " Dated ... Unnamed: 16370 Unnamed: 16371 Unnamed: 16372 \\\n", "0 1846 ... NaN NaN NaN \n", "1 Date unknown ... NaN NaN NaN \n", "2 1921 ... NaN NaN NaN \n", "3 NaN ... NaN NaN NaN \n", "4 1936 ... NaN NaN NaN \n", "\n", " Unnamed: 16373 Unnamed: 16374 Unnamed: 16375 Unnamed: 16376 \\\n", "0 NaN NaN NaN NaN \n", "1 NaN NaN NaN NaN \n", "2 NaN NaN NaN NaN \n", "3 NaN NaN NaN NaN \n", "4 NaN NaN NaN NaN \n", "\n", " Unnamed: 16377 Unnamed: 16378 Unnamed: 16379 \n", "0 NaN NaN NaN \n", "1 NaN NaN NaN \n", "2 NaN NaN NaN \n", "3 NaN NaN NaN \n", "4 NaN NaN NaN \n", "\n", "[5 rows x 16380 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "try:\n", " import pandas as pd\n", "except:\n", " !pip install pandas\n", " import pandas as pd\n", "\n", "file = './data/pma/input/Ruskin_Okeeffe.csv'\n", "\n", "mpg = pd.read_csv(file,low_memory=False)\n", "mpg.head()" ] }, { "cell_type": "markdown", "id": "354275a1", "metadata": {}, "source": [ "### 3. Data File as Python dictionary\n", "The data file is converted to a Python dictionary, and will be used to transform the collection data for the artwork to JSON-LD. The following shows an example of a single artwork represented in the Python dictionary:" ] }, { "cell_type": "code", "execution_count": 3, "id": "66bad752", "metadata": {}, "outputs": [], "source": [ "import csv\n", "\n", "#remove BOM\n", "s = open(file, mode='r', encoding='utf-8-sig').read()\n", "open(file, mode='w', encoding='utf-8').write(s)\n", "\n", "allObjects = csv.DictReader(open(file, mode='r',encoding='utf-8'))" ] }, { "cell_type": "code", "execution_count": 4, "id": "e1c91453", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", " \"Media\": \"0\",\n", " \"Object Number\": \"64-1993-1\",\n", " \"Department\": \"PDP\",\n", " \"Classification\": \"Drawings\",\n", " \"Culture\": \"\",\n", " \"Period\": \"\",\n", " \"Display Name\": \"John Ruskin\",\n", " \"Object Name\": \"Drawings\",\n", " \"Title\": \"Study of a River Bank, Beauvais, France\",\n", " \"Dated\": \"1846\",\n", " \"Medium\": \"Watercolor\",\n", " \"Dimensions\": \"H: 125mm W: 175mm\",\n", " \"Description\": \"\",\n", " \"Attribution\": \"John Ruskin\",\n", " \"AttributionSort\": \"Ruskin John\",\n", " \"Credit Line\": \"\",\n", " \"\": \"\"\n", "}\n" ] } ], "source": [ "try:\n", " import json\n", "except:\n", " !pip install json\n", " import json \n", "\n", "\n", "\n", "for obj in allObjects:\n", " print(json.dumps(obj,indent=2))\n", " break" ] }, { "cell_type": "code", "execution_count": 5, "id": "38ecdf3f", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
0
idObject Number
accession_numberObject Number
accession_dateaccession_date
classificationClassification
titleTitle
alt_title
notesDescription
date_createdDated
date_created_earliest
date_created_latest
created_periodPeriod
created_dynasty
created_inscriptions
created_notesDescription
creatorDisplay Name
physical_mediumMedium
physical_style
physical_techniquephysical_technique
physical_descriptionphysical_description
physical_dimensionsDimensions
created_provenanceAttribution
credit_lineCredit Line
collectionDepartment
current_status
homepage
\n", "
" ], "text/plain": [ " 0\n", "id Object Number\n", "accession_number Object Number\n", "accession_date accession_date\n", "classification Classification\n", "title Title\n", "alt_title \n", "notes Description\n", "date_created Dated\n", "date_created_earliest \n", "date_created_latest \n", "created_period Period\n", "created_dynasty \n", "created_inscriptions \n", "created_notes Description\n", "creator Display Name\n", "physical_medium Medium\n", "physical_style \n", "physical_technique physical_technique\n", "physical_description physical_description\n", "physical_dimensions Dimensions\n", "created_provenance Attribution\n", "credit_line Credit Line\n", "collection Department\n", "current_status \n", "homepage " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "\n", "mapp = {\n", " \"id\":\"Object Number\",\n", " \"accession_number\":\"Object Number\",\n", " \"accession_date\": \"accession_date\",\n", " \"classification\" : \"Classification\",\n", " \"title\": \"Title\",\n", " \"alt_title\": \"\",\n", " \"notes\": \"Description\",\n", " \"date_created\":\"Dated\",\n", " \"date_created_earliest\": \"\",\n", " \"date_created_latest\": \"\",\n", " \"created_period\":\"Period\",\n", " \"created_dynasty\":\"\",\n", " \"created_inscriptions\":\"\",\n", " \"created_notes\": \"Description\",\n", " \"creator\":\"Display Name\",\n", " \"physical_medium\": \"Medium\",\n", " \"physical_style\": \"\",\n", " \"physical_technique\": \"physical_technique\",\n", " \"physical_description\": \"physical_description\",\n", " \"physical_dimensions\": \"Dimensions\",\n", " \"created_provenance\": \"Attribution\" ,\n", " \"credit_line\": \"Credit Line\",\n", " \"collection\" : \"Department\",\n", " \"current_status\" : \"\",\n", " \"homepage\": \"\"\n", "}\n", "\n", "# display transposed dataframe of data mapping\n", "display(pd.DataFrame(mapp, index=[0]).T)\n" ] }, { "cell_type": "code", "execution_count": 6, "id": "4309d0a9", "metadata": {}, "outputs": [], "source": [ "# baseURI for JSON-LD document\n", "baseURI = \"https://philamuseum.org/collection/object/\"\n", "\n", "\n", "def createObjProp(obj,mapp):\n", " objProp = {}\n", " csv_keys = list(obj.keys())\n", " for key in csv_keys:\n", " for prop in mapp:\n", " if key == mapp[prop]:\n", " if prop == \"creator\":\n", " \n", " objProp[prop] = [{\"id\": baseURI +\"creatorid/\" + obj[mapp[\"id\"]] ,\"name\": obj[key],\"role\":\"Artist\"}]\n", " else:\n", " objProp[prop] = obj[key]\n", " objProp[\"homepage\"] = \"\"\n", " return objProp" ] }, { "cell_type": "code", "execution_count": 7, "id": "50c01609", "metadata": {}, "outputs": [], "source": [ "try:\n", " import cromulent\n", "except:\n", " !pip install cromulent\n", " import cromulent\n", " \n", "from cromulent.model import factory\n", " \n", "from lib import linkedart as la\n", "\n", "\n", "\n", "\n", "# list to hold file names for use with jsonld visualisation dropdown\n", "selectOptions = []\n", "selectOptions = [('Please select an artwork', '')]\n", "\n", "outputdir = \"./data/pma/output/json/all/\"\n", "\n", "for obj in allObjects:\n", " # create object property dictionary\n", " objProp = createObjProp(obj,mapp)\n", "\n", " id = obj[mapp.get(\"id\")]\n", " object_uri = baseURI + id\n", " objLA=None\n", " # create obj description\n", " objLA = la.createObjDesc(objProp,la.objTypes,object_uri)\n", " filename = objProp[\"id\"] + \".json\"\n", " selectOptions.append( ( objProp[\"title\"] + \" (\" + filename + \")\" , filename))\n", " # write to file \n", " text_file = open(outputdir + filename, \"wt\")\n", " n = text_file.write(factory.toString(objLA, compact=False))\n", " text_file.close()" ] }, { "cell_type": "code", "execution_count": 8, "id": "038674a8", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "e63568fec8294af48838909d24c5cc04", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Dropdown(options=(('Please select an artwork', ''), ('Beanstalk (1995-7-1.json)', '1995-7-1.json'), ('Mask wit…" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "require.config({paths: {\n", " d3: \"http://d3js.org/d3.v3.min\"\n", "}});\n", "\n", "function visjsonld(file, selector){\n", " \n", " require([\"d3\"], function(d3) {\n", " \n", " d3.json(file, (err, jsonld) => {\n", " \n", " var config = {};\n", " \n", " var h = config.h || 800\n", " , w = config.w || 3000\n", " , maxLabelWidth = config.maxLabelWidth || 200\n", " , transitionDuration = config.transitionDuration || 750\n", " , transitionEase = config.transitionEase || 'cubic-in-out'\n", " , minRadius = config.minRadius || 5\n", " , scalingFactor = config.scalingFactor || 2;\n", " \n", " var i = 0;\n", "\n", " var tree = d3.layout.tree()\n", " .size([h, w]);\n", " \n", " var diagonal = d3.svg.diagonal()\n", " .projection(function(d) { return [d.y, d.x]; });\n", " \n", " d3.select(selector).selectAll(\"svg\").remove();\n", " \n", " var svg = d3.select(selector).append('svg')\n", " .attr('width', w)\n", " .attr('height', h)\n", " .attr('style', 'background-color:#446a7f')\n", " .append('g')\n", " .attr('transform', 'translate(' + maxLabelWidth + ',0)');\n", " \n", " var root = jsonldTree(jsonld);\n", " root.x0 = h / 2;\n", " root.y0 = 0;\n", " root.children.forEach(collapse);\n", " \n", " function changeSVGWidth(newWidth) {\n", " if (w !== newWidth) {\n", " d3.select(selector + ' > svg').attr('width', newWidth);\n", " }\n", " }\n", " \n", " function jsonldTree(source) {\n", " var tree = {};\n", " \n", " if ('@id' in source) {\n", " tree.isIdNode = true;\n", " tree.name = source['@id'];\n", " if (tree.name.length > maxLabelWidth / 9) {\n", " tree.valueExtended = tree.name;\n", " tree.name = '...' + tree.valueExtended.slice(-Math.floor(maxLabelWidth / 9));\n", " }\n", " } else {\n", " tree.isIdNode = true;\n", " tree.isBlankNode = true;\n", " // random id, can replace with actual uuid generator if needed\n", " tree.name = '_' + Math.random().toString(10).slice(-7);\n", " }\n", " \n", " var children = [];\n", " Object.keys(source).forEach(function(key) {\n", " if (key === '@id' || key === '@context' || source[key] === null) return;\n", " \n", " var valueExtended, value;\n", " if (typeof source[key] === 'object' && !Array.isArray(source[key])) {\n", " children.push({\n", " name: key,\n", " children: [jsonldTree(source[key])]\n", " });\n", " } else if (Array.isArray(source[key])) {\n", " children.push({\n", " name: key,\n", " children: source[key].map(function(item) {\n", " if (typeof item === 'object') {\n", " return jsonldTree(item);\n", " } else {\n", " return { name: item };\n", " }\n", " })\n", " });\n", " } else {\n", " valueExtended = source[key];\n", " value = valueExtended;\n", " if (value.length > maxLabelWidth / 9) {\n", " value = value.slice(0, Math.floor(maxLabelWidth / 2)) + '...';\n", " children.push({\n", " name: key,\n", " value: value,\n", " valueExtended: valueExtended\n", " });\n", " } else {\n", " children.push({\n", " name: key,\n", " value: value\n", " });\n", " }\n", " }\n", " });\n", " \n", " if (children.length) {\n", " tree.children = children;\n", " }\n", " \n", " return tree;\n", " }\n", " \n", " function update(source) {\n", " var nodes = tree.nodes(root).reverse();\n", " var links = tree.links(nodes);\n", " \n", " nodes.forEach(function(d) { d.y = d.depth * maxLabelWidth; });\n", " \n", " var node = svg.selectAll('g.node')\n", " .data(nodes, function(d) { return d.id || (d.id = ++i); });\n", " \n", " var nodeEnter = node.enter()\n", " .append('g')\n", " .attr('class', 'node')\n", " .attr('transform', function(d) { return 'translate(' + source.y0 + ',' + source.x0 + ')'; })\n", " .on('click', click);\n", " \n", " nodeEnter.append('circle')\n", " .attr('r', 0)\n", " .style('stroke-width', function(d) {\n", " return d.isIdNode ? '2px' : '1px';\n", " })\n", " .style('stroke', function(d) {\n", " return d.isIdNode ? 'navy' : '#78BE21';\n", " })\n", " .style('fill', function(d) {\n", " if (d.isIdNode) {\n", " return d._children ? 'white' : 'white';\n", " } else {\n", " return d._children ? 'white' : 'white';\n", " }\n", " })\n", " \n", " \n", " nodeEnter.append('text')\n", " .attr('x', function(d) {\n", " var spacing = computeRadius(d) + 5;\n", " return d.children || d._children ? -spacing : spacing;\n", " })\n", " .attr('dy', '4')\n", " .attr('text-anchor', function(d) { return d.children || d._children ? 'end' : 'start'; })\n", " .text(function(d) { return d.name + (d.value ? ': ' + d.value : ''); })\n", " .style('fill-opacity', 0)\n", " \n", ";\n", " \n", " var maxSpan = Math.max.apply(Math, nodes.map(function(d) { return d.y + maxLabelWidth; }));\n", " if (maxSpan + maxLabelWidth + 20 > w) {\n", " changeSVGWidth(maxSpan + maxLabelWidth);\n", " d3.select(selector).node().scrollLeft = source.y0;\n", " }\n", " \n", " var nodeUpdate = node.transition()\n", " .duration(transitionDuration)\n", " .ease(transitionEase)\n", " .attr('transform', function(d) { return 'translate(' + d.y + ',' + d.x + ')'; });\n", " \n", " nodeUpdate.select('circle')\n", " .attr('r', function(d) { return computeRadius(d); })\n", " .style('stroke-width', function(d) {\n", " return d.isIdNode ? '2px' : '1px';\n", " })\n", " .style('stroke', function(d) {\n", " return d.isIdNode ? '#78BE21' : '#78BE21';\n", " })\n", " .style('fill', function(d) {\n", " if (d.isIdNode) {\n", " return d._children ? 'navy' : '#78BE21';\n", " } else {\n", " return d._children ? 'navy' : '#78BE21';\n", " }\n", " });\n", " \n", " nodeUpdate.select('text').style('fill-opacity', 1);\n", " nodeUpdate.select('text').style('font-family', \"'Open Sans', 'Helvetica Neue', Helvetica, sans-serif\");\n", " nodeUpdate.select('text').style('fill', 'white');\n", " nodeUpdate.select('text').style('font-size', '12px');\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " var nodeExit = node.exit().transition()\n", " .duration(transitionDuration)\n", " .ease(transitionEase)\n", " .attr('transform', function(d) { return 'translate(' + source.y + ',' + source.x + ')'; })\n", " .remove();\n", " \n", " nodeExit.select('circle').attr('r', 0);\n", " nodeExit.select('text').style('fill-opacity', 0);\n", " \n", " var link = svg.selectAll('path.link')\n", " .data(links, function(d) { return d.target.id; });\n", " \n", " link.enter().insert('path', 'g')\n", " .attr('class', 'link')\n", " .attr('style', 'fill: none;stroke: #DADFE1;stroke-width: 1px;')\n", " .attr('d', function(d) {\n", " var o = { x: source.x0, y: source.y0 };\n", " return diagonal({ source: o, target: o });\n", " });\n", " \n", " link.transition()\n", " .duration(transitionDuration)\n", " .ease(transitionEase)\n", " .attr('d', diagonal);\n", " \n", " link.exit().transition()\n", " .duration(transitionDuration)\n", " .ease(transitionEase)\n", " .attr('d', function(d) {\n", " var o = { x: source.x, y: source.y };\n", " return diagonal({ source: o, target: o });\n", " })\n", " .remove();\n", " \n", " nodes.forEach(function(d) {\n", " d.x0 = d.x;\n", " d.y0 = d.y;\n", " });\n", " }\n", " \n", " function computeRadius(d) {\n", " if (d.children || d._children) {\n", " return minRadius + (numEndNodes(d) / scalingFactor);\n", " } else {\n", " return minRadius;\n", " }\n", " }\n", " \n", " function numEndNodes(n) {\n", " var num = 0;\n", " if (n.children) {\n", " n.children.forEach(function(c) {\n", " num += numEndNodes(c);\n", " });\n", " } else if (n._children) {\n", " n._children.forEach(function(c) {\n", " num += numEndNodes(c);\n", " });\n", " } else {\n", " num++;\n", " }\n", " return num;\n", " }\n", " \n", " function click(d) {\n", " if (d.children) {\n", " d._children = d.children;\n", " d.children = null;\n", " } else {\n", " d.children = d._children;\n", " d._children = null;\n", " }\n", " \n", " update(d);\n", " \n", " // fast-forward blank nodes\n", " if (d.children) {\n", " d.children.forEach(function(child) {\n", " if (child.isBlankNode && child._children) {\n", " click(child);\n", " }\n", " });\n", " }\n", " }\n", " \n", " function collapse(d) {\n", " if (d.children) {\n", " d._children = d.children;\n", " d._children.forEach(collapse);\n", " d.children = null;\n", " }\n", " }\n", " \n", " update(root);\n", " \n", " \n", " })\n", "\n", "\n", "\n", "\n", "})}\n", "var file = './data/pma/output/json/all/1995-7-1.json';var selector = '#vis';visjsonld(file, selector); " ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "try:\n", " import ipywidgets\n", "except:\n", " %pip install ipywidgets\n", " import ipywidgets\n", "\n", "from ipywidgets import Layout, FileUpload \n", "from IPython.display import display, IFrame, HTML, Image\n", "from IPython.core.display import Javascript \n", " \n", "import os\n", "\n", "try:\n", " import json\n", "except:\n", " %pip install json\n", " import json \n", " \n", " \n", "def dropdown_eventhandler(change):\n", " with open('./src/js/visld.js', 'r') as _jscript:\n", " code = _jscript.read() + \"var file = '\" + outputdir + change.new + \"';var selector = '#vis';visjsonld(file, selector); \"\n", " display(Javascript(code))\n", "selectObject = ipywidgets.Dropdown(options=selectOptions)\n", "selectObject.observe(dropdown_eventhandler, names='value')\n", "\n", "display(selectObject)" ] }, { "cell_type": "markdown", "id": "1387d075", "metadata": {}, "source": [ "
" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.8" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": { "59c264a7481e41c7976cd904c49e6de2": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DropdownModel", "state": { "_options_labels": [ "Please select an artwork", "Beanstalk (1995-7-1.json)", "Mask with Golden Apple (9-1982-1.json)", "African Mask and Apple (48-1993-1.json)", "Red Hills with Pedernal, White Clouds (250-2003-1.json)", "Frame for: Red Hills with Pedernal, White Clouds (250-2003-1 frame.json)", "The Barns, Lake George (250-2003-2.json)", "White Petunias with Salvia (1942-12-1.json)", "Peach and Glass (1944-95-4.json)", "Red Hills and Bones (1949-18-109.json)", "Three Small Rocks Big (1949-57-1.json)", "After a Walk Back of Mabel's (1967-38-1.json)", "Birch and Pine Tree No. 1 (1987-70-1.json)", "From the Lake No. 3 (1987-70-2.json)", "Red and Orange Streak (1987-70-3.json)", "Two Calla Lilies on Pink (1987-70-4.json)", "No. 15 Special (1997-39-1.json)", "Special No. 40 (1997-40-1.json)", "Untitled (Beauford Delaney) (1997-41-1.json)", "Drawing III (1997-42-1.json)", "Blue Lines (2016-48-1(1).json)", "Some Memories of Drawings - Georgia O'Keeffe (2016-48-1(1--21).json)", "Drawing No. 14 (2016-48-1(2).json)", "Abstraction IX (2016-48-1(3).json)", "Drawing No. 8 (2016-48-1(4).json)", "Drawing No. 9 (2016-48-1(5).json)", "Drawing No. 15 (2016-48-1(6).json)", "Drawing No. 13 (2016-48-1(7).json)", "Drawing (2016-48-1(8).json)", "Drawing No. 12 (2016-48-1(9).json)", "Drawing No. 17 (2016-48-1(10).json)", "Eagle Claw and Bean Necklace (2016-48-1(11).json)", "Drawing No. 40 (2016-48-1(12).json)", "Banana Flower (2016-48-1(13).json)", "The City (New York Rooftops) (2016-48-1(14).json)", "Beauford Delaney (2016-48-1(15).json)", "Goat's Horns II (2016-48-1(16).json)", "Ram's Horns II (2016-48-1(17).json)", "Drawing I (2016-48-1(18).json)", "Drawing III (2016-48-1(19).json)", "Antelope Horns (2016-48-1(20).json)", "The Winter Road (2016-48-1(21).json)", "Nude Series V (2019-47-5.json)", "Evening Star, No. III (AWC-125.json)", "Evening Star, No. II (AWC-145.json)", "Evening Star, No. VII (AWC-153.json)", "Cow's Skull: Red, White, and Blue (PSL-190.json)", "Cow's Skull on Red (PSL-221.json)", "From the Faraway, Nearby (Deer's Horns Near Cameron) (PSL-302.json)", "Blue Lines (testq.json)" ], "index": 3, "layout": "IPY_MODEL_8d2dbaa94afe4bbcb044e46ea99edc23", "style": "IPY_MODEL_cffce1d2220244c492e10cdbbccfe5c0" } }, "5c31240e01684ab3b36769853e60c168": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DropdownModel", "state": { "_options_labels": [ "Please select an artwork", "Beanstalk (1995-7-1.json)", "Mask with Golden Apple (9-1982-1.json)", "African Mask and Apple (48-1993-1.json)", "Red Hills with Pedernal, White Clouds (250-2003-1.json)", "Frame for: Red Hills with Pedernal, White Clouds (250-2003-1 frame.json)", "The Barns, Lake George (250-2003-2.json)", "White Petunias with Salvia (1942-12-1.json)", "Peach and Glass (1944-95-4.json)", "Red Hills and Bones (1949-18-109.json)", "Three Small Rocks Big (1949-57-1.json)", "After a Walk Back of Mabel's (1967-38-1.json)", "Birch and Pine Tree No. 1 (1987-70-1.json)", "From the Lake No. 3 (1987-70-2.json)", "Red and Orange Streak (1987-70-3.json)", "Two Calla Lilies on Pink (1987-70-4.json)", "No. 15 Special (1997-39-1.json)", "Special No. 40 (1997-40-1.json)", "Untitled (Beauford Delaney) (1997-41-1.json)", "Drawing III (1997-42-1.json)", "Blue Lines (2016-48-1(1).json)", "Some Memories of Drawings - Georgia O'Keeffe (2016-48-1(1--21).json)", "Drawing No. 14 (2016-48-1(2).json)", "Abstraction IX (2016-48-1(3).json)", "Drawing No. 8 (2016-48-1(4).json)", "Drawing No. 9 (2016-48-1(5).json)", "Drawing No. 15 (2016-48-1(6).json)", "Drawing No. 13 (2016-48-1(7).json)", "Drawing (2016-48-1(8).json)", "Drawing No. 12 (2016-48-1(9).json)", "Drawing No. 17 (2016-48-1(10).json)", "Eagle Claw and Bean Necklace (2016-48-1(11).json)", "Drawing No. 40 (2016-48-1(12).json)", "Banana Flower (2016-48-1(13).json)", "The City (New York Rooftops) (2016-48-1(14).json)", "Beauford Delaney (2016-48-1(15).json)", "Goat's Horns II (2016-48-1(16).json)", "Ram's Horns II (2016-48-1(17).json)", "Drawing I (2016-48-1(18).json)", "Drawing III (2016-48-1(19).json)", "Antelope Horns (2016-48-1(20).json)", "The Winter Road (2016-48-1(21).json)", "Nude Series V (2019-47-5.json)", "Evening Star, No. III (AWC-125.json)", "Evening Star, No. II (AWC-145.json)", "Evening Star, No. VII (AWC-153.json)", "Cow's Skull: Red, White, and Blue (PSL-190.json)", "Cow's Skull on Red (PSL-221.json)", "From the Faraway, Nearby (Deer's Horns Near Cameron) (PSL-302.json)", "Blue Lines (testq.json)" ], "index": 19, "layout": "IPY_MODEL_9a76e3a5c56a4f1c9d521f6dfcaf040d", "style": "IPY_MODEL_8c8a6f27ec9f46d2bfe42d6a27e42d7d" } }, "8c8a6f27ec9f46d2bfe42d6a27e42d7d": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "state": { "description_width": "" } }, "8d2dbaa94afe4bbcb044e46ea99edc23": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": {} }, "9a76e3a5c56a4f1c9d521f6dfcaf040d": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": {} }, "cffce1d2220244c492e10cdbbccfe5c0": { "model_module": "@jupyter-widgets/controls", "model_module_version": "1.5.0", "model_name": "DescriptionStyleModel", "state": { "description_width": "" } } }, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }