Skip to content

Instantly share code, notes, and snippets.

@bollwyvl
Last active June 7, 2019 16:33
Show Gist options
  • Save bollwyvl/8a661a3666a6f3793fa72a8bb0955a8a to your computer and use it in GitHub Desktop.
Save bollwyvl/8a661a3666a6f3793fa72a8bb0955a8a to your computer and use it in GitHub Desktop.
name: shacl
channels:
- conda-forge
- defaults
dependencies:
- pyshacl
- pyld
- pandas
- notebook
- python >=3.7,<3.8
- jupyterlab >=0.35,<0.36
- ipywidgets
- nodejs
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# An exploration of Data Shapes \n",
"> ### _ft. [SHACL](https://www.w3.org/TR/shacl/#shacl-example), [JSON-LD](https://www.w3.org/2018/jsonld-cg-reports/json-ld/)_\n",
"\n",
"> > ```bash\n",
"conda install -c conda-forge ipython pyshacl pandas pyld\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pyshacl, json, pandas as pd, IPython\n",
"from pyld import jsonld\n",
"from rdflib import Graph, RDFS, Namespace, OWL"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`Namespace`s provide the basis of shared language about data and shapes."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"__ns__ = {\n",
" \"rdfs\": RDFS,\n",
" \"sh\": Namespace(\"http://www.w3.org/ns/shacl#\"),\n",
" \"ex\": Namespace(\"http://example.com/ns#\"),\n",
" \"owl\": OWL\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A JSON-LD `@context` describes a shape of _input_ or _output_ data."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"__id__ = {\"@type\": \"@id\"}\n",
"__context__ = {\n",
" \"@version\": 1.1,\n",
" **{k: str(v) for k, v in __ns__.items()},\n",
" \"a\": {\"@id\": \"@type\"},\n",
" \"ex:birthDate\": {\"@type\": \"xsd:date\"},\n",
" \"sh:path\": __id__,\n",
" \"sh:nodeKind\": __id__,\n",
" \"sh:property\": __id__,\n",
" \"sh:targetClass\": __id__,\n",
" \"sh:ignoredProperties\": __id__,\n",
" \"sh:class\": __id__,\n",
" \"ex:ssn\": {\"@type\": \"xsd:string\"},\n",
" \"ex:worksFor\": __id__\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Some utility functions for writing about shapes."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"def parse(doc):\n",
" g = Graph()\n",
" [g.bind(k, v) for k, v in __ns__.items()]\n",
" g.parse(\n",
" format=\"json-ld\",\n",
" data=json.dumps(\n",
" jsonld.flatten(doc, \n",
" options=dict(\n",
" expandContext={\"@context\": __context__}\n",
" ))))\n",
" return g"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"the `d`ata `g`raph, as explored in the [SHACL documentation](https://www.w3.org/TR/shacl/#shacl-example)."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"dg = parse({\"@graph\": [\n",
" {\"@id\": \"ex:Alice\",\n",
" \"a\": \"ex:Person\",\n",
" \"ex:ssn\": \"987-65-432A\"\n",
" },\n",
" {\"@id\": \"ex:Bob\",\n",
" \"a\": \"ex:Person\",\n",
" \"ex:ssn\": [\"123-45-6789\"],\n",
" },\n",
" {\"@id\": \"ex:Calvin\",\n",
" \"a\": \"ex:Person\",\n",
" \"ex:birthDate\": \"1971-07-07\",\n",
" \"ex:worksFor\": \"ex:UntypedCompany\"\n",
" }\n",
"]})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"What does it look like in other formats?"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"def pgprint(g, title=None, fmt=\"ttl\", mode=\"turtle\"):\n",
" title = title or f\"{len(g)} triples\"\n",
" return IPython.display.Markdown(\n",
" f\"\"\"## {title}\\n\"\"\"\n",
" f\"\"\"```{mode}\\n{g.serialize(format=fmt).decode(\"utf-8\")}```\"\"\"\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"## the fact graph\n",
"```turtle\n",
"@prefix ex: <http://example.com/ns#> .\n",
"@prefix owl: <http://www.w3.org/2002/07/owl#> .\n",
"@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n",
"@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n",
"@prefix sh: <http://www.w3.org/ns/shacl#> .\n",
"@prefix xml: <http://www.w3.org/XML/1998/namespace> .\n",
"@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n",
"\n",
"ex:Alice a ex:Person ;\n",
" ex:ssn \"987-65-432A\"^^<xsd:string> .\n",
"\n",
"ex:Bob a ex:Person ;\n",
" ex:ssn \"123-45-6789\"^^<xsd:string> .\n",
"\n",
"ex:Calvin a ex:Person ;\n",
" ex:birthDate \"1971-07-07\"^^<xsd:date> ;\n",
" ex:worksFor ex:UntypedCompany .\n",
"\n",
"```"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pgprint(dg, \"the fact graph\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"What do we know about `@types`?"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"def count_types(g, title=None):\n",
" df = pd.DataFrame(g.query(\"\"\"\n",
" select distinct ?type_we_have_instance_of (COUNT(?s) as ?instances_of_type)\n",
" where {?s rdf:type ?type_we_have_instance_of}\n",
" group by ?type_we_have_instance_of\n",
" \"\"\", initNs=__ns__).bindings)\n",
" title = title or f\"{df.shape[0]} by {df.shape[1]}\"\n",
" display(IPython.display.Markdown(f\"## {title}\"))\n",
" display(df)\n",
" return df"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The `s`hape `g`raph."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"## 1 by 2"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>instances_of_type</th>\n",
" <th>type_we_have_instance_of</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>3</td>\n",
" <td>http://example.com/ns#Person</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" instances_of_type type_we_have_instance_of\n",
"0 3 http://example.com/ns#Person"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"count_types(dg);"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"sg = parse({\"@graph\": [{\n",
" \"@id\": \"ex:PersonShape\",\n",
" \"a\": \"sh:NodeShape\",\n",
" \"sh:targetClass\": \"ex:Person\", # Applies to all persons\n",
" \"sh:closed\": True,\n",
" \"sh:ignoredProperties\": \"rdf:type\",\n",
" \"sh:property\": [{ # _:b1\n",
" \"sh:path\": \"ex:ssn\", # constrains the values of ex:ssn\n",
" \"sh:maxCount\": 1,\n",
" \"sh:datatype\": \"xsd:string\",\n",
" \"sh:pattern\": \"^\\\\d{3}-\\\\d{2}-\\\\d{4}$\",\n",
" }, { # _:b2\n",
" \"sh:path\": \"ex:worksFor\",\n",
" \"sh:class\": \"ex:Company\",\n",
" \"sh:nodeKind\": \"sh:IRI\"\n",
" },\n",
" ]}]})"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"## the shape graph\n",
"```turtle\n",
"@prefix ex: <http://example.com/ns#> .\n",
"@prefix owl: <http://www.w3.org/2002/07/owl#> .\n",
"@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n",
"@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n",
"@prefix sh: <http://www.w3.org/ns/shacl#> .\n",
"@prefix xml: <http://www.w3.org/XML/1998/namespace> .\n",
"@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n",
"\n",
"ex:PersonShape a sh:NodeShape ;\n",
" sh:closed true ;\n",
" sh:ignoredProperties <rdf:type> ;\n",
" sh:property [ sh:datatype \"xsd:string\" ;\n",
" sh:maxCount 1 ;\n",
" sh:path ex:ssn ;\n",
" sh:pattern \"^\\\\d{3}-\\\\d{2}-\\\\d{4}$\" ],\n",
" [ sh:class ex:Company ;\n",
" sh:nodeKind sh:IRI ;\n",
" sh:path ex:worksFor ] ;\n",
" sh:targetClass ex:Person .\n",
"\n",
"```"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pgprint(sg, \"the shape graph\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"## 1 by 2"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>instances_of_type</th>\n",
" <th>type_we_have_instance_of</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>http://www.w3.org/ns/shacl#NodeShape</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" instances_of_type type_we_have_instance_of\n",
"0 1 http://www.w3.org/ns/shacl#NodeShape"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"count_types(sg);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Running the [`pyshacl.Validator`](https://github.com/RDFLib/pySHACL) can validate, and conveniently infer new knowledge as described in the shape (and other ontologies)."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"v = pyshacl.Validator(dg, shacl_graph=sg, options={\"inference\": \"both\"})\n",
"conforms, rg, report = v.run()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's look at the report."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>focus</th>\n",
" <th>path</th>\n",
" <th>value</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>http://example.com/ns#Alice</td>\n",
" <td>http://example.com/ns#ssn</td>\n",
" <td>987-65-432A</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>http://example.com/ns#Alice</td>\n",
" <td>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</td>\n",
" <td>http://www.w3.org/2002/07/owl#Thing</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>http://example.com/ns#Alice</td>\n",
" <td>http://www.w3.org/2002/07/owl#sameAs</td>\n",
" <td>http://example.com/ns#Alice</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>http://example.com/ns#Alice</td>\n",
" <td>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</td>\n",
" <td>http://example.com/ns#Person</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>http://example.com/ns#Alice</td>\n",
" <td>http://example.com/ns#ssn</td>\n",
" <td>987-65-432A</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>http://example.com/ns#Bob</td>\n",
" <td>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</td>\n",
" <td>http://www.w3.org/2002/07/owl#Thing</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>http://example.com/ns#Bob</td>\n",
" <td>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</td>\n",
" <td>http://example.com/ns#Person</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>http://example.com/ns#Bob</td>\n",
" <td>http://example.com/ns#ssn</td>\n",
" <td>123-45-6789</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>http://example.com/ns#Bob</td>\n",
" <td>http://example.com/ns#ssn</td>\n",
" <td>123-45-6789</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>http://example.com/ns#Bob</td>\n",
" <td>http://www.w3.org/2002/07/owl#sameAs</td>\n",
" <td>http://example.com/ns#Bob</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>http://example.com/ns#Calvin</td>\n",
" <td>http://www.w3.org/2002/07/owl#sameAs</td>\n",
" <td>http://example.com/ns#Calvin</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>http://example.com/ns#Calvin</td>\n",
" <td>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</td>\n",
" <td>http://www.w3.org/2002/07/owl#Thing</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>http://example.com/ns#Calvin</td>\n",
" <td>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</td>\n",
" <td>http://example.com/ns#Person</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>http://example.com/ns#Calvin</td>\n",
" <td>http://example.com/ns#birthDate</td>\n",
" <td>1971-07-07</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>http://example.com/ns#Calvin</td>\n",
" <td>http://example.com/ns#worksFor</td>\n",
" <td>http://example.com/ns#UntypedCompany</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" focus \\\n",
"0 http://example.com/ns#Alice \n",
"1 http://example.com/ns#Alice \n",
"2 http://example.com/ns#Alice \n",
"3 http://example.com/ns#Alice \n",
"4 http://example.com/ns#Alice \n",
"5 http://example.com/ns#Bob \n",
"6 http://example.com/ns#Bob \n",
"7 http://example.com/ns#Bob \n",
"8 http://example.com/ns#Bob \n",
"9 http://example.com/ns#Bob \n",
"10 http://example.com/ns#Calvin \n",
"11 http://example.com/ns#Calvin \n",
"12 http://example.com/ns#Calvin \n",
"13 http://example.com/ns#Calvin \n",
"14 http://example.com/ns#Calvin \n",
"\n",
" path \\\n",
"0 http://example.com/ns#ssn \n",
"1 http://www.w3.org/1999/02/22-rdf-syntax-ns#type \n",
"2 http://www.w3.org/2002/07/owl#sameAs \n",
"3 http://www.w3.org/1999/02/22-rdf-syntax-ns#type \n",
"4 http://example.com/ns#ssn \n",
"5 http://www.w3.org/1999/02/22-rdf-syntax-ns#type \n",
"6 http://www.w3.org/1999/02/22-rdf-syntax-ns#type \n",
"7 http://example.com/ns#ssn \n",
"8 http://example.com/ns#ssn \n",
"9 http://www.w3.org/2002/07/owl#sameAs \n",
"10 http://www.w3.org/2002/07/owl#sameAs \n",
"11 http://www.w3.org/1999/02/22-rdf-syntax-ns#type \n",
"12 http://www.w3.org/1999/02/22-rdf-syntax-ns#type \n",
"13 http://example.com/ns#birthDate \n",
"14 http://example.com/ns#worksFor \n",
"\n",
" value \n",
"0 987-65-432A \n",
"1 http://www.w3.org/2002/07/owl#Thing \n",
"2 http://example.com/ns#Alice \n",
"3 http://example.com/ns#Person \n",
"4 987-65-432A \n",
"5 http://www.w3.org/2002/07/owl#Thing \n",
"6 http://example.com/ns#Person \n",
"7 123-45-6789 \n",
"8 123-45-6789 \n",
"9 http://example.com/ns#Bob \n",
"10 http://example.com/ns#Calvin \n",
"11 http://www.w3.org/2002/07/owl#Thing \n",
"12 http://example.com/ns#Person \n",
"13 1971-07-07 \n",
"14 http://example.com/ns#UntypedCompany "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"def vrprint(rg):\n",
" df = pd.DataFrame(rg.query(\"\"\"\n",
" select ?focus ?path ?value\n",
" where {\n",
" ?vr rdf:type sh:ValidationResult .\n",
" ?vr sh:focusNode ?focus .\n",
" ?vr sh:resultPath ?path .\n",
" ?vr sh:value ?value\n",
" }\n",
" order by ?focus\n",
" \"\"\", initNs=__ns__).bindings)\n",
" display(df)\n",
" return df\n",
"vrprint(rg);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Again, from the [SHACL documentation](https://www.w3.org/TR/shacl/#shacl-example):\n",
"\n",
"<blockquote><em>\n",
"<p>\n",
" The <a href=\"#dfn-validation-results\" class=\"internalDFN\" data-link-type=\"dfn\">validation results</a> are enclosed in a <a href=\"#dfn-validation-report\" class=\"internalDFN\" data-link-type=\"dfn\">validation report</a>. The first <a href=\"#dfn-validation-results\" class=\"internalDFN\" data-link-type=\"dfn\">validation result</a> is produced because <code>ex:Alice</code> has a <a href=\"#dfn-value\" class=\"internalDFN\" data-link-type=\"dfn\">value</a> for <code>ex:ssn</code> that does not match the regular\n",
" expression specified by the property <code>sh:regex</code>. The second <a href=\"#dfn-validation-results\" class=\"internalDFN\" data-link-type=\"dfn\">validation result</a> is produced because <code>ex:Bob</code> has more than the permitted\n",
" number of <a href=\"#dfn-value\" class=\"internalDFN\" data-link-type=\"dfn\">values</a> for the property <code>ex:ssn</code> as specified by the <code>sh:maxCount</code> of 1. The third <a href=\"#dfn-validation-results\" class=\"internalDFN\" data-link-type=\"dfn\">validation result</a> is produced because <code>ex:Calvin</code> has a <a href=\"#dfn-value\" class=\"internalDFN\" data-link-type=\"dfn\">value</a> for <code>ex:worksFor</code> that does not have an <code>rdf:type</code> triple that makes it a <a href=\"#dfn-shacl-instance\" class=\"internalDFN\" data-link-type=\"dfn\">SHACL instance</a> of <code>ex:Company</code>. The forth <a href=\"#dfn-validation-results\" class=\"internalDFN\" data-link-type=\"dfn\">validation result</a> is produced because the <a href=\"#dfn-shape\" class=\"internalDFN\" data-link-type=\"dfn\">shape</a> <code>ex:PersonShape</code> has the property <code>sh:closed</code> set to <code>true</code> but <code>ex:Calvin</code> uses the property <code>ex:birthDate</code> which is neither one of the predicates from any of the\n",
" <a href=\"#dfn-property-shape\" class=\"internalDFN\" data-link-type=\"dfn\">property shapes</a> of the shape, nor one of the properties listed using <code>sh:ignoredProperties</code>.\n",
" </p>\n",
" </em></blockquote>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Among the more fun parts are the `target_graph`, which includes all the _inferred_ types."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"## the inferred graph\n",
"```turtle\n",
"@prefix ex: <http://example.com/ns#> .\n",
"@prefix owl: <http://www.w3.org/2002/07/owl#> .\n",
"@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n",
"@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n",
"@prefix sh: <http://www.w3.org/ns/shacl#> .\n",
"@prefix xml: <http://www.w3.org/XML/1998/namespace> .\n",
"@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n",
"\n",
"owl:Nothing a rdfs:Class,\n",
" rdfs:Resource,\n",
" owl:Class,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Resource,\n",
" owl:Nothing,\n",
" owl:Thing ;\n",
" owl:equivalentClass owl:Nothing ;\n",
" owl:sameAs owl:Nothing .\n",
"\n",
"owl:Thing a rdfs:Class,\n",
" rdfs:Resource,\n",
" owl:Class,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Resource,\n",
" owl:Thing ;\n",
" owl:equivalentClass rdfs:Resource,\n",
" owl:Thing ;\n",
" owl:sameAs owl:Thing .\n",
"\n",
"ex:Alice a ex:Person,\n",
" rdfs:Resource,\n",
" owl:Thing ;\n",
" ex:ssn \"987-65-432A\"^^<xsd:string> ;\n",
" owl:sameAs ex:Alice .\n",
"\n",
"ex:Bob a ex:Person,\n",
" rdfs:Resource,\n",
" owl:Thing ;\n",
" ex:ssn \"123-45-6789\"^^<xsd:string> ;\n",
" owl:sameAs ex:Bob .\n",
"\n",
"ex:Calvin a ex:Person,\n",
" rdfs:Resource,\n",
" owl:Thing ;\n",
" ex:birthDate \"1971-07-07\"^^<xsd:date> ;\n",
" ex:worksFor ex:UntypedCompany ;\n",
" owl:sameAs ex:Calvin .\n",
"\n",
"rdf:HTML a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs rdf:HTML .\n",
"\n",
"rdf:LangString a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs rdf:LangString .\n",
"\n",
"rdf:PlainLiteral a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs rdf:PlainLiteral .\n",
"\n",
"rdf:XMLLiteral a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs rdf:XMLLiteral .\n",
"\n",
"rdfs:comment a rdfs:Resource,\n",
" owl:AnnotationProperty,\n",
" owl:Thing ;\n",
" owl:sameAs rdfs:comment .\n",
"\n",
"rdfs:isDefinedBy a rdfs:Resource,\n",
" owl:AnnotationProperty,\n",
" owl:Thing ;\n",
" owl:sameAs rdfs:isDefinedBy .\n",
"\n",
"rdfs:label a rdfs:Resource,\n",
" owl:AnnotationProperty,\n",
" owl:Thing ;\n",
" owl:sameAs rdfs:label .\n",
"\n",
"rdfs:seeAlso a rdfs:Resource,\n",
" owl:AnnotationProperty,\n",
" owl:Thing ;\n",
" owl:sameAs rdfs:seeAlso .\n",
"\n",
"xsd:NCName a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:NCName .\n",
"\n",
"xsd:NMTOKEN a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:NMTOKEN .\n",
"\n",
"xsd:Name a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:Name .\n",
"\n",
"xsd:anyURI a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:anyURI .\n",
"\n",
"xsd:base64Binary a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:base64Binary .\n",
"\n",
"xsd:boolean a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:boolean .\n",
"\n",
"xsd:byte a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:byte .\n",
"\n",
"xsd:date a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:date .\n",
"\n",
"xsd:dateTime a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:dateTime .\n",
"\n",
"xsd:dateTimeStamp a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:dateTimeStamp .\n",
"\n",
"xsd:decimal a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:decimal .\n",
"\n",
"xsd:double a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:double .\n",
"\n",
"xsd:float a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:float .\n",
"\n",
"xsd:hexBinary a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:hexBinary .\n",
"\n",
"xsd:int a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:int .\n",
"\n",
"xsd:integer a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:integer .\n",
"\n",
"xsd:language a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:language .\n",
"\n",
"xsd:long a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:long .\n",
"\n",
"xsd:negativeInteger a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:negativeInteger .\n",
"\n",
"xsd:nonNegativeInteger a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:nonNegativeInteger .\n",
"\n",
"xsd:nonPositiveInteger a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:nonPositiveInteger .\n",
"\n",
"xsd:normalizedString a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:normalizedString .\n",
"\n",
"xsd:positiveInteger a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:positiveInteger .\n",
"\n",
"xsd:short a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:short .\n",
"\n",
"xsd:string a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:string .\n",
"\n",
"xsd:time a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:time .\n",
"\n",
"xsd:token a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:token .\n",
"\n",
"xsd:unsignedByte a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:unsignedByte .\n",
"\n",
"xsd:unsignedInt a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:unsignedInt .\n",
"\n",
"xsd:unsignedLong a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:unsignedLong .\n",
"\n",
"xsd:unsignedShort a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:sameAs xsd:unsignedShort .\n",
"\n",
"owl:backwardCompatibleWith a rdfs:Resource,\n",
" owl:AnnotationProperty,\n",
" owl:Thing ;\n",
" owl:sameAs owl:backwardCompatibleWith .\n",
"\n",
"owl:deprecated a rdfs:Resource,\n",
" owl:AnnotationProperty,\n",
" owl:Thing ;\n",
" owl:sameAs owl:deprecated .\n",
"\n",
"owl:incompatibleWith a rdfs:Resource,\n",
" owl:AnnotationProperty,\n",
" owl:Thing ;\n",
" owl:sameAs owl:incompatibleWith .\n",
"\n",
"owl:priorVersion a rdfs:Resource,\n",
" owl:AnnotationProperty,\n",
" owl:Thing ;\n",
" owl:sameAs owl:priorVersion .\n",
"\n",
"owl:versionInfo a rdfs:Resource,\n",
" owl:AnnotationProperty,\n",
" owl:Thing ;\n",
" owl:sameAs owl:versionInfo .\n",
"\n",
"ex:UntypedCompany a rdfs:Resource,\n",
" owl:Thing ;\n",
" owl:sameAs ex:UntypedCompany .\n",
"\n",
"\"1971-07-07\"^^<xsd:date> a rdfs:Resource,\n",
" owl:Thing ;\n",
" owl:sameAs \"1971-07-07\"^^<xsd:date> .\n",
"\n",
"\"123-45-6789\"^^<xsd:string> a rdfs:Resource,\n",
" owl:Thing ;\n",
" owl:sameAs \"123-45-6789\"^^<xsd:string> .\n",
"\n",
"\"987-65-432A\"^^<xsd:string> a rdfs:Resource,\n",
" owl:Thing ;\n",
" owl:sameAs \"987-65-432A\"^^<xsd:string> .\n",
"\n",
"ex:birthDate a rdf:Property ;\n",
" rdfs:subPropertyOf ex:birthDate ;\n",
" owl:equivalentProperty ex:birthDate ;\n",
" owl:sameAs ex:birthDate .\n",
"\n",
"ex:ssn a rdf:Property ;\n",
" rdfs:subPropertyOf ex:ssn ;\n",
" owl:equivalentProperty ex:ssn ;\n",
" owl:sameAs ex:ssn .\n",
"\n",
"ex:worksFor a rdf:Property ;\n",
" rdfs:subPropertyOf ex:worksFor ;\n",
" owl:equivalentProperty ex:worksFor ;\n",
" owl:sameAs ex:worksFor .\n",
"\n",
"rdf:type a rdf:Property ;\n",
" rdfs:subPropertyOf rdf:type ;\n",
" owl:equivalentProperty rdf:type ;\n",
" owl:sameAs rdf:type .\n",
"\n",
"rdfs:subClassOf a rdf:Property ;\n",
" rdfs:subPropertyOf rdfs:subClassOf ;\n",
" owl:equivalentProperty rdfs:subClassOf ;\n",
" owl:sameAs rdfs:subClassOf .\n",
"\n",
"rdfs:subPropertyOf a rdf:Property ;\n",
" rdfs:subPropertyOf rdfs:subPropertyOf ;\n",
" owl:equivalentProperty rdfs:subPropertyOf ;\n",
" owl:sameAs rdfs:subPropertyOf .\n",
"\n",
"owl:equivalentClass a rdf:Property ;\n",
" rdfs:subPropertyOf owl:equivalentClass ;\n",
" owl:equivalentProperty owl:equivalentClass ;\n",
" owl:sameAs owl:equivalentClass .\n",
"\n",
"owl:equivalentProperty a rdf:Property ;\n",
" rdfs:subPropertyOf owl:equivalentProperty ;\n",
" owl:equivalentProperty owl:equivalentProperty ;\n",
" owl:sameAs owl:equivalentProperty .\n",
"\n",
"owl:sameAs a rdf:Property ;\n",
" rdfs:subPropertyOf owl:sameAs ;\n",
" owl:equivalentProperty owl:sameAs ;\n",
" owl:sameAs owl:sameAs .\n",
"\n",
"ex:Person a rdfs:Resource,\n",
" owl:Thing ;\n",
" owl:sameAs ex:Person .\n",
"\n",
"rdfs:Class a rdfs:Resource,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Class,\n",
" owl:Class ;\n",
" owl:equivalentClass rdfs:Class,\n",
" owl:Class ;\n",
" owl:sameAs rdfs:Class .\n",
"\n",
"owl:Class a rdfs:Resource,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Class,\n",
" owl:Class ;\n",
" owl:equivalentClass rdfs:Class,\n",
" owl:Class ;\n",
" owl:sameAs owl:Class .\n",
"\n",
"rdf:Property owl:sameAs rdf:Property .\n",
"\n",
"owl:AnnotationProperty a rdfs:Resource,\n",
" owl:Thing ;\n",
" owl:sameAs owl:AnnotationProperty .\n",
"\n",
"rdfs:Literal a rdfs:Datatype,\n",
" rdfs:Resource,\n",
" owl:DataRange,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Literal ;\n",
" owl:equivalentClass rdfs:Literal ;\n",
" owl:sameAs rdfs:Literal .\n",
"\n",
"rdfs:Datatype a rdfs:Resource,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Datatype,\n",
" owl:DataRange ;\n",
" owl:equivalentClass rdfs:Datatype,\n",
" owl:DataRange ;\n",
" owl:sameAs rdfs:Datatype .\n",
"\n",
"owl:DataRange a rdfs:Resource,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Datatype,\n",
" owl:DataRange ;\n",
" owl:equivalentClass rdfs:Datatype,\n",
" owl:DataRange ;\n",
" owl:sameAs owl:DataRange .\n",
"\n",
"rdfs:Resource a rdfs:Resource,\n",
" owl:Thing ;\n",
" rdfs:subClassOf rdfs:Resource,\n",
" owl:Thing ;\n",
" owl:equivalentClass rdfs:Resource,\n",
" owl:Thing ;\n",
" owl:sameAs rdfs:Resource .\n",
"\n",
"```"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pgprint(v.target_graph, \"the inferred graph\")"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"## ...But Still Just Three [`ex:People`](https://example.com/#People)"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>instances_of_type</th>\n",
" <th>type_we_have_instance_of</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>61</td>\n",
" <td>http://www.w3.org/2000/01/rdf-schema#Resource</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>61</td>\n",
" <td>http://www.w3.org/2002/07/owl#Thing</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>36</td>\n",
" <td>http://www.w3.org/2000/01/rdf-schema#Datatype</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>36</td>\n",
" <td>http://www.w3.org/2002/07/owl#DataRange</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2</td>\n",
" <td>http://www.w3.org/2000/01/rdf-schema#Class</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>9</td>\n",
" <td>http://www.w3.org/1999/02/22-rdf-syntax-ns#Pro...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>9</td>\n",
" <td>http://www.w3.org/2002/07/owl#AnnotationProperty</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>2</td>\n",
" <td>http://www.w3.org/2002/07/owl#Class</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>3</td>\n",
" <td>http://example.com/ns#Person</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" instances_of_type type_we_have_instance_of\n",
"0 61 http://www.w3.org/2000/01/rdf-schema#Resource\n",
"1 61 http://www.w3.org/2002/07/owl#Thing\n",
"2 36 http://www.w3.org/2000/01/rdf-schema#Datatype\n",
"3 36 http://www.w3.org/2002/07/owl#DataRange\n",
"4 2 http://www.w3.org/2000/01/rdf-schema#Class\n",
"5 9 http://www.w3.org/1999/02/22-rdf-syntax-ns#Pro...\n",
"6 9 http://www.w3.org/2002/07/owl#AnnotationProperty\n",
"7 2 http://www.w3.org/2002/07/owl#Class\n",
"8 3 http://example.com/ns#Person"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"count_types(v.target_graph, \n",
" f\"\"\"...But Still Just Three [`ex:People`](https://example.com/#People)\"\"\");"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"jupyter": {
"source_hidden": true
}
},
"outputs": [
{
"data": {
"text/html": [
"<style>\n",
".jp-RenderedHTMLCommon a[href^=\"https://www.w3.org\"],\n",
".jp-RenderedHTMLCommon a[href^=\"https://github.com\"],\n",
".jp-RenderedHTMLCommon a[href^=\"https://example.com\"] {\n",
" padding-right: 0.8em;\n",
" background-image: url(\"https://www.w3.org/Icons/WWW/w3c_home_nb-v.svg\");\n",
" background-repeat: no-repeat;\n",
" background-size: auto 0.61em;\n",
" background-position: right 0;\n",
"}\n",
"\n",
".jp-RenderedHTMLCommon a[href^=\"https://github.com\"] {\n",
" background-image: url(\"https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/mark-github.svg\");\n",
"}\n",
".jp-RenderedHTMLCommon a[href^=\"https://example.com\"] {\n",
" background-image: url(\"https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/squirrel.svg\");\n",
"}\n",
"</style>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%html\n",
"<style>\n",
".jp-RenderedHTMLCommon a[href^=\"https://www.w3.org\"],\n",
".jp-RenderedHTMLCommon a[href^=\"https://github.com\"],\n",
".jp-RenderedHTMLCommon a[href^=\"https://example.com\"] {\n",
" padding-right: 0.8em;\n",
" background-image: url(\"https://www.w3.org/Icons/WWW/w3c_home_nb-v.svg\");\n",
" background-repeat: no-repeat;\n",
" background-size: auto 0.61em;\n",
" background-position: right 0;\n",
"}\n",
"\n",
".jp-RenderedHTMLCommon a[href^=\"https://github.com\"] {\n",
" background-image: url(\"https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/mark-github.svg\");\n",
"}\n",
".jp-RenderedHTMLCommon a[href^=\"https://example.com\"] {\n",
" background-image: url(\"https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/squirrel.svg\");\n",
"}\n",
"</style>"
]
}
],
"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.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
jupyter labextension install @jupyter-widgets/[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment