From 22c4c0d7ee4e4089108dc46ec6072933ec0a7058 Mon Sep 17 00:00:00 2001 From: Simon Clark Date: Tue, 30 Jan 2024 23:52:09 +0100 Subject: [PATCH] Update example_linked_data_zinc_powder.ipynb --- sphinx/example_linked_data_zinc_powder.ipynb | 102 ++++++++----------- 1 file changed, 42 insertions(+), 60 deletions(-) diff --git a/sphinx/example_linked_data_zinc_powder.ipynb b/sphinx/example_linked_data_zinc_powder.ipynb index e25154a..5e31a97 100644 --- a/sphinx/example_linked_data_zinc_powder.ipynb +++ b/sphinx/example_linked_data_zinc_powder.ipynb @@ -22,11 +22,11 @@ "Let's describe an instance of some zinc powder with a set of properties defined in the specification sheet from the manufacturer!\n", "\n", "This example covers a few topics:\n", - "- How to describe a resource using ontology terms and JSON-LD\n", - "- How machines convert JSON-LD into triples\n", - "- What is the meaning of the subject, predicate, and object identifiers\n", - "- How to run a simple query using SPARQL **[Moderate]**\n", - "- How to use the ontology to fetch more information from other sources **[Advanced]**\n" + "- How to describe a resource using ontology terms and JSON-LD \n", + "- How machines convert JSON-LD into triples \n", + "- What is the meaning of the subject, predicate, and object identifiers \n", + "- How to run a simple query using SPARQL **[Moderate]** \n", + "- How to use the ontology to fetch more information from other sources **[Advanced]** \n" ], "metadata": { "id": "1wseTQGaB4x9" @@ -70,7 +70,7 @@ "metadata": { "id": "gohQKEBrF2QP" }, - "execution_count": 64, + "execution_count": 90, "outputs": [] }, { @@ -101,7 +101,7 @@ "metadata": { "id": "wk4sFl_eA2ML" }, - "execution_count": 65, + "execution_count": 91, "outputs": [] }, { @@ -142,28 +142,28 @@ "base_uri": "https://localhost:8080/" }, "id": "zWibLw6NIrrq", - "outputId": "95ab00b5-4889-4440-cc39-c231d6c174b4" + "outputId": "8c0d7051-69ff-48bb-afcc-8dcdad81adae" }, - "execution_count": 66, + "execution_count": 92, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ - "(rdflib.term.BNode('N6ce5afc5daa84f3a82b605299713b5ef'), rdflib.term.URIRef('https://schema.org/manufacturer'), rdflib.term.URIRef('https://www.wikidata.org/wiki/Q680841'))\n", - "(rdflib.term.BNode('N6ce5afc5daa84f3a82b605299713b5ef'), rdflib.term.URIRef('https://schema.org/productID'), rdflib.term.Literal('324930'))\n", - "(rdflib.term.BNode('Nfd851a2b90264372a97b083071157fec'), rdflib.term.URIRef('http://purl.org/dc/elements/1.1/source'), rdflib.term.Literal('https://www.sigmaaldrich.com/NO/en/product/aldrich/324930'))\n", - "(rdflib.term.BNode('N6ce5afc5daa84f3a82b605299713b5ef'), rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('https://w3id.org/emmo/domain/chemicalsubstance#substance_9bd78e1c_a4dc_41b6_8013_adb51df1ffdc'))\n", - "(rdflib.term.BNode('Nfd851a2b90264372a97b083071157fec'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_bed1d005_b04e_4a90_94cf_02bc678a8569'), rdflib.term.URIRef('http://emmo.info/emmo#MicroMetre'))\n", - "(rdflib.term.BNode('Nfd851a2b90264372a97b083071157fec'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0'), rdflib.term.BNode('N4f72df06f0e140bc9957b97c8ffb724a'))\n", - "(rdflib.term.BNode('Nfd851a2b90264372a97b083071157fec'), rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_d8aa8e1f_b650_416d_88a0_5118de945456'))\n", - "(rdflib.term.BNode('N6ce5afc5daa84f3a82b605299713b5ef'), rdflib.term.URIRef('https://schema.org/url'), rdflib.term.Literal('https://www.sigmaaldrich.com/NO/en/product/aldrich/324930'))\n", - "(rdflib.term.BNode('N4f72df06f0e140bc9957b97c8ffb724a'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_faf79f53_749d_40b2_807c_d34244c192f4'), rdflib.term.Literal('150', datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#integer')))\n", - "(rdflib.term.BNode('Nfd851a2b90264372a97b083071157fec'), rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('https://w3id.org/emmo/domain/electrochemistry#electrochemistry_02d2d1d1_241c_429b_b4e7_31f2c3dc4835'))\n", + "(rdflib.term.BNode('Nca52d7882ab94ea4bda56ca395067561'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_e1097637_70d2_4895_973f_2396f04fa204'), rdflib.term.BNode('Ndeba6ec90c314da6a72bf2c10d6b1448'))\n", + "(rdflib.term.BNode('Nc7a3704c771441088cd7a1005bc0f1c6'), rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_18d180e4_5e3e_42f7_820c_e08951223486'))\n", + "(rdflib.term.BNode('Ndeba6ec90c314da6a72bf2c10d6b1448'), rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_d8aa8e1f_b650_416d_88a0_5118de945456'))\n", + "(rdflib.term.BNode('Nca52d7882ab94ea4bda56ca395067561'), rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('https://w3id.org/emmo/domain/electrochemistry#electrochemistry_ee479886_6805_4018_95e1_500185e44215'))\n", + "(rdflib.term.BNode('Nca52d7882ab94ea4bda56ca395067561'), rdflib.term.URIRef('https://schema.org/manufacturer'), rdflib.term.URIRef('https://www.wikidata.org/wiki/Q680841'))\n", + "(rdflib.term.BNode('Ndeba6ec90c314da6a72bf2c10d6b1448'), rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('https://w3id.org/emmo/domain/electrochemistry#electrochemistry_02d2d1d1_241c_429b_b4e7_31f2c3dc4835'))\n", + "(rdflib.term.BNode('Ndeba6ec90c314da6a72bf2c10d6b1448'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_bed1d005_b04e_4a90_94cf_02bc678a8569'), rdflib.term.URIRef('http://emmo.info/emmo#MicroMetre'))\n", + "(rdflib.term.BNode('Ndeba6ec90c314da6a72bf2c10d6b1448'), rdflib.term.URIRef('http://purl.org/dc/elements/1.1/source'), rdflib.term.Literal('https://www.sigmaaldrich.com/NO/en/product/aldrich/324930'))\n", + "(rdflib.term.BNode('Nca52d7882ab94ea4bda56ca395067561'), rdflib.term.URIRef('https://schema.org/url'), rdflib.term.Literal('https://www.sigmaaldrich.com/NO/en/product/aldrich/324930'))\n", + "(rdflib.term.BNode('Nc7a3704c771441088cd7a1005bc0f1c6'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_faf79f53_749d_40b2_807c_d34244c192f4'), rdflib.term.Literal('150', datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#integer')))\n", "(rdflib.term.URIRef('https://www.wikidata.org/wiki/Q680841'), rdflib.term.URIRef('https://schema.org/name'), rdflib.term.Literal('Sigma-Aldrich'))\n", - "(rdflib.term.BNode('N6ce5afc5daa84f3a82b605299713b5ef'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_e1097637_70d2_4895_973f_2396f04fa204'), rdflib.term.BNode('Nfd851a2b90264372a97b083071157fec'))\n", - "(rdflib.term.BNode('N6ce5afc5daa84f3a82b605299713b5ef'), rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('https://w3id.org/emmo/domain/electrochemistry#electrochemistry_ee479886_6805_4018_95e1_500185e44215'))\n", - "(rdflib.term.BNode('N4f72df06f0e140bc9957b97c8ffb724a'), rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_18d180e4_5e3e_42f7_820c_e08951223486'))\n" + "(rdflib.term.BNode('Nca52d7882ab94ea4bda56ca395067561'), rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('https://w3id.org/emmo/domain/chemicalsubstance#substance_9bd78e1c_a4dc_41b6_8013_adb51df1ffdc'))\n", + "(rdflib.term.BNode('Ndeba6ec90c314da6a72bf2c10d6b1448'), rdflib.term.URIRef('http://emmo.info/emmo#EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0'), rdflib.term.BNode('Nc7a3704c771441088cd7a1005bc0f1c6'))\n", + "(rdflib.term.BNode('Nca52d7882ab94ea4bda56ca395067561'), rdflib.term.URIRef('https://schema.org/productID'), rdflib.term.Literal('324930'))\n" ] } ] @@ -177,41 +177,23 @@ "\n", "Let's start with this one:\n", "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
subject:https://www.wikidata.org/wiki/Q680841
predicate:https://schema.org/name
object:'Sigma-Aldrich'
\n", - "\n", + "|   |   |\n", + "|-----------|--------------------------------------|\n", + "| subject | https://www.wikidata.org/wiki/Q680841 |\n", + "| predicate | https://schema.org/name |\n", + "| object | ‘Sigma-Aldrich’ |\n", "\n", "This tells the machine that something with a wikidata identifier has a property called 'name' from the schema.org vocabulary with a literal value '**Sigma-Aldrich**'. These identifiers serve not only as persistent and unique identifiers for the concepts, but also point to a place where a machine can go to learn more about what it is. Try it yourself! Click on one and see where it takes you!

\n", "\n", "\n", "Neat, right?! Let's look at another one:\n", "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
subject:'Nb9d4bdc220954548a09b8b56f95d9cf3'
predicate:http://www.w3.org/1999/02/22-rdf-syntax-ns#type
object:https://w3id.org/emmo/domain/chemicalsubstance#substance_9bd78e1c_a4dc_41b6_8013_adb51df1ffdc
\n", + "|   |   |\n", + "|-----------|--------------------------------------|\n", + "| subject | 'Nb9d4bdc220954548a09b8b56f95d9cf3' |\n", + "| predicate | http://www.w3.org/1999/02/22-rdf-syntax-ns#type |\n", + "| object | https://w3id.org/emmo/domain/chemicalsubstance#substance_9bd78e1c_a4dc_41b6_8013_adb51df1ffdc |\n", + "\n", "\n", "\n", "This tells the machine that a certain node in the graph is a a type of some thing that exists in the EMMO domain 'chemicalsubstance'. And this gets to one of the difficult bits for humans: many ontologies (like EMMO) use UUIDs for term names to ensure that they are universally unique. It works, but it sacrifices the human readability. Luckily we can get around this by assigning human-readable annotations to that term and/or mapping the IRI to a human readable label in a JSON-LD context like we did above.\n", @@ -253,9 +235,9 @@ "base_uri": "https://localhost:8080/" }, "id": "6bXHGG4cI-kr", - "outputId": "ca2319fb-607f-4c91-aeb0-8cca8a197ef1" + "outputId": "6a725263-5610-431d-a183-569541175afa" }, - "execution_count": 67, + "execution_count": 93, "outputs": [ { "output_type": "stream", @@ -313,9 +295,9 @@ "base_uri": "https://localhost:8080/" }, "id": "ntT1Rf_yM6sZ", - "outputId": "ecf45003-0232-4e8e-bff9-6bdd43d23c2e" + "outputId": "d3e69a14-ee79-4481-b244-2c3b6d3b0119" }, - "execution_count": 80, + "execution_count": 94, "outputs": [ { "output_type": "stream", @@ -361,9 +343,9 @@ "base_uri": "https://localhost:8080/" }, "id": "zTBOZAf-dWQQ", - "outputId": "56c83b6f-1e8f-4069-dfd1-9d106d8905cb" + "outputId": "9fc659ad-e94d-437b-ff81-c92c6a0c92c2" }, - "execution_count": 81, + "execution_count": 95, "outputs": [ { "output_type": "stream", @@ -412,9 +394,9 @@ "height": 222 }, "id": "T7bkBY0sNqNY", - "outputId": "85772dcb-21ea-4c1c-eb85-39ef3abe235f" + "outputId": "2e9f91a7-254e-4a6f-f7d5-081d51897f57" }, - "execution_count": 82, + "execution_count": 96, "outputs": [ { "output_type": "stream", @@ -443,7 +425,7 @@ "metadata": { "id": "T1qUAeCDVNq3" }, - "execution_count": 70, + "execution_count": 96, "outputs": [] } ]