{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# DBpedia Schema Queries\n",
    "\n",
    "## Overview\n",
    "\n",
    "In this notebook,  I begin the process of analyzing the schema of the [DBpedia Ontology](http://mappings.dbpedia.org/index.php/How_to_edit_the_DBpedia_Ontology).\n",
    "This is a local notebook in which I load data from the filesystem into an in-memory graph,  thus it is\n",
    "part of the unit tests for gastrodon.  This is feasible because the schema is much smaller than DBpedia as a whole.\n",
    "\n",
    "The following diagram illustrates the relationships between DBpedia Ontology,  it's parts,  DBpedia,  and the world it describes\n",
    "\n",
    "<img src=\"img/what-it-represents.png\" width=\"861\" height=\"311\">\n",
    "\n",
    "The numbers above are really rough (by as much as [30 orders of magnitude](https://physics.stackexchange.com/questions/35920/maximum-possible-information-in-the-universe))),  but some key points are:\n",
    "\n",
    "* The DBpedia Ontology has it's own Ontology,  which is a subset of RDFS,  OWL,  Dublin Core,  Prov and similar vocabularies\n",
    "* The DBpedia Ontology is much smaller (thousands of times) than DBpedia itself\n",
    "* DBpedia does not directly describe the external universe,  but instead describes Wikipedia,  which itself describes the universe.\n",
    "\n",
    "It's important to keep these layers straight,  because in this notebook,  we are looking at a description of the vocabulary used in DBpedia that uses RDFS, OWL, etc. vocabulary.  RDF is unusual among data representations in that schemas in RDF are themselves written in RDF,  and can be joined together with the data they describe.  In this case,  however,  I've separated out a small amount of schema data that I intend to use to control operations against a larger database,  much like the program of a numerically controlled machine tool or the punched cards that control a [Jacquard Loom](https://en.wikipedia.org/wiki/Jacquard_loom).\n",
    "\n",
    "This notebook is part of the test suite for the Gastrodon framework,  and a number of bugs were squashed and API improvements made in the process of creating it.  It will be of use to anyone who wants to better understand RDF,  SPARQL,  DBPedia, Pandas,  and how to put it all together with Gastrodon.\n",
    "\n",
    "## Setup\n",
    "\n",
    "As always,  I import names from the Python packages I use:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autotime\n",
    "%matplotlib inline\n",
    "\n",
    "import sys\n",
    "from rdflib import Graph,URIRef\n",
    "from gastrodon import LocalEndpoint,one,QName\n",
    "import gzip\n",
    "import pandas as pd\n",
    "pd.set_option(\"display.width\",100)\n",
    "pd.set_option(\"display.max_colwidth\",80)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Loading the graph\n",
    "\n",
    "I [Zopfli](https://en.wikipedia.org/wiki/Zopfli) compressed a copy of the DBpedia Ontology from version 2015-10,  so I can load it like so:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 2.5 ms\n"
     ]
    }
   ],
   "source": [
    "g=Graph()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Graph identifier=N2e6e7463841b4ebb9bb7ef8d8ee8eb48 (<class 'rdflib.graph.Graph'>)>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 2.85 s\n"
     ]
    }
   ],
   "source": [
    "g.parse(gzip.open(\"data/dbpedia_2015-10.nt.gz\"),format=\"nt\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now it is loaded in memory in an RDF graph which I can do SPARQL queries on;  think of it as a hashtable on steroids.  I can get the size of the graph (number of triples) the same way I would get the size of any Python object:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "30318"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 4 ms\n"
     ]
    }
   ],
   "source": [
    "len(g)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The Graph is supplied by RDFLib,  but I wrap it in an Endpoint object supplied by Gastrodon;  this provides a bridge between RDFLib and pandas as well as smoothing away the difference between a local endpoint and remote endpoints (a SPARQL database running in another process or on another computer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 10 ms\n"
     ]
    }
   ],
   "source": [
    "e=LocalEndpoint(g)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Counting properties and discovering namespaces\n",
    "\n",
    "Probably the best query to run on an unfamiliar database is to count the properties (predicates) used in it.  Note that the predicates that I'm working with in this stage are the predicates that make up the DBpedia Ontology,  they are not the predicates that are used in the larger DBpedia Ontology.  I'll show you those later."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>p</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>rdfs:label</th>\n",
       "      <td>11645</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdf:type</th>\n",
       "      <td>6681</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://www.w3.org/ns/prov#wasDerivedFrom</th>\n",
       "      <td>3434</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:range</th>\n",
       "      <td>2558</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:domain</th>\n",
       "      <td>2407</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:comment</th>\n",
       "      <td>1208</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:subPropertyOf</th>\n",
       "      <td>971</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:subClassOf</th>\n",
       "      <td>748</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://www.w3.org/2002/07/owl#equivalentClass</th>\n",
       "      <td>407</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://www.w3.org/2002/07/owl#equivalentProperty</th>\n",
       "      <td>222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://www.w3.org/2002/07/owl#disjointWith</th>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://creativecommons.org/ns#license</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://purl.org/dc/terms/issued</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://purl.org/dc/terms/publisher</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://purl.org/dc/terms/source</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://purl.org/dc/terms/creator</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://purl.org/dc/terms/modified</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://www.w3.org/2002/07/owl#versionInfo</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://purl.org/dc/terms/description</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://purl.org/vocab/vann/preferredNamespaceUri</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://purl.org/dc/terms/title</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://purl.org/vocab/vann/preferredNamespacePrefix</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://xmlns.com/foaf/0.1/homepage</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                       cnt\n",
       "p                                                         \n",
       "rdfs:label                                           11645\n",
       "rdf:type                                              6681\n",
       "http://www.w3.org/ns/prov#wasDerivedFrom              3434\n",
       "rdfs:range                                            2558\n",
       "rdfs:domain                                           2407\n",
       "rdfs:comment                                          1208\n",
       "rdfs:subPropertyOf                                     971\n",
       "rdfs:subClassOf                                        748\n",
       "http://www.w3.org/2002/07/owl#equivalentClass          407\n",
       "http://www.w3.org/2002/07/owl#equivalentProperty       222\n",
       "http://www.w3.org/2002/07/owl#disjointWith              24\n",
       "http://creativecommons.org/ns#license                    2\n",
       "http://purl.org/dc/terms/issued                          1\n",
       "http://purl.org/dc/terms/publisher                       1\n",
       "http://purl.org/dc/terms/source                          1\n",
       "http://purl.org/dc/terms/creator                         1\n",
       "http://purl.org/dc/terms/modified                        1\n",
       "http://www.w3.org/2002/07/owl#versionInfo                1\n",
       "http://purl.org/dc/terms/description                     1\n",
       "http://purl.org/vocab/vann/preferredNamespaceUri         1\n",
       "http://purl.org/dc/terms/title                           1\n",
       "http://purl.org/vocab/vann/preferredNamespacePrefix      1\n",
       "http://xmlns.com/foaf/0.1/homepage                       1"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 3.42 s\n"
     ]
    }
   ],
   "source": [
    "properties=e.select(\"\"\"\n",
    "   SELECT ?p (COUNT(*) AS ?cnt) {\n",
    "      ?s ?p ?o .\n",
    "   } GROUP BY ?p ORDER BY DESC(?cnt)\n",
    "\"\"\")\n",
    "properties"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note that the leftmost column is bold;  this is because gastrodon recognized that this query groups on the `?p` variable and it made this an [index](http://pandas.pydata.org/pandas-docs/stable/indexing.html) of the pandas dataframe.  Gastrodon uses the SPARQL parser from RDFLib to understand your queries to support you in writing and displaying them.  One advantage of this is that if you want to make a plot from the above data frame (which I'll do in a moment after cleaning the data) the dependent and independent variables will be automatically determined and things will 'just work'.\n",
    "\n",
    "Another thing to note is that the table shows short names such as `rdfs:label` as well as full URIs for predicates.  The full URIs are tedious to work with,  so I add a number of namespace declarations\n",
    "and make a new `LocalEndpoint`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 4 ms\n"
     ]
    }
   ],
   "source": [
    "g.bind(\"prov\",\"http://www.w3.org/ns/prov#\")\n",
    "g.bind(\"owl\",\"http://www.w3.org/2002/07/owl#\")\n",
    "g.bind(\"cc\",\"http://creativecommons.org/ns#\")\n",
    "g.bind(\"foaf\",\"http://xmlns.com/foaf/0.1/\")\n",
    "g.bind(\"dc\",\"http://purl.org/dc/terms/\")\n",
    "g.bind(\"vann\",\"http://purl.org/vocab/vann/\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>p</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>rdfs:label</th>\n",
       "      <td>11645</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdf:type</th>\n",
       "      <td>6681</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>prov:wasDerivedFrom</th>\n",
       "      <td>3434</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:range</th>\n",
       "      <td>2558</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:domain</th>\n",
       "      <td>2407</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:comment</th>\n",
       "      <td>1208</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:subPropertyOf</th>\n",
       "      <td>971</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:subClassOf</th>\n",
       "      <td>748</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:equivalentClass</th>\n",
       "      <td>407</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:equivalentProperty</th>\n",
       "      <td>222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:disjointWith</th>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>cc:license</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dc:issued</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dc:publisher</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dc:source</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dc:creator</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dc:modified</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:versionInfo</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dc:description</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>vann:preferredNamespaceUri</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dc:title</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>vann:preferredNamespacePrefix</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>foaf:homepage</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                 cnt\n",
       "p                                   \n",
       "rdfs:label                     11645\n",
       "rdf:type                        6681\n",
       "prov:wasDerivedFrom             3434\n",
       "rdfs:range                      2558\n",
       "rdfs:domain                     2407\n",
       "rdfs:comment                    1208\n",
       "rdfs:subPropertyOf               971\n",
       "rdfs:subClassOf                  748\n",
       "owl:equivalentClass              407\n",
       "owl:equivalentProperty           222\n",
       "owl:disjointWith                  24\n",
       "cc:license                         2\n",
       "dc:issued                          1\n",
       "dc:publisher                       1\n",
       "dc:source                          1\n",
       "dc:creator                         1\n",
       "dc:modified                        1\n",
       "owl:versionInfo                    1\n",
       "dc:description                     1\n",
       "vann:preferredNamespaceUri         1\n",
       "dc:title                           1\n",
       "vann:preferredNamespacePrefix      1\n",
       "foaf:homepage                      1"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 1.93 s\n"
     ]
    }
   ],
   "source": [
    "e=LocalEndpoint(g)\n",
    "properties=e.select(\"\"\"\n",
    "   SELECT ?p (COUNT(*) AS ?cnt) {\n",
    "      ?s ?p ?o .\n",
    "   } GROUP BY ?p ORDER BY DESC(?cnt)\n",
    "\"\"\")\n",
    "properties"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Metadata about the DBpedia Ontology\n",
    "\n",
    "I find it suspicious that so many properties occur only once,  so I investigate:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "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>s</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>http://dbpedia.org/ontology/</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                              s\n",
       "0  http://dbpedia.org/ontology/"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 23.5 ms\n"
     ]
    }
   ],
   "source": [
    "single=e.select(\"\"\"\n",
    "   SELECT ?s {\n",
    "      ?s dc:source ?o .\n",
    "    }\n",
    "\"\"\")\n",
    "single"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The `one` function will extract the single member of any list, iterable, DataFrame, or Series that has just one member."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 999 µs\n"
     ]
    }
   ],
   "source": [
    "ontology=one(single)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The `select` function can see variables in the stack frame that calls it.  Simply put,  if you use the `?_ontology` variable in a SPARQL query,  `select` will look for a Python variable called `ontology`,  and substitute the value of `ontology` into `?_ontology`.  The underscore sigil prevents substitutions from happening by accident."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "and we see here a number of facts about the DBpedia Ontology,  that is,  the data set we are working with."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "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>p</th>\n",
       "      <th>o</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>cc:license</td>\n",
       "      <td>http://creativecommons.org/licenses/by-sa/3.0/</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>cc:license</td>\n",
       "      <td>http://www.gnu.org/copyleft/fdl.html</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dc:creator</td>\n",
       "      <td>DBpedia Maintainers and Contributors</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dc:description</td>\n",
       "      <td>\\n              The DBpedia ontology provides the classes and properties use...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dc:issued</td>\n",
       "      <td>2008-11-17T12:00Z</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dc:modified</td>\n",
       "      <td>2015-11-02T09:36Z</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dc:publisher</td>\n",
       "      <td>DBpedia Maintainers</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dc:source</td>\n",
       "      <td>http://mappings.dbpedia.org</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dc:title</td>\n",
       "      <td>The DBpedia Ontology</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>vann:preferredNamespacePrefix</td>\n",
       "      <td>dbo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>vann:preferredNamespaceUri</td>\n",
       "      <td>http://dbpedia.org/ontology/</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>rdf:type</td>\n",
       "      <td>owl:Ontology</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>rdf:type</td>\n",
       "      <td>http://purl.org/vocommons/voaf#Vocabulary</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>rdfs:comment</td>\n",
       "      <td>\\n              This ontology is generated from the manually created specifi...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>owl:versionInfo</td>\n",
       "      <td>4.1-SNAPSHOT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>foaf:homepage</td>\n",
       "      <td>http://wiki.dbpedia.org/Ontology</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                p  \\\n",
       "0                      cc:license   \n",
       "1                      cc:license   \n",
       "2                      dc:creator   \n",
       "3                  dc:description   \n",
       "4                       dc:issued   \n",
       "5                     dc:modified   \n",
       "6                    dc:publisher   \n",
       "7                       dc:source   \n",
       "8                        dc:title   \n",
       "9   vann:preferredNamespacePrefix   \n",
       "10     vann:preferredNamespaceUri   \n",
       "11                       rdf:type   \n",
       "12                       rdf:type   \n",
       "13                   rdfs:comment   \n",
       "14                owl:versionInfo   \n",
       "15                  foaf:homepage   \n",
       "\n",
       "                                                                                  o  \n",
       "0                                    http://creativecommons.org/licenses/by-sa/3.0/  \n",
       "1                                              http://www.gnu.org/copyleft/fdl.html  \n",
       "2                                              DBpedia Maintainers and Contributors  \n",
       "3   \\n              The DBpedia ontology provides the classes and properties use...  \n",
       "4                                                                 2008-11-17T12:00Z  \n",
       "5                                                                 2015-11-02T09:36Z  \n",
       "6                                                               DBpedia Maintainers  \n",
       "7                                                       http://mappings.dbpedia.org  \n",
       "8                                                              The DBpedia Ontology  \n",
       "9                                                                               dbo  \n",
       "10                                                     http://dbpedia.org/ontology/  \n",
       "11                                                                     owl:Ontology  \n",
       "12                                        http://purl.org/vocommons/voaf#Vocabulary  \n",
       "13  \\n              This ontology is generated from the manually created specifi...  \n",
       "14                                                                     4.1-SNAPSHOT  \n",
       "15                                                 http://wiki.dbpedia.org/Ontology  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 54 ms\n"
     ]
    }
   ],
   "source": [
    "meta=e.select(\"\"\"\n",
    "    SELECT ?p ?o {\n",
    "        ?_ontology ?p ?o .\n",
    "    } ORDER BY ?p\n",
    "\"\"\")\n",
    "meta"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "rdflib.term.URIRef('http://dbpedia.org/ontology/')"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 3.49 ms\n"
     ]
    }
   ],
   "source": [
    "ontology"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## How Gastrodon handles URI References\n",
    "\n",
    "Gastrodon tries to display things in a simple way while watching your back to prevent mistakes.  One potential mistake is that RDF makes a distinction between a literal string such as `\"http://dbpedia.org/ontology/\"` and a URI references such as `<http://dbpedia.org/ontology/>`.  Use the wrong one and your queries won't work!\n",
    "\n",
    "This particularly could be a problem with abbreviated names,  for instance,  let's look at the first predicate in the `meta` frame.  When displayed in as a result of Jupyter notebook or in a Pandas Dataframe,  the short name looks just like a string:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'cc:license'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 11 ms\n"
     ]
    }
   ],
   "source": [
    "license=meta.at[0,'p']\n",
    "license"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "that's because it is a string!  It's more than a string,  however,  it is a class which is a subclass of string:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "gastrodon.GastrodonURI"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 16 ms\n"
     ]
    }
   ],
   "source": [
    "type(license)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "and in fact has the full URI reference hidden away inside of it"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "rdflib.term.URIRef('http://creativecommons.org/ns#license')"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 14 ms\n"
     ]
    }
   ],
   "source": [
    "meta.at[0,'p'].to_uri_ref()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "When you access this value in a SPARQL query,  the `select` function recognizes the type of the variable and automatically inserts the full URI reference"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "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>s</th>\n",
       "      <th>o</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>http://dbpedia.org/ontology/</td>\n",
       "      <td>http://www.gnu.org/copyleft/fdl.html</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>http://dbpedia.org/ontology/</td>\n",
       "      <td>http://creativecommons.org/licenses/by-sa/3.0/</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                              s                                               o\n",
       "0  http://dbpedia.org/ontology/            http://www.gnu.org/copyleft/fdl.html\n",
       "1  http://dbpedia.org/ontology/  http://creativecommons.org/licenses/by-sa/3.0/"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 56 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?s ?o {\n",
    "        ?s ?_license ?o .\n",
    "    }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Counting properties that are not about the Ontology"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Since the metadata properties that describe this dataset really aren't part of it,  it makes sense to remove these from the list so that we don't have so many properties that are used just once"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>p</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>rdfs:label</th>\n",
       "      <td>11645</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdf:type</th>\n",
       "      <td>6679</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>prov:wasDerivedFrom</th>\n",
       "      <td>3434</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:range</th>\n",
       "      <td>2558</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:domain</th>\n",
       "      <td>2407</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:comment</th>\n",
       "      <td>1207</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:subPropertyOf</th>\n",
       "      <td>971</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:subClassOf</th>\n",
       "      <td>748</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:equivalentClass</th>\n",
       "      <td>407</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:equivalentProperty</th>\n",
       "      <td>222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:disjointWith</th>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          cnt\n",
       "p                            \n",
       "rdfs:label              11645\n",
       "rdf:type                 6679\n",
       "prov:wasDerivedFrom      3434\n",
       "rdfs:range               2558\n",
       "rdfs:domain              2407\n",
       "rdfs:comment             1207\n",
       "rdfs:subPropertyOf        971\n",
       "rdfs:subClassOf           748\n",
       "owl:equivalentClass       407\n",
       "owl:equivalentProperty    222\n",
       "owl:disjointWith           24"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 4.54 s\n"
     ]
    }
   ],
   "source": [
    "properties=e.select(\"\"\"\n",
    "   SELECT ?p (COUNT(*) AS ?cnt) {\n",
    "      ?s ?p ?o .\n",
    "      FILTER(?s!=?_ontology)\n",
    "   } GROUP BY ?p ORDER BY DESC(?cnt)\n",
    "\"\"\")\n",
    "properties"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "At this point it is about as easy to make a pie chart as it is with Excel.  A pie chart is a good choice here because each fact has exactly one property in it:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0,0.5,'')"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAdAAAAFbCAYAAABlKt8bAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzs3Xl4lOXV+PHvmTWZSTJACBAIEESR\nfREEZK+2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i6U9I5hAvTY2bpjOQJ8JiZbY9udwJ+\nKSkAHgY+nVFutpmtiU4dzweqgSHAMjNbHpXJTKBnAz+QNB+oBQ4CBmTzwp1zIe+BOpedzJ5bqzsy\nmNkmSScCXwBSwFeBb7RS77XAe8CJhI3dzD1Ed2bcrif8LIvmCfiymb3VWqzOubbxHqhzB2YWMFZS\nL0mdgPFNFZJ0GFBmZo8ANwAj21B3D2Bd1Mv8OlDeSvnFhL3c6uj3izIeexq4JmOsdEQbju+ca4H3\nQJ07AGa2TtIk4GVgHeGkoqYSXV/gfkmNjdbrockx0Ex3A49IGk84ttrieGU0bvpt4ClJG4HZGQ/f\nDNwOLIiS6ArgvLa8Rudc03w/UOdKiKRuZrYtSpL/AbxjZj+LOy7nSpGfwnWutFwRTRR6g/AU8D0x\nx+NcyfIeqHPOOZcF74E655xzWfAE6pxzzmXBE6hzzjmXBU+gzjnnXBY8gTrnnHNZ8ATqnHPOZcET\nqHPOOZcFT6DOOedcFjyBOuecc1nwBOqcc85lwROoc845lwVPoM4551wWPIE655xzWfAE6pxzzmXB\nE6hzzjmXBU+gzjnnXBY8gTrnnHNZ8ATqnHPOZcETqHPOOZcFT6DOOedcFjyBOuecc1nwBOqcc85l\nwROoc845lwVPoM4551wW/j/7aofzmsm0lwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x2b5e4167b38>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 172 ms\n"
     ]
    }
   ],
   "source": [
    "properties[\"cnt\"].plot.pie(figsize=(6,6)).set_ylabel('')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "My favorite method for understanding this kind of distribution is to sort the most common properties first and then compute the [Cumulative Distribution Function](https://en.wikipedia.org/wiki/Cumulative_distribution_function),  which is the percentage of facts that have used the predicates we've seen so far.\n",
    "\n",
    "This is easy to compute with Pandas"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "p\n",
       "rdfs:label                 38.429807\n",
       "rdf:type                   60.471256\n",
       "prov:wasDerivedFrom        71.803841\n",
       "rdfs:range                 80.245528\n",
       "rdfs:domain                88.188898\n",
       "rdfs:comment               92.172134\n",
       "rdfs:subPropertyOf         95.376543\n",
       "rdfs:subClassOf            97.845027\n",
       "owl:equivalentClass        99.188172\n",
       "owl:equivalentProperty     99.920797\n",
       "owl:disjointWith          100.000000\n",
       "Name: cnt, dtype: float64"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 27.5 ms\n"
     ]
    }
   ],
   "source": [
    "100.0*properties[\"cnt\"].cumsum()/properties[\"cnt\"].sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note that this result looks different than the DataFrames you've seen so far because it is not a DataFrame,  it is a series,  which has just one index column and one data column.  It's possible to stick several series together to make a DataFrame,  however."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "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>count</th>\n",
       "      <th>frequency</th>\n",
       "      <th>distribution</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>p</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>rdfs:label</th>\n",
       "      <td>11645</td>\n",
       "      <td>38.429807</td>\n",
       "      <td>38.429807</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdf:type</th>\n",
       "      <td>6679</td>\n",
       "      <td>22.041449</td>\n",
       "      <td>60.471256</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>prov:wasDerivedFrom</th>\n",
       "      <td>3434</td>\n",
       "      <td>11.332585</td>\n",
       "      <td>71.803841</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:range</th>\n",
       "      <td>2558</td>\n",
       "      <td>8.441687</td>\n",
       "      <td>80.245528</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:domain</th>\n",
       "      <td>2407</td>\n",
       "      <td>7.943370</td>\n",
       "      <td>88.188898</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:comment</th>\n",
       "      <td>1207</td>\n",
       "      <td>3.983235</td>\n",
       "      <td>92.172134</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:subPropertyOf</th>\n",
       "      <td>971</td>\n",
       "      <td>3.204409</td>\n",
       "      <td>95.376543</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:subClassOf</th>\n",
       "      <td>748</td>\n",
       "      <td>2.468484</td>\n",
       "      <td>97.845027</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:equivalentClass</th>\n",
       "      <td>407</td>\n",
       "      <td>1.343146</td>\n",
       "      <td>99.188172</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:equivalentProperty</th>\n",
       "      <td>222</td>\n",
       "      <td>0.732625</td>\n",
       "      <td>99.920797</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:disjointWith</th>\n",
       "      <td>24</td>\n",
       "      <td>0.079203</td>\n",
       "      <td>100.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                        count  frequency  distribution\n",
       "p                                                     \n",
       "rdfs:label              11645  38.429807     38.429807\n",
       "rdf:type                 6679  22.041449     60.471256\n",
       "prov:wasDerivedFrom      3434  11.332585     71.803841\n",
       "rdfs:range               2558   8.441687     80.245528\n",
       "rdfs:domain              2407   7.943370     88.188898\n",
       "rdfs:comment             1207   3.983235     92.172134\n",
       "rdfs:subPropertyOf        971   3.204409     95.376543\n",
       "rdfs:subClassOf           748   2.468484     97.845027\n",
       "owl:equivalentClass       407   1.343146     99.188172\n",
       "owl:equivalentProperty    222   0.732625     99.920797\n",
       "owl:disjointWith           24   0.079203    100.000000"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 22 ms\n"
     ]
    }
   ],
   "source": [
    "pd.DataFrame.from_items([\n",
    "    ('count',properties[\"cnt\"]),\n",
    "    (\"frequency\",100.0*properties[\"cnt\"]/properties[\"cnt\"].sum()),\n",
    "    (\"distribution\",100.0*properties[\"cnt\"].cumsum()/properties[\"cnt\"].sum())\n",
    "])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Unlike many graphical depictions,  the above chart is fair to both highly common and unusually rare predicates.\n",
    "\n",
    "## Languages\n",
    "\n",
    "It makes sense to start with `rdf:label`,  which is the most common property in this database.\n",
    "\n",
    "Unlike many data formats,  RDF supports language tagging for strings.  Objects (mainly properties and classes used in DBpedia) that are talked about in the DBpedia Ontology are described in multiple human languages,  and counting the language tags involves a query that is very similar to the property counting query:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "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>lang</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>en</td>\n",
       "      <td>3953</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>de</td>\n",
       "      <td>2049</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>nl</td>\n",
       "      <td>1296</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>el</td>\n",
       "      <td>1227</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>fr</td>\n",
       "      <td>755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>ga</td>\n",
       "      <td>469</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>ja</td>\n",
       "      <td>374</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>sr</td>\n",
       "      <td>259</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>es</td>\n",
       "      <td>256</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>it</td>\n",
       "      <td>244</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>ko</td>\n",
       "      <td>237</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>pt</td>\n",
       "      <td>221</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>pl</td>\n",
       "      <td>120</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>gl</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>tr</td>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>sl</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>ca</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>ru</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>bg</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>zh</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>id</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>ar</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>be</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>bn</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>eu</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>lv</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>hy</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>cs</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   lang   cnt\n",
       "0    en  3953\n",
       "1    de  2049\n",
       "2    nl  1296\n",
       "3    el  1227\n",
       "4    fr   755\n",
       "5    ga   469\n",
       "6    ja   374\n",
       "7    sr   259\n",
       "8    es   256\n",
       "9    it   244\n",
       "10   ko   237\n",
       "11   pt   221\n",
       "12   pl   120\n",
       "13   gl    39\n",
       "14   tr    27\n",
       "15   sl    26\n",
       "16   ca    26\n",
       "17   ru    19\n",
       "18   bg    11\n",
       "19   zh    11\n",
       "20   id     6\n",
       "21   ar     5\n",
       "22   be     4\n",
       "23   bn     4\n",
       "24   eu     4\n",
       "25   lv     1\n",
       "26   hy     1\n",
       "27   cs     1"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 1.01 s\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT (LANG(?label) AS ?lang) (COUNT(*) AS ?cnt) {\n",
    "      ?s rdfs:label ?label .\n",
    "   } GROUP BY LANG(?label) ORDER BY DESC(?cnt)\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A detail you might notice is that the lang column is not bolded,  instead,  a sequential numeric index was created when I made the data frame.  This is because Gastrodon,  at this moment,  isn't smart enough to understand a function that appears in the `GROUP BY` clause.\n",
    "\n",
    "This is easy to work around by assinging the output of this function to a variable in a `BIND` clause."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>lang</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>en</th>\n",
       "      <td>3953</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>de</th>\n",
       "      <td>2049</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>nl</th>\n",
       "      <td>1296</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>el</th>\n",
       "      <td>1227</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>fr</th>\n",
       "      <td>755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ga</th>\n",
       "      <td>469</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ja</th>\n",
       "      <td>374</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>sr</th>\n",
       "      <td>259</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>es</th>\n",
       "      <td>256</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>it</th>\n",
       "      <td>244</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ko</th>\n",
       "      <td>237</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>pt</th>\n",
       "      <td>221</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>pl</th>\n",
       "      <td>120</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>gl</th>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>tr</th>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>sl</th>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ca</th>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ru</th>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>bg</th>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>zh</th>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>id</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ar</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>be</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>bn</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>eu</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>lv</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>hy</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>cs</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       cnt\n",
       "lang      \n",
       "en    3953\n",
       "de    2049\n",
       "nl    1296\n",
       "el    1227\n",
       "fr     755\n",
       "ga     469\n",
       "ja     374\n",
       "sr     259\n",
       "es     256\n",
       "it     244\n",
       "ko     237\n",
       "pt     221\n",
       "pl     120\n",
       "gl      39\n",
       "tr      27\n",
       "sl      26\n",
       "ca      26\n",
       "ru      19\n",
       "bg      11\n",
       "zh      11\n",
       "id       6\n",
       "ar       5\n",
       "be       4\n",
       "bn       4\n",
       "eu       4\n",
       "lv       1\n",
       "hy       1\n",
       "cs       1"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 1.52 s\n"
     ]
    }
   ],
   "source": [
    "lang=e.select(\"\"\"\n",
    "   SELECT ?lang (COUNT(*) AS ?cnt) {\n",
    "      ?s rdfs:label ?label .\n",
    "      BIND (LANG(?label) AS ?lang)\n",
    "   } GROUP BY ?lang ORDER BY DESC(?cnt)\n",
    "\"\"\")\n",
    "lang"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "One key to getting correct results in a data analysis is to test your assumptions.  English is the most prevalent language by far,  but can we assume that every object has an English name?  There are 3593 objects with English labels,  but"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3954"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 695 ms\n"
     ]
    }
   ],
   "source": [
    "distinct_s=one(e.select(\"\"\"\n",
    "   SELECT (COUNT(DISTINCT ?s) AS ?cnt) {\n",
    "      ?s rdfs:label ?o .\n",
    "   }\n",
    "\"\"\"))\n",
    "distinct_s"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "objects with labels overall,  so there must be at least one object without an English label.  SPARQL has negation operators so we can find objects like that:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "rdflib.term.URIRef('http://dbpedia.org/ontology/hasSurfaceForm')"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 12.9 s\n"
     ]
    }
   ],
   "source": [
    "black_sheep=one(e.select(\"\"\"\n",
    "   SELECT ?s {\n",
    "      ?s rdfs:label ?o .\n",
    "      FILTER NOT EXISTS {\n",
    "          ?s rdfs:label ?o2 .\n",
    "          FILTER(LANG(?o2)='en')\n",
    "      }\n",
    "   }\n",
    "\"\"\"))\n",
    "black_sheep"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Looking up all the facts for that object (which is a property used in DBpedia) shows that it has a name in greek,  but not any other language"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "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>p</th>\n",
       "      <th>o</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>rdf:type</td>\n",
       "      <td>owl:DatatypeProperty</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>rdf:type</td>\n",
       "      <td>rdf:Property</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>rdfs:comment</td>\n",
       "      <td>Reserved for DBpedia.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>rdfs:label</td>\n",
       "      <td>επιφάνεια από</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>rdfs:range</td>\n",
       "      <td>xsd:string</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>prov:wasDerivedFrom</td>\n",
       "      <td>http://mappings.dbpedia.org/index.php/OntologyProperty:hasSurfaceForm</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     p                                                                      o\n",
       "0             rdf:type                                                   owl:DatatypeProperty\n",
       "1             rdf:type                                                           rdf:Property\n",
       "2         rdfs:comment                                                  Reserved for DBpedia.\n",
       "3           rdfs:label                                                          επιφάνεια από\n",
       "4           rdfs:range                                                             xsd:string\n",
       "5  prov:wasDerivedFrom  http://mappings.dbpedia.org/index.php/OntologyProperty:hasSurfaceForm"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 37.1 ms\n"
     ]
    }
   ],
   "source": [
    "meta=e.select(\"\"\"\n",
    "    SELECT ?p ?o {\n",
    "        ?_black_sheep ?p ?o .\n",
    "    } ORDER BY ?p\n",
    "\"\"\")\n",
    "meta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "I guess that's the exception that proves the rule.  Everything else has a name in English,  about half of the schema objects have a name in German,  and the percentage falls off pretty rapidly from there:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "lang\n",
       "en    99.974709\n",
       "de    51.820941\n",
       "nl    32.776935\n",
       "el    31.031866\n",
       "fr    19.094588\n",
       "ga    11.861406\n",
       "ja     9.458776\n",
       "sr     6.550329\n",
       "es     6.474456\n",
       "it     6.170966\n",
       "ko     5.993930\n",
       "pt     5.589277\n",
       "pl     3.034901\n",
       "gl     0.986343\n",
       "tr     0.682853\n",
       "sl     0.657562\n",
       "ca     0.657562\n",
       "ru     0.480526\n",
       "bg     0.278199\n",
       "zh     0.278199\n",
       "id     0.151745\n",
       "ar     0.126454\n",
       "be     0.101163\n",
       "bn     0.101163\n",
       "eu     0.101163\n",
       "lv     0.025291\n",
       "hy     0.025291\n",
       "cs     0.025291\n",
       "Name: cnt, dtype: float64"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 6 ms\n"
     ]
    }
   ],
   "source": [
    "lang_coverage=100*lang[\"cnt\"]/distinct_s\n",
    "lang_coverage"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "As the percentages add up to more than 100 (an object can have names in many languages),  the pie chart would be a wrong choice,  but a bar chart is effective."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x2b5e4326198>"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAmEAAAFpCAYAAADUTv+7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3Xu0XWV57/HvjyCXkJg03A4XwxaL\nXFNA0lYEHAieU6hYS6VFhVPkVHOoOGqtjg5s1RNrqTqKta2lSGotabUSG7UgPRUqoHg5IDsQCIi3\nCpRbuUgDCRHB8Jw/1opu0p1khzIve+/vZ4yMveZca673GWONiT/nfOf7pKqQJElSu7bpugBJkqTp\nyBAmSZLUAUOYJElSBwxhkiRJHTCESZIkdcAQJkmS1AFDmCRJUgcMYZIkSR0whEmSJHXAECZJktSB\nbbsuYCJ22WWXGhkZ6boMSZKkLVqxYsVDVbXrlj43KULYyMgIo6OjXZchSZK0RUnunMjnvB0pSZLU\nAUOYJElSB1oJYUl+PcnNSW5K8ndJfjXJLcPta9qoQZIkqU8anxOW5GDg94GjquqhJPOALwG/UFX3\nJJm7ieMWAYsA5s+f33SZkiRJrWrjSthxwPKqegigqh4GvgpclOSNwIzxDqqqJVW1sKoW7rrrFh8w\nkCRJmlTaCGEBauyOqjoLeCfwPGBlkp1bqEOSJKk32ghhVwK/tiFoJZmX5AVVdV1VvRt4iEEYkyRJ\nmjYanxNWVbcmORf4UpL1wI3Ac5Psx+Aq2ZXATU3XIUmS1CetLNZaVUuBpW2MJUmSNBm4TpgkSVIH\nDGGSJEkdaCyEJRlJcktT3y9JkjSZeSVMkiSpA02HsBl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",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x2b5e30af320>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 254 ms\n"
     ]
    }
   ],
   "source": [
    "lang_coverage.plot(kind=\"barh\",figsize=(10,6))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Classes used in the DBpedia Ontology\n",
    "\n",
    "I use another `GROUP BY` query to count classes used in the DBpedia Ontology.  In the name of keeping the levels of abstraction straight,  I'll point out that there are eight classes in the DBpedia Ontology,  but that the DBpedia Ontology describes 739 classes used in DBpedia."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>rdf:Property</th>\n",
       "      <td>2695</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:DatatypeProperty</th>\n",
       "      <td>1734</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:ObjectProperty</th>\n",
       "      <td>1099</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:Class</th>\n",
       "      <td>739</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:Datatype</th>\n",
       "      <td>382</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:FunctionalProperty</th>\n",
       "      <td>30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl:Ontology</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://purl.org/vocommons/voaf#Vocabulary</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                            cnt\n",
       "type                                           \n",
       "rdf:Property                               2695\n",
       "owl:DatatypeProperty                       1734\n",
       "owl:ObjectProperty                         1099\n",
       "owl:Class                                   739\n",
       "rdfs:Datatype                               382\n",
       "owl:FunctionalProperty                       30\n",
       "owl:Ontology                                  1\n",
       "http://purl.org/vocommons/voaf#Vocabulary     1"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 456 ms\n"
     ]
    }
   ],
   "source": [
    "types=e.select(\"\"\"\n",
    "   SELECT ?type (COUNT(*) AS ?cnt) {\n",
    "      ?s a ?type .\n",
    "   } GROUP BY ?type ORDER BY DESC(?cnt)\n",
    "\"\"\")\n",
    "types"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "739 classes are really a lot of classes!  You personally might be interested in some particular domain (say Pop Music) but to survey the whole thing,  I need some way to pick out classes which are important.\n",
    "\n",
    "If I had access to the whole DBpedia database,  I could count how many instances of these classes occur,  and that would be one measure of importance.  (I have access to this database,  as do you,  but I'm not using it for this notebook because I want this notebook to be self-contained)\n",
    "\n",
    "As it is,  one proxy for importance is how many properties apply to a particular class,  or,  in RDFS speak,  how many properties have this class as the domain.  The assumption here is that important classes are well documented,  and we get a satisfying list of the top 20 classes this way"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>s</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Person</th>\n",
       "      <td>253</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Place</th>\n",
       "      <td>183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/PopulatedPlace</th>\n",
       "      <td>151</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Athlete</th>\n",
       "      <td>94</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Settlement</th>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/School</th>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/SpaceMission</th>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Island</th>\n",
       "      <td>38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/MilitaryUnit</th>\n",
       "      <td>29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Planet</th>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Work</th>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Species</th>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Organisation</th>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Spacecraft</th>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/MeanOfTransportation</th>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Broadcaster</th>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/ArchitecturalStructure</th>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Film</th>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Artist</th>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/RouteOfTransportation</th>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                    cnt\n",
       "s                                                      \n",
       "http://dbpedia.org/ontology/Person                  253\n",
       "http://dbpedia.org/ontology/Place                   183\n",
       "http://dbpedia.org/ontology/PopulatedPlace          151\n",
       "http://dbpedia.org/ontology/Athlete                  94\n",
       "http://dbpedia.org/ontology/Settlement               56\n",
       "http://dbpedia.org/ontology/School                   47\n",
       "http://dbpedia.org/ontology/SpaceMission             43\n",
       "http://dbpedia.org/ontology/Island                   38\n",
       "http://dbpedia.org/ontology/MilitaryUnit             29\n",
       "http://dbpedia.org/ontology/Planet                   27\n",
       "http://dbpedia.org/ontology/Work                     27\n",
       "http://dbpedia.org/ontology/Species                  27\n",
       "http://dbpedia.org/ontology/Organisation             27\n",
       "http://dbpedia.org/ontology/Spacecraft               25\n",
       "http://dbpedia.org/ontology/MeanOfTransportation     25\n",
       "http://dbpedia.org/ontology/Broadcaster              25\n",
       "http://dbpedia.org/ontology/ArchitecturalStructure   24\n",
       "http://dbpedia.org/ontology/Film                     24\n",
       "http://dbpedia.org/ontology/Artist                   22\n",
       "http://dbpedia.org/ontology/RouteOfTransportation    22"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 315 ms\n"
     ]
    }
   ],
   "source": [
    "types=e.select(\"\"\"\n",
    "   SELECT ?s (COUNT(*) AS ?cnt) {\n",
    "      ?s a owl:Class .\n",
    "      ?p rdfs:domain ?s .\n",
    "   } GROUP BY ?s ORDER BY DESC(?cnt) LIMIT 20\n",
    "\"\"\")\n",
    "types"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Adding another namespace binding makes sense to make the output more managable"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>s</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>dbo:Person</th>\n",
       "      <td>253</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:Place</th>\n",
       "      <td>183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:PopulatedPlace</th>\n",
       "      <td>151</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:Athlete</th>\n",
       "      <td>94</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:Settlement</th>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                    cnt\n",
       "s                      \n",
       "dbo:Person          253\n",
       "dbo:Place           183\n",
       "dbo:PopulatedPlace  151\n",
       "dbo:Athlete          94\n",
       "dbo:Settlement       56"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 300 ms\n"
     ]
    }
   ],
   "source": [
    "g.bind(\"dbo\",\"http://dbpedia.org/ontology/\")\n",
    "e=LocalEndpoint(g)\n",
    "types=e.select(\"\"\"\n",
    "   SELECT ?s (COUNT(*) AS ?cnt) {\n",
    "      ?s a owl:Class .\n",
    "      ?p rdfs:domain ?s .\n",
    "   } GROUP BY ?s ORDER BY DESC(?cnt) LIMIT 5\n",
    "\"\"\")\n",
    "types.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Common properties for People\n",
    "\n",
    "To survey some important properties that apply to a `dbo:Person` I need some estimate of importance.  I choose to count how many languages a property is labeled with as a proxy for importance -- after all,  if a property is broadly interesting,  it will be translated into many languages.  The result is pretty satisfying."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>p</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>dbo:birthDate</th>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:birthPlace</th>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Person/height</th>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>http://dbpedia.org/ontology/Person/weight</th>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:nationality</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:knownFor</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:eyeColor</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:birthName</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:deathDate</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:school</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:bloodType</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:deathPlace</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:residence</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:placeOfBurial</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:child</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:achievement</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:relative</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:college</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:hairColor</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:waistSize</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:parent</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:birthYear</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:spouse</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:deathYear</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:bustSize</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:sibling</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:education</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:university</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:tattoo</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:hipSize</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           cnt\n",
       "p                                             \n",
       "dbo:birthDate                               10\n",
       "dbo:birthPlace                               9\n",
       "http://dbpedia.org/ontology/Person/height    8\n",
       "http://dbpedia.org/ontology/Person/weight    8\n",
       "dbo:nationality                              7\n",
       "dbo:knownFor                                 7\n",
       "dbo:eyeColor                                 6\n",
       "dbo:birthName                                6\n",
       "dbo:deathDate                                6\n",
       "dbo:school                                   6\n",
       "dbo:bloodType                                6\n",
       "dbo:deathPlace                               6\n",
       "dbo:residence                                6\n",
       "dbo:placeOfBurial                            6\n",
       "dbo:child                                    6\n",
       "dbo:achievement                              6\n",
       "dbo:relative                                 5\n",
       "dbo:college                                  5\n",
       "dbo:hairColor                                5\n",
       "dbo:waistSize                                5\n",
       "dbo:parent                                   5\n",
       "dbo:birthYear                                5\n",
       "dbo:spouse                                   5\n",
       "dbo:deathYear                                5\n",
       "dbo:bustSize                                 5\n",
       "dbo:sibling                                  5\n",
       "dbo:education                                5\n",
       "dbo:university                               5\n",
       "dbo:tattoo                                   4\n",
       "dbo:hipSize                                  4"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 176 ms\n"
     ]
    }
   ],
   "source": [
    "person_types=e.select(\"\"\"\n",
    "   SELECT ?p (COUNT(*) AS ?cnt) {\n",
    "       ?p rdfs:domain dbo:Person .\n",
    "       ?p rdfs:label ?l .\n",
    "   } GROUP BY ?p ORDER BY DESC(?cnt) LIMIT 30\n",
    "\"\"\")\n",
    "person_types"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To make something that looks like a real report,  I reach into my bag of tricks.\n",
    "\n",
    "Since the predicate URI contains an English name for the predicate,  I decide to show a label in German.  The `OPTIONAL` clause is essential so that we don't lose properties that don't have a German label (there is exactly one in the list below).  I use\n",
    "a subquery to compute the language count,  and then filter for properties that have more than one language."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "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>p</th>\n",
       "      <th>range</th>\n",
       "      <th>label</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:birthDate</td>\n",
       "      <td>xsd:date</td>\n",
       "      <td>Geburtsdatum</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:birthPlace</td>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>Geburtsort</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>http://dbpedia.org/ontology/Person/height</td>\n",
       "      <td>http://dbpedia.org/datatype/centimetre</td>\n",
       "      <td>Höhe (cm)</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>http://dbpedia.org/ontology/Person/weight</td>\n",
       "      <td>http://dbpedia.org/datatype/kilogram</td>\n",
       "      <td>Gewicht (kg)</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:nationality</td>\n",
       "      <td>dbo:Country</td>\n",
       "      <td>Nationalität</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:placeOfBurial</td>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>Ort der Bestattung</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:eyeColor</td>\n",
       "      <td>xsd:string</td>\n",
       "      <td>Augenfarbe</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:child</td>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>Kind</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:deathDate</td>\n",
       "      <td>xsd:date</td>\n",
       "      <td>Sterbedatum</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:deathPlace</td>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>Sterbeort</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:school</td>\n",
       "      <td>dbo:EducationalInstitution</td>\n",
       "      <td>schule</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:residence</td>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>Residenz</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:birthName</td>\n",
       "      <td>rdf:langString</td>\n",
       "      <td>Geburtsname</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:parent</td>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>Elternteil</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:bustSize</td>\n",
       "      <td>xsd:double</td>\n",
       "      <td>None</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:university</td>\n",
       "      <td>dbo:EducationalInstitution</td>\n",
       "      <td>Universität</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:birthYear</td>\n",
       "      <td>xsd:gYear</td>\n",
       "      <td>Geburtsjahr</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:relative</td>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>Verwandter</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:hairColor</td>\n",
       "      <td>xsd:string</td>\n",
       "      <td>Haarfarbe</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:waistSize</td>\n",
       "      <td>xsd:double</td>\n",
       "      <td>Taillenumfang (μ)</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:spouse</td>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>Ehepartner</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>dbo:deathYear</td>\n",
       "      <td>xsd:gYear</td>\n",
       "      <td>Sterbejahr</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>dbo:sibling</td>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>Geschwister</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>dbo:college</td>\n",
       "      <td>dbo:EducationalInstitution</td>\n",
       "      <td>College</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                            p                                   range  \\\n",
       "0                               dbo:birthDate                                xsd:date   \n",
       "1                              dbo:birthPlace                               dbo:Place   \n",
       "2   http://dbpedia.org/ontology/Person/height  http://dbpedia.org/datatype/centimetre   \n",
       "3   http://dbpedia.org/ontology/Person/weight    http://dbpedia.org/datatype/kilogram   \n",
       "4                             dbo:nationality                             dbo:Country   \n",
       "5                           dbo:placeOfBurial                               dbo:Place   \n",
       "6                                dbo:eyeColor                              xsd:string   \n",
       "7                                   dbo:child                              dbo:Person   \n",
       "8                               dbo:deathDate                                xsd:date   \n",
       "9                              dbo:deathPlace                               dbo:Place   \n",
       "10                                 dbo:school              dbo:EducationalInstitution   \n",
       "11                              dbo:residence                               dbo:Place   \n",
       "12                              dbo:birthName                          rdf:langString   \n",
       "13                                 dbo:parent                              dbo:Person   \n",
       "14                               dbo:bustSize                              xsd:double   \n",
       "15                             dbo:university              dbo:EducationalInstitution   \n",
       "16                              dbo:birthYear                               xsd:gYear   \n",
       "17                               dbo:relative                              dbo:Person   \n",
       "18                              dbo:hairColor                              xsd:string   \n",
       "19                              dbo:waistSize                              xsd:double   \n",
       "20                                 dbo:spouse                              dbo:Person   \n",
       "21                              dbo:deathYear                               xsd:gYear   \n",
       "22                                dbo:sibling                              dbo:Person   \n",
       "23                                dbo:college              dbo:EducationalInstitution   \n",
       "\n",
       "                 label  cnt  \n",
       "0         Geburtsdatum   10  \n",
       "1           Geburtsort    9  \n",
       "2            Höhe (cm)    8  \n",
       "3         Gewicht (kg)    8  \n",
       "4         Nationalität    7  \n",
       "5   Ort der Bestattung    6  \n",
       "6           Augenfarbe    6  \n",
       "7                 Kind    6  \n",
       "8          Sterbedatum    6  \n",
       "9            Sterbeort    6  \n",
       "10              schule    6  \n",
       "11            Residenz    6  \n",
       "12         Geburtsname    6  \n",
       "13          Elternteil    5  \n",
       "14                None    5  \n",
       "15         Universität    5  \n",
       "16         Geburtsjahr    5  \n",
       "17          Verwandter    5  \n",
       "18           Haarfarbe    5  \n",
       "19   Taillenumfang (μ)    5  \n",
       "20          Ehepartner    5  \n",
       "21          Sterbejahr    5  \n",
       "22         Geschwister    5  \n",
       "23             College    5  "
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 3.06 s\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?p ?range ?label ?cnt {\n",
    "        ?p rdfs:range ?range .\n",
    "        OPTIONAL { \n",
    "            ?p rdfs:label ?label .\n",
    "             FILTER(LANG(?label)='de')\n",
    "        }\n",
    "        {\n",
    "           SELECT ?p (COUNT(*) AS ?cnt) {\n",
    "               ?p rdfs:domain dbo:Person .\n",
    "               ?p rdfs:label ?l .\n",
    "           } GROUP BY ?p ORDER BY DESC(?cnt)\n",
    "        }\n",
    "       FILTER(?cnt>4)\n",
    "   } ORDER BY DESC(?cnt)\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Towards a simple schema browser\n",
    "\n",
    "You'd probably agree with me that the query above is getting to be a bit much,  but now that I have it,  I can bake it into a function which makes it easy to ask questions of the schema.  The following query lets us make a similar report for any class and any language.  (I use the German word for 'class' because the English word class and the synonymous word type are both reserved words in Python.)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 4.5 ms\n"
     ]
    }
   ],
   "source": [
    "def top_properties(klasse='dbo:Person',lang='de',threshold=4):\n",
    "    klasse=QName(klasse)\n",
    "    df=e.select(\"\"\"\n",
    "       SELECT ?p ?range ?label ?cnt {\n",
    "            ?p rdfs:range ?range .\n",
    "            OPTIONAL { \n",
    "                ?p rdfs:label ?label .\n",
    "                 FILTER(LANG(?label)=?_lang)\n",
    "            }\n",
    "            {\n",
    "               SELECT ?p (COUNT(*) AS ?cnt) {\n",
    "                   ?p rdfs:domain ?_klasse .\n",
    "                   ?p rdfs:label ?l .\n",
    "               } GROUP BY ?p ORDER BY DESC(?cnt)\n",
    "            }\n",
    "           FILTER(?cnt>?_threshold)\n",
    "       } ORDER BY DESC(?cnt)\n",
    "    \"\"\")\n",
    "    return df.style.highlight_null(null_color='red')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note that the `select` here can see variables in the immediately enclosing scope,  that is,  the function definition.  As it is inside a function definition,  it does not see variables defined in the Jupyter notebook.  The [handling of missing values](http://pandas.pydata.org/pandas-docs/stable/missing_data.html#) is a big topic in Pandas,  so I take the liberty of highlighting the label that is missing in German."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow14_col2 {\n",
       "            background-color:  red;\n",
       "        }</style>  \n",
       "<table id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fb\" > \n",
       "<thead>    <tr> \n",
       "        <th class=\"blank level0\" ></th> \n",
       "        <th class=\"col_heading level0 col0\" >p</th> \n",
       "        <th class=\"col_heading level0 col1\" >range</th> \n",
       "        <th class=\"col_heading level0 col2\" >label</th> \n",
       "        <th class=\"col_heading level0 col3\" >cnt</th> \n",
       "    </tr></thead> \n",
       "<tbody>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row0\" class=\"row_heading level0 row0\" >0</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow0_col0\" class=\"data row0 col0\" >dbo:birthDate</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow0_col1\" class=\"data row0 col1\" >xsd:date</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow0_col2\" class=\"data row0 col2\" >Geburtsdatum</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow0_col3\" class=\"data row0 col3\" >10</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row1\" class=\"row_heading level0 row1\" >1</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow1_col0\" class=\"data row1 col0\" >dbo:birthPlace</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow1_col1\" class=\"data row1 col1\" >dbo:Place</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow1_col2\" class=\"data row1 col2\" >Geburtsort</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow1_col3\" class=\"data row1 col3\" >9</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row2\" class=\"row_heading level0 row2\" >2</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow2_col0\" class=\"data row2 col0\" >http://dbpedia.org/ontology/Person/height</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow2_col1\" class=\"data row2 col1\" >http://dbpedia.org/datatype/centimetre</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow2_col2\" class=\"data row2 col2\" >Höhe (cm)</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow2_col3\" class=\"data row2 col3\" >8</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row3\" class=\"row_heading level0 row3\" >3</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow3_col0\" class=\"data row3 col0\" >http://dbpedia.org/ontology/Person/weight</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow3_col1\" class=\"data row3 col1\" >http://dbpedia.org/datatype/kilogram</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow3_col2\" class=\"data row3 col2\" >Gewicht (kg)</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow3_col3\" class=\"data row3 col3\" >8</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row4\" class=\"row_heading level0 row4\" >4</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow4_col0\" class=\"data row4 col0\" >dbo:nationality</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow4_col1\" class=\"data row4 col1\" >dbo:Country</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow4_col2\" class=\"data row4 col2\" >Nationalität</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow4_col3\" class=\"data row4 col3\" >7</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row5\" class=\"row_heading level0 row5\" >5</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow5_col0\" class=\"data row5 col0\" >dbo:placeOfBurial</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow5_col1\" class=\"data row5 col1\" >dbo:Place</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow5_col2\" class=\"data row5 col2\" >Ort der Bestattung</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow5_col3\" class=\"data row5 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row6\" class=\"row_heading level0 row6\" >6</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow6_col0\" class=\"data row6 col0\" >dbo:eyeColor</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow6_col1\" class=\"data row6 col1\" >xsd:string</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow6_col2\" class=\"data row6 col2\" >Augenfarbe</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow6_col3\" class=\"data row6 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row7\" class=\"row_heading level0 row7\" >7</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow7_col0\" class=\"data row7 col0\" >dbo:child</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow7_col1\" class=\"data row7 col1\" >dbo:Person</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow7_col2\" class=\"data row7 col2\" >Kind</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow7_col3\" class=\"data row7 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row8\" class=\"row_heading level0 row8\" >8</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow8_col0\" class=\"data row8 col0\" >dbo:deathDate</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow8_col1\" class=\"data row8 col1\" >xsd:date</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow8_col2\" class=\"data row8 col2\" >Sterbedatum</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow8_col3\" class=\"data row8 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row9\" class=\"row_heading level0 row9\" >9</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow9_col0\" class=\"data row9 col0\" >dbo:deathPlace</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow9_col1\" class=\"data row9 col1\" >dbo:Place</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow9_col2\" class=\"data row9 col2\" >Sterbeort</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow9_col3\" class=\"data row9 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row10\" class=\"row_heading level0 row10\" >10</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow10_col0\" class=\"data row10 col0\" >dbo:school</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow10_col1\" class=\"data row10 col1\" >dbo:EducationalInstitution</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow10_col2\" class=\"data row10 col2\" >schule</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow10_col3\" class=\"data row10 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row11\" class=\"row_heading level0 row11\" >11</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow11_col0\" class=\"data row11 col0\" >dbo:residence</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow11_col1\" class=\"data row11 col1\" >dbo:Place</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow11_col2\" class=\"data row11 col2\" >Residenz</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow11_col3\" class=\"data row11 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row12\" class=\"row_heading level0 row12\" >12</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow12_col0\" class=\"data row12 col0\" >dbo:birthName</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow12_col1\" class=\"data row12 col1\" >rdf:langString</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow12_col2\" class=\"data row12 col2\" >Geburtsname</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow12_col3\" class=\"data row12 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row13\" class=\"row_heading level0 row13\" >13</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow13_col0\" class=\"data row13 col0\" >dbo:parent</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow13_col1\" class=\"data row13 col1\" >dbo:Person</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow13_col2\" class=\"data row13 col2\" >Elternteil</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow13_col3\" class=\"data row13 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row14\" class=\"row_heading level0 row14\" >14</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow14_col0\" class=\"data row14 col0\" >dbo:bustSize</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow14_col1\" class=\"data row14 col1\" >xsd:double</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow14_col2\" class=\"data row14 col2\" >None</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow14_col3\" class=\"data row14 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row15\" class=\"row_heading level0 row15\" >15</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow15_col0\" class=\"data row15 col0\" >dbo:university</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow15_col1\" class=\"data row15 col1\" >dbo:EducationalInstitution</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow15_col2\" class=\"data row15 col2\" >Universität</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow15_col3\" class=\"data row15 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row16\" class=\"row_heading level0 row16\" >16</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow16_col0\" class=\"data row16 col0\" >dbo:birthYear</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow16_col1\" class=\"data row16 col1\" >xsd:gYear</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow16_col2\" class=\"data row16 col2\" >Geburtsjahr</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow16_col3\" class=\"data row16 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row17\" class=\"row_heading level0 row17\" >17</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow17_col0\" class=\"data row17 col0\" >dbo:relative</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow17_col1\" class=\"data row17 col1\" >dbo:Person</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow17_col2\" class=\"data row17 col2\" >Verwandter</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow17_col3\" class=\"data row17 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row18\" class=\"row_heading level0 row18\" >18</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow18_col0\" class=\"data row18 col0\" >dbo:hairColor</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow18_col1\" class=\"data row18 col1\" >xsd:string</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow18_col2\" class=\"data row18 col2\" >Haarfarbe</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow18_col3\" class=\"data row18 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row19\" class=\"row_heading level0 row19\" >19</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow19_col0\" class=\"data row19 col0\" >dbo:waistSize</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow19_col1\" class=\"data row19 col1\" >xsd:double</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow19_col2\" class=\"data row19 col2\" >Taillenumfang (μ)</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow19_col3\" class=\"data row19 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row20\" class=\"row_heading level0 row20\" >20</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow20_col0\" class=\"data row20 col0\" >dbo:spouse</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow20_col1\" class=\"data row20 col1\" >dbo:Person</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow20_col2\" class=\"data row20 col2\" >Ehepartner</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow20_col3\" class=\"data row20 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row21\" class=\"row_heading level0 row21\" >21</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow21_col0\" class=\"data row21 col0\" >dbo:deathYear</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow21_col1\" class=\"data row21 col1\" >xsd:gYear</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow21_col2\" class=\"data row21 col2\" >Sterbejahr</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow21_col3\" class=\"data row21 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row22\" class=\"row_heading level0 row22\" >22</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow22_col0\" class=\"data row22 col0\" >dbo:sibling</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow22_col1\" class=\"data row22 col1\" >dbo:Person</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow22_col2\" class=\"data row22 col2\" >Geschwister</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow22_col3\" class=\"data row22 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fblevel0_row23\" class=\"row_heading level0 row23\" >23</th> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow23_col0\" class=\"data row23 col0\" >dbo:college</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow23_col1\" class=\"data row23 col1\" >dbo:EducationalInstitution</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow23_col2\" class=\"data row23 col2\" >College</td> \n",
       "        <td id=\"T_a107cb78_d525_11e7_bb61_f0def1f1c2fbrow23_col3\" class=\"data row23 col3\" >5</td> \n",
       "    </tr></tbody> \n",
       "</table> "
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x2b5e445b208>"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 3.39 s\n"
     ]
    }
   ],
   "source": [
    "top_properties()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In Japanese,  a different set of labels is missing.  It's nice to see that Unicode characters outside the `latin-1` codepage work just fine."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow5_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow6_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow10_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow12_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow18_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow23_col2 {\n",
       "            background-color:  red;\n",
       "        }</style>  \n",
       "<table id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fb\" > \n",
       "<thead>    <tr> \n",
       "        <th class=\"blank level0\" ></th> \n",
       "        <th class=\"col_heading level0 col0\" >p</th> \n",
       "        <th class=\"col_heading level0 col1\" >range</th> \n",
       "        <th class=\"col_heading level0 col2\" >label</th> \n",
       "        <th class=\"col_heading level0 col3\" >cnt</th> \n",
       "    </tr></thead> \n",
       "<tbody>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row0\" class=\"row_heading level0 row0\" >0</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow0_col0\" class=\"data row0 col0\" >dbo:birthDate</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow0_col1\" class=\"data row0 col1\" >xsd:date</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow0_col2\" class=\"data row0 col2\" >生年月日</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow0_col3\" class=\"data row0 col3\" >10</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row1\" class=\"row_heading level0 row1\" >1</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow1_col0\" class=\"data row1 col0\" >dbo:birthPlace</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow1_col1\" class=\"data row1 col1\" >dbo:Place</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow1_col2\" class=\"data row1 col2\" >生地</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow1_col3\" class=\"data row1 col3\" >9</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row2\" class=\"row_heading level0 row2\" >2</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow2_col0\" class=\"data row2 col0\" >http://dbpedia.org/ontology/Person/height</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow2_col1\" class=\"data row2 col1\" >http://dbpedia.org/datatype/centimetre</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow2_col2\" class=\"data row2 col2\" >身長 (cm)</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow2_col3\" class=\"data row2 col3\" >8</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row3\" class=\"row_heading level0 row3\" >3</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow3_col0\" class=\"data row3 col0\" >http://dbpedia.org/ontology/Person/weight</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow3_col1\" class=\"data row3 col1\" >http://dbpedia.org/datatype/kilogram</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow3_col2\" class=\"data row3 col2\" >体重 (kg)</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow3_col3\" class=\"data row3 col3\" >8</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row4\" class=\"row_heading level0 row4\" >4</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow4_col0\" class=\"data row4 col0\" >dbo:nationality</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow4_col1\" class=\"data row4 col1\" >dbo:Country</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow4_col2\" class=\"data row4 col2\" >国籍</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow4_col3\" class=\"data row4 col3\" >7</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row5\" class=\"row_heading level0 row5\" >5</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow5_col0\" class=\"data row5 col0\" >dbo:placeOfBurial</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow5_col1\" class=\"data row5 col1\" >dbo:Place</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow5_col2\" class=\"data row5 col2\" >None</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow5_col3\" class=\"data row5 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row6\" class=\"row_heading level0 row6\" >6</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow6_col0\" class=\"data row6 col0\" >dbo:eyeColor</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow6_col1\" class=\"data row6 col1\" >xsd:string</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow6_col2\" class=\"data row6 col2\" >None</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow6_col3\" class=\"data row6 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row7\" class=\"row_heading level0 row7\" >7</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow7_col0\" class=\"data row7 col0\" >dbo:child</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow7_col1\" class=\"data row7 col1\" >dbo:Person</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow7_col2\" class=\"data row7 col2\" >子供</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow7_col3\" class=\"data row7 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row8\" class=\"row_heading level0 row8\" >8</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow8_col0\" class=\"data row8 col0\" >dbo:deathDate</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow8_col1\" class=\"data row8 col1\" >xsd:date</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow8_col2\" class=\"data row8 col2\" >没年月日</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow8_col3\" class=\"data row8 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row9\" class=\"row_heading level0 row9\" >9</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow9_col0\" class=\"data row9 col0\" >dbo:deathPlace</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow9_col1\" class=\"data row9 col1\" >dbo:Place</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow9_col2\" class=\"data row9 col2\" >死没地</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow9_col3\" class=\"data row9 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row10\" class=\"row_heading level0 row10\" >10</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow10_col0\" class=\"data row10 col0\" >dbo:school</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow10_col1\" class=\"data row10 col1\" >dbo:EducationalInstitution</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow10_col2\" class=\"data row10 col2\" >None</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow10_col3\" class=\"data row10 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row11\" class=\"row_heading level0 row11\" >11</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow11_col0\" class=\"data row11 col0\" >dbo:residence</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow11_col1\" class=\"data row11 col1\" >dbo:Place</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow11_col2\" class=\"data row11 col2\" >居住地</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow11_col3\" class=\"data row11 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row12\" class=\"row_heading level0 row12\" >12</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow12_col0\" class=\"data row12 col0\" >dbo:birthName</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow12_col1\" class=\"data row12 col1\" >rdf:langString</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow12_col2\" class=\"data row12 col2\" >None</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow12_col3\" class=\"data row12 col3\" >6</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row13\" class=\"row_heading level0 row13\" >13</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow13_col0\" class=\"data row13 col0\" >dbo:parent</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow13_col1\" class=\"data row13 col1\" >dbo:Person</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow13_col2\" class=\"data row13 col2\" >親</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow13_col3\" class=\"data row13 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row14\" class=\"row_heading level0 row14\" >14</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow14_col0\" class=\"data row14 col0\" >dbo:bustSize</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow14_col1\" class=\"data row14 col1\" >xsd:double</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow14_col2\" class=\"data row14 col2\" >バスト (μ)</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow14_col3\" class=\"data row14 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row15\" class=\"row_heading level0 row15\" >15</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow15_col0\" class=\"data row15 col0\" >dbo:university</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow15_col1\" class=\"data row15 col1\" >dbo:EducationalInstitution</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow15_col2\" class=\"data row15 col2\" >大学</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow15_col3\" class=\"data row15 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row16\" class=\"row_heading level0 row16\" >16</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow16_col0\" class=\"data row16 col0\" >dbo:birthYear</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow16_col1\" class=\"data row16 col1\" >xsd:gYear</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow16_col2\" class=\"data row16 col2\" >生年</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow16_col3\" class=\"data row16 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row17\" class=\"row_heading level0 row17\" >17</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow17_col0\" class=\"data row17 col0\" >dbo:relative</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow17_col1\" class=\"data row17 col1\" >dbo:Person</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow17_col2\" class=\"data row17 col2\" >親戚</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow17_col3\" class=\"data row17 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row18\" class=\"row_heading level0 row18\" >18</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow18_col0\" class=\"data row18 col0\" >dbo:hairColor</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow18_col1\" class=\"data row18 col1\" >xsd:string</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow18_col2\" class=\"data row18 col2\" >None</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow18_col3\" class=\"data row18 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row19\" class=\"row_heading level0 row19\" >19</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow19_col0\" class=\"data row19 col0\" >dbo:waistSize</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow19_col1\" class=\"data row19 col1\" >xsd:double</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow19_col2\" class=\"data row19 col2\" >ウエスト (μ)</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow19_col3\" class=\"data row19 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row20\" class=\"row_heading level0 row20\" >20</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow20_col0\" class=\"data row20 col0\" >dbo:spouse</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow20_col1\" class=\"data row20 col1\" >dbo:Person</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow20_col2\" class=\"data row20 col2\" >配偶者</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow20_col3\" class=\"data row20 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row21\" class=\"row_heading level0 row21\" >21</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow21_col0\" class=\"data row21 col0\" >dbo:deathYear</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow21_col1\" class=\"data row21 col1\" >xsd:gYear</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow21_col2\" class=\"data row21 col2\" >没年</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow21_col3\" class=\"data row21 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row22\" class=\"row_heading level0 row22\" >22</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow22_col0\" class=\"data row22 col0\" >dbo:sibling</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow22_col1\" class=\"data row22 col1\" >dbo:Person</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow22_col2\" class=\"data row22 col2\" >兄弟</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow22_col3\" class=\"data row22 col3\" >5</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fblevel0_row23\" class=\"row_heading level0 row23\" >23</th> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow23_col0\" class=\"data row23 col0\" >dbo:college</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow23_col1\" class=\"data row23 col1\" >dbo:EducationalInstitution</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow23_col2\" class=\"data row23 col2\" >None</td> \n",
       "        <td id=\"T_a32a32a8_d525_11e7_9e55_f0def1f1c2fbrow23_col3\" class=\"data row23 col3\" >5</td> \n",
       "    </tr></tbody> \n",
       "</table> "
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x2b5e4514278>"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 3.57 s\n"
     ]
    }
   ],
   "source": [
    "top_properties(lang='ja')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And of course it can be fun to look at other classes and languages:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow1_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow2_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow3_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow5_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow6_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow7_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow8_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow9_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow10_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow11_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow12_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow13_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow14_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow15_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow16_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow17_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow18_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow19_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow20_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow21_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow22_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow23_col2 {\n",
       "            background-color:  red;\n",
       "        }    #T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow24_col2 {\n",
       "            background-color:  red;\n",
       "        }</style>  \n",
       "<table id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fb\" > \n",
       "<thead>    <tr> \n",
       "        <th class=\"blank level0\" ></th> \n",
       "        <th class=\"col_heading level0 col0\" >p</th> \n",
       "        <th class=\"col_heading level0 col1\" >range</th> \n",
       "        <th class=\"col_heading level0 col2\" >label</th> \n",
       "        <th class=\"col_heading level0 col3\" >cnt</th> \n",
       "    </tr></thead> \n",
       "<tbody>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row0\" class=\"row_heading level0 row0\" >0</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow0_col0\" class=\"data row0 col0\" >dbo:spacecraft</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow0_col1\" class=\"data row0 col1\" >dbo:Spacecraft</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow0_col2\" class=\"data row0 col2\" >véhicule spatial</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow0_col3\" class=\"data row0 col3\" >4</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row1\" class=\"row_heading level0 row1\" >1</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow1_col0\" class=\"data row1 col0\" >http://dbpedia.org/ontology/SpaceMission/distanceTraveled</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow1_col1\" class=\"data row1 col1\" >http://dbpedia.org/datatype/kilometre</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow1_col2\" class=\"data row1 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow1_col3\" class=\"data row1 col3\" >3</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row2\" class=\"row_heading level0 row2\" >2</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow2_col0\" class=\"data row2 col0\" >http://dbpedia.org/ontology/SpaceMission/mass</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow2_col1\" class=\"data row2 col1\" >http://dbpedia.org/datatype/kilogram</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow2_col2\" class=\"data row2 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow2_col3\" class=\"data row2 col3\" >3</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row3\" class=\"row_heading level0 row3\" >3</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow3_col0\" class=\"data row3 col0\" >dbo:distanceTraveled</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow3_col1\" class=\"data row3 col1\" >xsd:double</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow3_col2\" class=\"data row3 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow3_col3\" class=\"data row3 col3\" >3</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row4\" class=\"row_heading level0 row4\" >4</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow4_col0\" class=\"data row4 col0\" >dbo:nextMission</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow4_col1\" class=\"data row4 col1\" >dbo:SpaceMission</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow4_col2\" class=\"data row4 col2\" >mision siguiente</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow4_col3\" class=\"data row4 col3\" >3</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row5\" class=\"row_heading level0 row5\" >5</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow5_col0\" class=\"data row5 col0\" >dbo:landingSite</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow5_col1\" class=\"data row5 col1\" >xsd:string</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow5_col2\" class=\"data row5 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow5_col3\" class=\"data row5 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row6\" class=\"row_heading level0 row6\" >6</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow6_col0\" class=\"data row6 col0\" >dbo:landingDate</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow6_col1\" class=\"data row6 col1\" >xsd:date</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow6_col2\" class=\"data row6 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow6_col3\" class=\"data row6 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row7\" class=\"row_heading level0 row7\" >7</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow7_col0\" class=\"data row7 col0\" >dbo:missionDuration</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow7_col1\" class=\"data row7 col1\" >xsd:double</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow7_col2\" class=\"data row7 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow7_col3\" class=\"data row7 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row8\" class=\"row_heading level0 row8\" >8</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow8_col0\" class=\"data row8 col0\" >dbo:launchDate</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow8_col1\" class=\"data row8 col1\" >xsd:date</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow8_col2\" class=\"data row8 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow8_col3\" class=\"data row8 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row9\" class=\"row_heading level0 row9\" >9</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow9_col0\" class=\"data row9 col0\" >dbo:crewMember</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow9_col1\" class=\"data row9 col1\" >dbo:Astronaut</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow9_col2\" class=\"data row9 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow9_col3\" class=\"data row9 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row10\" class=\"row_heading level0 row10\" >10</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow10_col0\" class=\"data row10 col0\" >dbo:spacewalkBegin</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow10_col1\" class=\"data row10 col1\" >xsd:date</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow10_col2\" class=\"data row10 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow10_col3\" class=\"data row10 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row11\" class=\"row_heading level0 row11\" >11</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow11_col0\" class=\"data row11 col0\" >dbo:crewSize</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow11_col1\" class=\"data row11 col1\" >xsd:nonNegativeInteger</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow11_col2\" class=\"data row11 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow11_col3\" class=\"data row11 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row12\" class=\"row_heading level0 row12\" >12</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow12_col0\" class=\"data row12 col0\" >http://dbpedia.org/ontology/SpaceMission/lunarOrbitTime</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow12_col1\" class=\"data row12 col1\" >http://dbpedia.org/datatype/hour</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow12_col2\" class=\"data row12 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow12_col3\" class=\"data row12 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row13\" class=\"row_heading level0 row13\" >13</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow13_col0\" class=\"data row13 col0\" >dbo:launchPad</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow13_col1\" class=\"data row13 col1\" >dbo:LaunchPad</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow13_col2\" class=\"data row13 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow13_col3\" class=\"data row13 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row14\" class=\"row_heading level0 row14\" >14</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow14_col0\" class=\"data row14 col0\" >dbo:lunarRover</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow14_col1\" class=\"data row14 col1\" >dbo:MeanOfTransportation</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow14_col2\" class=\"data row14 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow14_col3\" class=\"data row14 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row15\" class=\"row_heading level0 row15\" >15</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow15_col0\" class=\"data row15 col0\" >dbo:lunarOrbitTime</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow15_col1\" class=\"data row15 col1\" >xsd:double</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow15_col2\" class=\"data row15 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow15_col3\" class=\"data row15 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row16\" class=\"row_heading level0 row16\" >16</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow16_col0\" class=\"data row16 col0\" >dbo:booster</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow16_col1\" class=\"data row16 col1\" >dbo:Rocket</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow16_col2\" class=\"data row16 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow16_col3\" class=\"data row16 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row17\" class=\"row_heading level0 row17\" >17</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow17_col0\" class=\"data row17 col0\" >dbo:previousMission</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow17_col1\" class=\"data row17 col1\" >dbo:SpaceMission</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow17_col2\" class=\"data row17 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow17_col3\" class=\"data row17 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row18\" class=\"row_heading level0 row18\" >18</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow18_col0\" class=\"data row18 col0\" >dbo:numberOfOrbits</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow18_col1\" class=\"data row18 col1\" >xsd:nonNegativeInteger</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow18_col2\" class=\"data row18 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow18_col3\" class=\"data row18 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row19\" class=\"row_heading level0 row19\" >19</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow19_col0\" class=\"data row19 col0\" >dbo:lunarModule</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow19_col1\" class=\"data row19 col1\" >xsd:string</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow19_col2\" class=\"data row19 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow19_col3\" class=\"data row19 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row20\" class=\"row_heading level0 row20\" >20</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow20_col0\" class=\"data row20 col0\" >dbo:orbitalInclination</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow20_col1\" class=\"data row20 col1\" >xsd:float</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow20_col2\" class=\"data row20 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow20_col3\" class=\"data row20 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row21\" class=\"row_heading level0 row21\" >21</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow21_col0\" class=\"data row21 col0\" >http://dbpedia.org/ontology/SpaceMission/missionDuration</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow21_col1\" class=\"data row21 col1\" >http://dbpedia.org/datatype/day</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow21_col2\" class=\"data row21 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow21_col3\" class=\"data row21 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row22\" class=\"row_heading level0 row22\" >22</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow22_col0\" class=\"data row22 col0\" >dbo:spacestation</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow22_col1\" class=\"data row22 col1\" >dbo:SpaceStation</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow22_col2\" class=\"data row22 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow22_col3\" class=\"data row22 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row23\" class=\"row_heading level0 row23\" >23</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow23_col0\" class=\"data row23 col0\" >dbo:spacewalkEnd</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow23_col1\" class=\"data row23 col1\" >xsd:date</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow23_col2\" class=\"data row23 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow23_col3\" class=\"data row23 col3\" >2</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fblevel0_row24\" class=\"row_heading level0 row24\" >24</th> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow24_col0\" class=\"data row24 col0\" >dbo:launchSite</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow24_col1\" class=\"data row24 col1\" >dbo:Building</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow24_col2\" class=\"data row24 col2\" >None</td> \n",
       "        <td id=\"T_a5350006_d525_11e7_85f9_f0def1f1c2fbrow24_col3\" class=\"data row24 col3\" >2</td> \n",
       "    </tr></tbody> \n",
       "</table> "
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x2b5e4653b38>"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 3.42 s\n"
     ]
    }
   ],
   "source": [
    "top_properties('dbo:SpaceMission',lang='fr',threshold=1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## About \"prov:wasDerivedFrom\"\n",
    "\n",
    "The `prov:wasDerivedFrom` property links properties and classes defined in the DBpedia Ontology to the places where they are defined on the mappings web site."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "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>s</th>\n",
       "      <th>o</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:perCapitaIncomeAsOf</td>\n",
       "      <td>http://mappings.dbpedia.org/index.php/OntologyProperty:perCapitaIncomeAsOf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:winterAppearances</td>\n",
       "      <td>http://mappings.dbpedia.org/index.php/OntologyProperty:winterAppearances</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:settingOfPlay</td>\n",
       "      <td>http://mappings.dbpedia.org/index.php/OntologyProperty:settingOfPlay</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:institution</td>\n",
       "      <td>http://mappings.dbpedia.org/index.php/OntologyProperty:institution</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:max</td>\n",
       "      <td>http://mappings.dbpedia.org/index.php/OntologyProperty:max</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:service</td>\n",
       "      <td>http://mappings.dbpedia.org/index.php/OntologyProperty:service</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:coolingSystem</td>\n",
       "      <td>http://mappings.dbpedia.org/index.php/OntologyProperty:coolingSystem</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:senator</td>\n",
       "      <td>http://mappings.dbpedia.org/index.php/OntologyProperty:senator</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:wikiPageModified</td>\n",
       "      <td>http://mappings.dbpedia.org/index.php/OntologyProperty:wikiPageModified</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:secondPlace</td>\n",
       "      <td>http://mappings.dbpedia.org/index.php/OntologyProperty:secondPlace</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                         s  \\\n",
       "0  dbo:perCapitaIncomeAsOf   \n",
       "1    dbo:winterAppearances   \n",
       "2        dbo:settingOfPlay   \n",
       "3          dbo:institution   \n",
       "4                  dbo:max   \n",
       "5              dbo:service   \n",
       "6        dbo:coolingSystem   \n",
       "7              dbo:senator   \n",
       "8     dbo:wikiPageModified   \n",
       "9          dbo:secondPlace   \n",
       "\n",
       "                                                                            o  \n",
       "0  http://mappings.dbpedia.org/index.php/OntologyProperty:perCapitaIncomeAsOf  \n",
       "1    http://mappings.dbpedia.org/index.php/OntologyProperty:winterAppearances  \n",
       "2        http://mappings.dbpedia.org/index.php/OntologyProperty:settingOfPlay  \n",
       "3          http://mappings.dbpedia.org/index.php/OntologyProperty:institution  \n",
       "4                  http://mappings.dbpedia.org/index.php/OntologyProperty:max  \n",
       "5              http://mappings.dbpedia.org/index.php/OntologyProperty:service  \n",
       "6        http://mappings.dbpedia.org/index.php/OntologyProperty:coolingSystem  \n",
       "7              http://mappings.dbpedia.org/index.php/OntologyProperty:senator  \n",
       "8     http://mappings.dbpedia.org/index.php/OntologyProperty:wikiPageModified  \n",
       "9          http://mappings.dbpedia.org/index.php/OntologyProperty:secondPlace  "
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 29 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?s ?o {\n",
    "       ?s prov:wasDerivedFrom ?o .\n",
    "    } LIMIT 10\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "rdflib.term.URIRef('http://mappings.dbpedia.org/index.php/OntologyProperty:perCapitaIncomeAsOf')"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 5.5 ms\n"
     ]
    }
   ],
   "source": [
    "_.at[0,'o']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Subclasses\n",
    "\n",
    "Subclasses can be queried with queries like the following,  which lists direct subtypes of `dbo:Person`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "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>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:TelevisionDirector</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:Model</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:Astronaut</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Scientist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:Lawyer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:Orphan</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:Ambassador</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:FictionalCharacter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:Religious</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:Archeologist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:BusinessPerson</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:Philosopher</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:Producer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:SportsManager</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:Cleric</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:TheatreDirector</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:MilitaryPerson</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:Engineer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:Monarch</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:Celebrity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:Chef</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>dbo:MemberResistanceMovement</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>dbo:Noble</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>dbo:Referee</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>dbo:BeautyQueen</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>dbo:Politician</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>dbo:Egyptologist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>dbo:Writer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>dbo:RomanEmperor</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>dbo:Judge</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>dbo:Artist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>dbo:OfficeHolder</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>dbo:Architect</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>dbo:Coach</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>dbo:PlayboyPlaymate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>dbo:PoliticianSpouse</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>dbo:Farmer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>dbo:OrganisationMember</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>dbo:Athlete</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>dbo:Journalist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>dbo:Economist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>dbo:Psychologist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>dbo:TelevisionPersonality</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>dbo:MovieDirector</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>dbo:Criminal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>dbo:Royalty</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>dbo:Presenter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>dbo:Linguist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>dbo:Aristocrat</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>dbo:HorseTrainer</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                            type\n",
       "0         dbo:TelevisionDirector\n",
       "1                      dbo:Model\n",
       "2                  dbo:Astronaut\n",
       "3                  dbo:Scientist\n",
       "4                     dbo:Lawyer\n",
       "5                     dbo:Orphan\n",
       "6                 dbo:Ambassador\n",
       "7         dbo:FictionalCharacter\n",
       "8                  dbo:Religious\n",
       "9               dbo:Archeologist\n",
       "10            dbo:BusinessPerson\n",
       "11               dbo:Philosopher\n",
       "12                  dbo:Producer\n",
       "13             dbo:SportsManager\n",
       "14                    dbo:Cleric\n",
       "15           dbo:TheatreDirector\n",
       "16            dbo:MilitaryPerson\n",
       "17                  dbo:Engineer\n",
       "18                   dbo:Monarch\n",
       "19                 dbo:Celebrity\n",
       "20                      dbo:Chef\n",
       "21  dbo:MemberResistanceMovement\n",
       "22                     dbo:Noble\n",
       "23                   dbo:Referee\n",
       "24               dbo:BeautyQueen\n",
       "25                dbo:Politician\n",
       "26              dbo:Egyptologist\n",
       "27                    dbo:Writer\n",
       "28              dbo:RomanEmperor\n",
       "29                     dbo:Judge\n",
       "30                    dbo:Artist\n",
       "31              dbo:OfficeHolder\n",
       "32                 dbo:Architect\n",
       "33                     dbo:Coach\n",
       "34           dbo:PlayboyPlaymate\n",
       "35          dbo:PoliticianSpouse\n",
       "36                    dbo:Farmer\n",
       "37        dbo:OrganisationMember\n",
       "38                   dbo:Athlete\n",
       "39                dbo:Journalist\n",
       "40                 dbo:Economist\n",
       "41              dbo:Psychologist\n",
       "42     dbo:TelevisionPersonality\n",
       "43             dbo:MovieDirector\n",
       "44                  dbo:Criminal\n",
       "45                   dbo:Royalty\n",
       "46                 dbo:Presenter\n",
       "47                  dbo:Linguist\n",
       "48                dbo:Aristocrat\n",
       "49              dbo:HorseTrainer"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 38 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?type {\n",
    "      ?type rdfs:subClassOf dbo:Person .\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "SPARQL 1.1 has property path operators that will make the query engine recurse through multiple `rdfs:subClassOf` property links."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "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>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:Person</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:TelevisionDirector</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:Model</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Astronaut</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:Scientist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:Medician</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:Entomologist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:Biologist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:Professor</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:Lawyer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:Orphan</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:Ambassador</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:FictionalCharacter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:ComicsCharacter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:AnimangaCharacter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:MythologicalFigure</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:DisneyCharacter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:SoapCharacter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:NarutoCharacter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:Religious</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:Archeologist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>dbo:BusinessPerson</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>dbo:Philosopher</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>dbo:Producer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>dbo:SportsManager</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>dbo:SoccerManager</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>dbo:Cleric</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>dbo:Vicar</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>dbo:ChristianPatriarch</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>dbo:Pope</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>154</th>\n",
       "      <td>dbo:Gymnast</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>155</th>\n",
       "      <td>dbo:Cricketer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>156</th>\n",
       "      <td>dbo:BadmintonPlayer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>157</th>\n",
       "      <td>dbo:SnookerPlayer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>158</th>\n",
       "      <td>dbo:SnookerChamp</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>159</th>\n",
       "      <td>dbo:Fencer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>160</th>\n",
       "      <td>dbo:Wrestler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>161</th>\n",
       "      <td>dbo:SumoWrestler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>162</th>\n",
       "      <td>dbo:TeamMember</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>163</th>\n",
       "      <td>dbo:Boxer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>164</th>\n",
       "      <td>dbo:AmateurBoxer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>dbo:NationalCollegiateAthleticAssociationAthlete</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>dbo:Journalist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>167</th>\n",
       "      <td>dbo:Economist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>168</th>\n",
       "      <td>dbo:Psychologist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>169</th>\n",
       "      <td>dbo:TelevisionPersonality</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>170</th>\n",
       "      <td>dbo:Host</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>dbo:MovieDirector</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>172</th>\n",
       "      <td>dbo:Criminal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>173</th>\n",
       "      <td>dbo:Murderer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>174</th>\n",
       "      <td>dbo:SerialKiller</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>175</th>\n",
       "      <td>dbo:Royalty</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>176</th>\n",
       "      <td>dbo:BritishRoyalty</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>dbo:Baronet</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>178</th>\n",
       "      <td>dbo:Presenter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>179</th>\n",
       "      <td>dbo:RadioHost</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>180</th>\n",
       "      <td>dbo:TelevisionHost</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>181</th>\n",
       "      <td>dbo:Linguist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>182</th>\n",
       "      <td>dbo:Aristocrat</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>183</th>\n",
       "      <td>dbo:HorseTrainer</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>184 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                 type\n",
       "0                                          dbo:Person\n",
       "1                              dbo:TelevisionDirector\n",
       "2                                           dbo:Model\n",
       "3                                       dbo:Astronaut\n",
       "4                                       dbo:Scientist\n",
       "5                                        dbo:Medician\n",
       "6                                    dbo:Entomologist\n",
       "7                                       dbo:Biologist\n",
       "8                                       dbo:Professor\n",
       "9                                          dbo:Lawyer\n",
       "10                                         dbo:Orphan\n",
       "11                                     dbo:Ambassador\n",
       "12                             dbo:FictionalCharacter\n",
       "13                                dbo:ComicsCharacter\n",
       "14                              dbo:AnimangaCharacter\n",
       "15                             dbo:MythologicalFigure\n",
       "16                                dbo:DisneyCharacter\n",
       "17                                  dbo:SoapCharacter\n",
       "18                                dbo:NarutoCharacter\n",
       "19                                      dbo:Religious\n",
       "20                                   dbo:Archeologist\n",
       "21                                 dbo:BusinessPerson\n",
       "22                                    dbo:Philosopher\n",
       "23                                       dbo:Producer\n",
       "24                                  dbo:SportsManager\n",
       "25                                  dbo:SoccerManager\n",
       "26                                         dbo:Cleric\n",
       "27                                          dbo:Vicar\n",
       "28                             dbo:ChristianPatriarch\n",
       "29                                           dbo:Pope\n",
       "..                                                ...\n",
       "154                                       dbo:Gymnast\n",
       "155                                     dbo:Cricketer\n",
       "156                               dbo:BadmintonPlayer\n",
       "157                                 dbo:SnookerPlayer\n",
       "158                                  dbo:SnookerChamp\n",
       "159                                        dbo:Fencer\n",
       "160                                      dbo:Wrestler\n",
       "161                                  dbo:SumoWrestler\n",
       "162                                    dbo:TeamMember\n",
       "163                                         dbo:Boxer\n",
       "164                                  dbo:AmateurBoxer\n",
       "165  dbo:NationalCollegiateAthleticAssociationAthlete\n",
       "166                                    dbo:Journalist\n",
       "167                                     dbo:Economist\n",
       "168                                  dbo:Psychologist\n",
       "169                         dbo:TelevisionPersonality\n",
       "170                                          dbo:Host\n",
       "171                                 dbo:MovieDirector\n",
       "172                                      dbo:Criminal\n",
       "173                                      dbo:Murderer\n",
       "174                                  dbo:SerialKiller\n",
       "175                                       dbo:Royalty\n",
       "176                                dbo:BritishRoyalty\n",
       "177                                       dbo:Baronet\n",
       "178                                     dbo:Presenter\n",
       "179                                     dbo:RadioHost\n",
       "180                                dbo:TelevisionHost\n",
       "181                                      dbo:Linguist\n",
       "182                                    dbo:Aristocrat\n",
       "183                                  dbo:HorseTrainer\n",
       "\n",
       "[184 rows x 1 columns]"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 56 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?type {\n",
    "      ?type rdfs:subClassOf* dbo:Person .\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The previous queries work \"down\" from a higher-level class,  but by putting a '^' before the property name,  I can reverse the direction of traversal,  to find all topics which `dbo:Painter` is a subclass of."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "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>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:Painter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:Artist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:Person</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Agent</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>owl:Thing</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          type\n",
       "0  dbo:Painter\n",
       "1   dbo:Artist\n",
       "2   dbo:Person\n",
       "3    dbo:Agent\n",
       "4    owl:Thing"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 28 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?type {\n",
    "      ?type ^rdfs:subClassOf* dbo:Painter .\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "scrolled": true
   },
   "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>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:Painter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:Artist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:Person</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Agent</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>owl:Thing</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          type\n",
       "0  dbo:Painter\n",
       "1   dbo:Artist\n",
       "2   dbo:Person\n",
       "3    dbo:Agent\n",
       "4    owl:Thing"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 22 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?type {\n",
    "      dbo:Painter rdfs:subClassOf* ?type .\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The same outcome can be had by switching the subject and object positions in the triple:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "scrolled": true
   },
   "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>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:City</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:Settlement</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Place</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>owl:Thing</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 type\n",
       "0            dbo:City\n",
       "1      dbo:Settlement\n",
       "2  dbo:PopulatedPlace\n",
       "3           dbo:Place\n",
       "4           owl:Thing"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 22.5 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?type {\n",
    "      dbo:City rdfs:subClassOf* ?type .\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Equivalent Classes\n",
    "\n",
    "The DBpedia Ontology uses `owl:equivalentClass` to specify equivalency between DBpedia Ontology types and types used in other popular systems such as wikidata and schema.org:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "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>a</th>\n",
       "      <th>b</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:PenaltyShootOut</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Event</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:RadioProgram</td>\n",
       "      <td>http://www.wikidata.org/entity/Q1555508</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:Guitarist</td>\n",
       "      <td>http://www.wikidata.org/entity/Q855091</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Presenter</td>\n",
       "      <td>http://www.wikidata.org/entity/Q13590141</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:HockeyTeam</td>\n",
       "      <td>http://www.wikidata.org/entity/Q4498974</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:Gene</td>\n",
       "      <td>http://www.wikidata.org/entity/Q7187</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:Manga</td>\n",
       "      <td>http://www.wikidata.org/entity/Q8274</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:Economist</td>\n",
       "      <td>http://www.wikidata.org/entity/Q188094</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:VicePresident</td>\n",
       "      <td>http://www.wikidata.org/entity/Q42178</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:Location</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     a                                                            b\n",
       "0  dbo:PenaltyShootOut  http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Event\n",
       "1     dbo:RadioProgram                      http://www.wikidata.org/entity/Q1555508\n",
       "2        dbo:Guitarist                       http://www.wikidata.org/entity/Q855091\n",
       "3        dbo:Presenter                     http://www.wikidata.org/entity/Q13590141\n",
       "4       dbo:HockeyTeam                      http://www.wikidata.org/entity/Q4498974\n",
       "5             dbo:Gene                         http://www.wikidata.org/entity/Q7187\n",
       "6            dbo:Manga                         http://www.wikidata.org/entity/Q8274\n",
       "7        dbo:Economist                       http://www.wikidata.org/entity/Q188094\n",
       "8    dbo:VicePresident                        http://www.wikidata.org/entity/Q42178\n",
       "9            dbo:Place                                                 dbo:Location"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 28 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?a ?b {\n",
    "    ?a owl:equivalentClass ?b .\n",
    "   } LIMIT 10\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here are all of the equivalencies between the DBpedia Ontology and [schema.org](http://schema.org/docs/schemas.html)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "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>a</th>\n",
       "      <th>b</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:Film</td>\n",
       "      <td>http://schema.org/Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:HistoricBuilding</td>\n",
       "      <td>http://schema.org/LandmarksOrHistoricalBuildings</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:SportsTeam</td>\n",
       "      <td>http://schema.org/SportsTeam</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Event</td>\n",
       "      <td>http://schema.org/Event</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:Locomotive</td>\n",
       "      <td>http://schema.org/Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:Park</td>\n",
       "      <td>http://schema.org/Park</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:Stadium</td>\n",
       "      <td>http://schema.org/StadiumOrArena</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:Painting</td>\n",
       "      <td>http://schema.org/Painting</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:Ship</td>\n",
       "      <td>http://schema.org/Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:Language</td>\n",
       "      <td>http://schema.org/Language</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:MusicFestival</td>\n",
       "      <td>http://schema.org/Festival</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:Book</td>\n",
       "      <td>http://schema.org/Book</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:Automobile</td>\n",
       "      <td>http://schema.org/Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:University</td>\n",
       "      <td>http://schema.org/CollegeOrUniversity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:ShoppingMall</td>\n",
       "      <td>http://schema.org/ShoppingCenter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:School</td>\n",
       "      <td>http://schema.org/School</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:River</td>\n",
       "      <td>http://schema.org/RiverBodyOfWater</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:Arena</td>\n",
       "      <td>http://schema.org/StadiumOrArena</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:AdministrativeRegion</td>\n",
       "      <td>http://schema.org/AdministrativeArea</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>http://schema.org/Person</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:City</td>\n",
       "      <td>http://schema.org/City</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>dbo:Song</td>\n",
       "      <td>http://schema.org/MusicRecording</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>dbo:Canal</td>\n",
       "      <td>http://schema.org/Canal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>dbo:SportsEvent</td>\n",
       "      <td>http://schema.org/SportsEvent</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>dbo:BodyOfWater</td>\n",
       "      <td>http://schema.org/BodyOfWater</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>dbo:MilitaryVehicle</td>\n",
       "      <td>http://schema.org/Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>dbo:Album</td>\n",
       "      <td>http://schema.org/MusicAlbum</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>dbo:Sculpture</td>\n",
       "      <td>http://schema.org/Sculpture</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>dbo:College</td>\n",
       "      <td>http://schema.org/CollegeOrUniversity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>dbo:Hospital</td>\n",
       "      <td>http://schema.org/Hospital</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>dbo:Hotel</td>\n",
       "      <td>http://schema.org/Hotel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>dbo:Airport</td>\n",
       "      <td>http://schema.org/Airport</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>dbo:RadioStation</td>\n",
       "      <td>http://schema.org/RadioStation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>dbo:HistoricPlace</td>\n",
       "      <td>http://schema.org/LandmarksOrHistoricalBuildings</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>dbo:EducationalInstitution</td>\n",
       "      <td>http://schema.org/EducationalOrganization</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>dbo:TelevisionEpisode</td>\n",
       "      <td>http://schema.org/TVEpisode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>dbo:TelevisionStation</td>\n",
       "      <td>http://schema.org/TelevisionStation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>dbo:Website</td>\n",
       "      <td>http://schema.org/WebPage</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>dbo:Bank</td>\n",
       "      <td>http://schema.org/BankOrCreditUnion</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>dbo:Annotation</td>\n",
       "      <td>http://schema.org/Comment</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>dbo:Work</td>\n",
       "      <td>http://schema.org/CreativeWork</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>dbo:Library</td>\n",
       "      <td>http://schema.org/Library</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>dbo:Country</td>\n",
       "      <td>http://schema.org/Country</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>dbo:Continent</td>\n",
       "      <td>http://schema.org/Continent</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>http://schema.org/Place</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>dbo:Sea</td>\n",
       "      <td>http://schema.org/SeaBodyOfWater</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>dbo:Organisation</td>\n",
       "      <td>http://schema.org/Organization</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>dbo:Mountain</td>\n",
       "      <td>http://schema.org/Mountain</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>dbo:Aircraft</td>\n",
       "      <td>http://schema.org/Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>dbo:Lake</td>\n",
       "      <td>http://schema.org/LakeBodyOfWater</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>dbo:Restaurant</td>\n",
       "      <td>http://schema.org/Restaurant</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>dbo:SkiArea</td>\n",
       "      <td>http://schema.org/SkiResort</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                             a                                                 b\n",
       "0                     dbo:Film                           http://schema.org/Movie\n",
       "1         dbo:HistoricBuilding  http://schema.org/LandmarksOrHistoricalBuildings\n",
       "2               dbo:SportsTeam                      http://schema.org/SportsTeam\n",
       "3                    dbo:Event                           http://schema.org/Event\n",
       "4               dbo:Locomotive                         http://schema.org/Product\n",
       "5                     dbo:Park                            http://schema.org/Park\n",
       "6                  dbo:Stadium                  http://schema.org/StadiumOrArena\n",
       "7                 dbo:Painting                        http://schema.org/Painting\n",
       "8                     dbo:Ship                         http://schema.org/Product\n",
       "9                 dbo:Language                        http://schema.org/Language\n",
       "10           dbo:MusicFestival                        http://schema.org/Festival\n",
       "11                    dbo:Book                            http://schema.org/Book\n",
       "12              dbo:Automobile                         http://schema.org/Product\n",
       "13              dbo:University             http://schema.org/CollegeOrUniversity\n",
       "14            dbo:ShoppingMall                  http://schema.org/ShoppingCenter\n",
       "15                  dbo:School                          http://schema.org/School\n",
       "16                   dbo:River                http://schema.org/RiverBodyOfWater\n",
       "17                   dbo:Arena                  http://schema.org/StadiumOrArena\n",
       "18    dbo:AdministrativeRegion              http://schema.org/AdministrativeArea\n",
       "19                  dbo:Person                          http://schema.org/Person\n",
       "20                    dbo:City                            http://schema.org/City\n",
       "21                    dbo:Song                  http://schema.org/MusicRecording\n",
       "22                   dbo:Canal                           http://schema.org/Canal\n",
       "23             dbo:SportsEvent                     http://schema.org/SportsEvent\n",
       "24             dbo:BodyOfWater                     http://schema.org/BodyOfWater\n",
       "25         dbo:MilitaryVehicle                         http://schema.org/Product\n",
       "26                   dbo:Album                      http://schema.org/MusicAlbum\n",
       "27               dbo:Sculpture                       http://schema.org/Sculpture\n",
       "28                 dbo:College             http://schema.org/CollegeOrUniversity\n",
       "29                dbo:Hospital                        http://schema.org/Hospital\n",
       "30                   dbo:Hotel                           http://schema.org/Hotel\n",
       "31                 dbo:Airport                         http://schema.org/Airport\n",
       "32            dbo:RadioStation                    http://schema.org/RadioStation\n",
       "33           dbo:HistoricPlace  http://schema.org/LandmarksOrHistoricalBuildings\n",
       "34  dbo:EducationalInstitution         http://schema.org/EducationalOrganization\n",
       "35       dbo:TelevisionEpisode                       http://schema.org/TVEpisode\n",
       "36       dbo:TelevisionStation               http://schema.org/TelevisionStation\n",
       "37                 dbo:Website                         http://schema.org/WebPage\n",
       "38                    dbo:Bank               http://schema.org/BankOrCreditUnion\n",
       "39              dbo:Annotation                         http://schema.org/Comment\n",
       "40                    dbo:Work                    http://schema.org/CreativeWork\n",
       "41                 dbo:Library                         http://schema.org/Library\n",
       "42                 dbo:Country                         http://schema.org/Country\n",
       "43               dbo:Continent                       http://schema.org/Continent\n",
       "44                   dbo:Place                           http://schema.org/Place\n",
       "45                     dbo:Sea                  http://schema.org/SeaBodyOfWater\n",
       "46            dbo:Organisation                    http://schema.org/Organization\n",
       "47                dbo:Mountain                        http://schema.org/Mountain\n",
       "48                dbo:Aircraft                         http://schema.org/Product\n",
       "49                    dbo:Lake                 http://schema.org/LakeBodyOfWater\n",
       "50              dbo:Restaurant                      http://schema.org/Restaurant\n",
       "51                 dbo:SkiArea                       http://schema.org/SkiResort"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 112 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?a ?b {\n",
    "    ?a owl:equivalentClass ?b .\n",
    "    FILTER(STRSTARTS(STR(?b),\"http://schema.org/\"))\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Many of these are as you would expect,  but there are some that are not correct,  given the definition of `owl:equivalentClass` from the [OWL specification](http://www.w3.org/TR/owl2-syntax/#Equivalent_Classes).\n",
    "\n",
    "<a id=\"Equivalent_Classes\" name=\"Equivalent_Classes\"></a><h4> <span class=\"mw-headline\">9.1.2  Equivalent Classes </span></h4>\n",
    "<p>An equivalent classes axiom <span class=\"name\">EquivalentClasses( CE<sub>1</sub> ... CE<sub>n</sub> )</span> states that all of the class expressions <span class=\"name\">CE<sub>i</sub></span>, 1 &le; i &le; n, are semantically equivalent to each other. This axiom allows one to use each <span class=\"name\">CE<sub>i</sub></span> as a synonym for each <span class=\"name\">CE<sub>j</sub></span> &mdash; that is, in any expression in the ontology containing such an axiom, <span class=\"name\">CE<sub>i</sub></span> can be replaced with <span class=\"name\">CE<sub>j</sub></span> without affecting the meaning of the ontology. An axiom <span class=\"name\">EquivalentClasses( CE<sub>1</sub> CE<sub>2</sub> )</span> is equivalent to the following two axioms:\n",
    "</p>\n",
    "<div class=\"indent\">\n",
    "<p><span class=\"name\">SubClassOf( CE<sub>1</sub> CE<sub>2</sub> )</span><br />\n",
    "<span class=\"name\">SubClassOf( CE<sub>2</sub> CE<sub>1</sub> )</span>\n",
    "</p>\n",
    "</div>\n",
    "\n",
    "Put differently,  anything that is a member of one class is a member of the other class and vice versa.  That's true for `dbo:TelevisionEpisode` and `schema:TVEpisode`,  but not true for many cases involving `schema:Product`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "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>a</th>\n",
       "      <th>b</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:Locomotive</td>\n",
       "      <td>schema:Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:Ship</td>\n",
       "      <td>schema:Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:Automobile</td>\n",
       "      <td>schema:Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:MilitaryVehicle</td>\n",
       "      <td>schema:Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:Aircraft</td>\n",
       "      <td>schema:Product</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     a               b\n",
       "0       dbo:Locomotive  schema:Product\n",
       "1             dbo:Ship  schema:Product\n",
       "2       dbo:Automobile  schema:Product\n",
       "3  dbo:MilitaryVehicle  schema:Product\n",
       "4         dbo:Aircraft  schema:Product"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 90.6 ms\n"
     ]
    }
   ],
   "source": [
    "g.bind(\"schema\",\"http://schema.org/\")\n",
    "e=LocalEndpoint(g)\n",
    "e.select(\"\"\"\n",
    "   SELECT ?a ?b {\n",
    "    ?a owl:equivalentClass ?b .\n",
    "    FILTER(?b=<http://schema.org/Product>)\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "I think you'd agree that an Automobile is a Product,  but that a Product is not necessarily an automobile.  In these cases,\n",
    "\n",
    "```\n",
    "dbo:Automobile rdfs:subClassOf schema:Product .\n",
    "```\n",
    "\n",
    "is more accurate.\n",
    "\n",
    "Let's take a look at external classes which aren't part of schema.org or wikidata:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "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>a</th>\n",
       "      <th>b</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:PenaltyShootOut</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Event</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:Location</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:Monastery</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/d0.owl#Location</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Holiday</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#TimeInterval</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:Organisation</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#SocialPerson</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:Year</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#TimeInterval</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:Project</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#PlanExecution</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:LegalCase</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Situation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:Annotation</td>\n",
       "      <td>http://purl.org/ontology/bibo/Note</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:List</td>\n",
       "      <td>http://www.w3.org/2004/02/skos/core#OrderedCollection</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:Abbey</td>\n",
       "      <td>dbo:Monastery</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:Tax</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Description</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:Book</td>\n",
       "      <td>http://purl.org/ontology/bibo/Book</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:Polyhedron</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#SpaceRegion</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:ChemicalSubstance</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#ChemicalObject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:Sales</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Situation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:Food</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#FunctionalSubstance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:MusicGenre</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Concept</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:Unknown</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Entity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>foaf:Person</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:Ideology</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/d0.owl#CognitiveEntity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>dbo:Document</td>\n",
       "      <td>foaf:Document</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>dbo:TopicalConcept</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Concept</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>dbo:List</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Collection</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>dbo:Activity</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/d0.owl#Activity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>dbo:Article</td>\n",
       "      <td>http://purl.org/ontology/bibo/Article</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>dbo:Database</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#InformationObject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>dbo:Agent</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Agent</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>dbo:Event</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Event</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>dbo:UnitOfWork</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Situation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#NaturalPerson</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>dbo:MeanOfTransportation</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#DesignedArtifact</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>dbo:GovernmentType</td>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Concept</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>dbo:Film</td>\n",
       "      <td>http://dbpedia.org/ontology/Wikidata:Q11424</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                           a  \\\n",
       "0        dbo:PenaltyShootOut   \n",
       "1                  dbo:Place   \n",
       "2              dbo:Monastery   \n",
       "3                dbo:Holiday   \n",
       "4           dbo:Organisation   \n",
       "5                   dbo:Year   \n",
       "6                dbo:Project   \n",
       "7              dbo:LegalCase   \n",
       "8             dbo:Annotation   \n",
       "9                   dbo:List   \n",
       "10                 dbo:Abbey   \n",
       "11                   dbo:Tax   \n",
       "12                  dbo:Book   \n",
       "13            dbo:Polyhedron   \n",
       "14     dbo:ChemicalSubstance   \n",
       "15                 dbo:Sales   \n",
       "16                  dbo:Food   \n",
       "17            dbo:MusicGenre   \n",
       "18               dbo:Unknown   \n",
       "19                dbo:Person   \n",
       "20              dbo:Ideology   \n",
       "21              dbo:Document   \n",
       "22        dbo:TopicalConcept   \n",
       "23                  dbo:List   \n",
       "24              dbo:Activity   \n",
       "25               dbo:Article   \n",
       "26              dbo:Database   \n",
       "27                 dbo:Agent   \n",
       "28                 dbo:Event   \n",
       "29            dbo:UnitOfWork   \n",
       "30                dbo:Person   \n",
       "31  dbo:MeanOfTransportation   \n",
       "32        dbo:GovernmentType   \n",
       "33                  dbo:Film   \n",
       "\n",
       "                                                                            b  \n",
       "0                 http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Event  \n",
       "1                                                                dbo:Location  \n",
       "2                   http://www.ontologydesignpatterns.org/ont/d0.owl#Location  \n",
       "3          http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#TimeInterval  \n",
       "4          http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#SocialPerson  \n",
       "5          http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#TimeInterval  \n",
       "6         http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#PlanExecution  \n",
       "7             http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Situation  \n",
       "8                                          http://purl.org/ontology/bibo/Note  \n",
       "9                       http://www.w3.org/2004/02/skos/core#OrderedCollection  \n",
       "10                                                              dbo:Monastery  \n",
       "11          http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Description  \n",
       "12                                         http://purl.org/ontology/bibo/Book  \n",
       "13          http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#SpaceRegion  \n",
       "14       http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#ChemicalObject  \n",
       "15            http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Situation  \n",
       "16  http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#FunctionalSubstance  \n",
       "17              http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Concept  \n",
       "18               http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Entity  \n",
       "19                                                                foaf:Person  \n",
       "20           http://www.ontologydesignpatterns.org/ont/d0.owl#CognitiveEntity  \n",
       "21                                                              foaf:Document  \n",
       "22              http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Concept  \n",
       "23           http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Collection  \n",
       "24                  http://www.ontologydesignpatterns.org/ont/d0.owl#Activity  \n",
       "25                                      http://purl.org/ontology/bibo/Article  \n",
       "26    http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#InformationObject  \n",
       "27                http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Agent  \n",
       "28                http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Event  \n",
       "29            http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Situation  \n",
       "30        http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#NaturalPerson  \n",
       "31     http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#DesignedArtifact  \n",
       "32              http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Concept  \n",
       "33                                http://dbpedia.org/ontology/Wikidata:Q11424  "
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 186 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?a ?b {\n",
    "        ?a owl:equivalentClass ?b .\n",
    "        FILTER(!STRSTARTS(STR(?b),\"http://schema.org/\"))\n",
    "        FILTER(!STRSTARTS(STR(?b),\"http://www.wikidata.org/\"))    \n",
    "    }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To keep track of them all,  I add a few more namespace declarations."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 6 ms\n"
     ]
    }
   ],
   "source": [
    "g.bind(\"dzero\",\"http://www.ontologydesignpatterns.org/ont/d0.owl#\")\n",
    "g.bind(\"dul\",\"http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#\")\n",
    "g.bind(\"bibo\",\"http://purl.org/ontology/bibo/\")\n",
    "g.bind(\"skos\",\"http://www.w3.org/2004/02/skos/core#\")\n",
    "e=LocalEndpoint(g)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "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>a</th>\n",
       "      <th>b</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:PenaltyShootOut</td>\n",
       "      <td>dul:Event</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:Location</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:Monastery</td>\n",
       "      <td>dzero:Location</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Holiday</td>\n",
       "      <td>dul:TimeInterval</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:Organisation</td>\n",
       "      <td>dul:SocialPerson</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:Year</td>\n",
       "      <td>dul:TimeInterval</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:Project</td>\n",
       "      <td>dul:PlanExecution</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:LegalCase</td>\n",
       "      <td>dul:Situation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:Annotation</td>\n",
       "      <td>bibo:Note</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:List</td>\n",
       "      <td>skos:OrderedCollection</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:Abbey</td>\n",
       "      <td>dbo:Monastery</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:Tax</td>\n",
       "      <td>dul:Description</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:Book</td>\n",
       "      <td>bibo:Book</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:Polyhedron</td>\n",
       "      <td>dul:SpaceRegion</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:ChemicalSubstance</td>\n",
       "      <td>dul:ChemicalObject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:Sales</td>\n",
       "      <td>dul:Situation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:Food</td>\n",
       "      <td>dul:FunctionalSubstance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:MusicGenre</td>\n",
       "      <td>dul:Concept</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:Unknown</td>\n",
       "      <td>dul:Entity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>foaf:Person</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:Ideology</td>\n",
       "      <td>dzero:CognitiveEntity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>dbo:Document</td>\n",
       "      <td>foaf:Document</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>dbo:TopicalConcept</td>\n",
       "      <td>dul:Concept</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>dbo:List</td>\n",
       "      <td>dul:Collection</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>dbo:Activity</td>\n",
       "      <td>dzero:Activity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>dbo:Article</td>\n",
       "      <td>bibo:Article</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>dbo:Database</td>\n",
       "      <td>dul:InformationObject</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>dbo:Agent</td>\n",
       "      <td>dul:Agent</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>dbo:Event</td>\n",
       "      <td>dul:Event</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>dbo:UnitOfWork</td>\n",
       "      <td>dul:Situation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dul:NaturalPerson</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>dbo:MeanOfTransportation</td>\n",
       "      <td>dul:DesignedArtifact</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>dbo:GovernmentType</td>\n",
       "      <td>dul:Concept</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>dbo:Film</td>\n",
       "      <td>http://dbpedia.org/ontology/Wikidata:Q11424</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                           a                                            b\n",
       "0        dbo:PenaltyShootOut                                    dul:Event\n",
       "1                  dbo:Place                                 dbo:Location\n",
       "2              dbo:Monastery                               dzero:Location\n",
       "3                dbo:Holiday                             dul:TimeInterval\n",
       "4           dbo:Organisation                             dul:SocialPerson\n",
       "5                   dbo:Year                             dul:TimeInterval\n",
       "6                dbo:Project                            dul:PlanExecution\n",
       "7              dbo:LegalCase                                dul:Situation\n",
       "8             dbo:Annotation                                    bibo:Note\n",
       "9                   dbo:List                       skos:OrderedCollection\n",
       "10                 dbo:Abbey                                dbo:Monastery\n",
       "11                   dbo:Tax                              dul:Description\n",
       "12                  dbo:Book                                    bibo:Book\n",
       "13            dbo:Polyhedron                              dul:SpaceRegion\n",
       "14     dbo:ChemicalSubstance                           dul:ChemicalObject\n",
       "15                 dbo:Sales                                dul:Situation\n",
       "16                  dbo:Food                      dul:FunctionalSubstance\n",
       "17            dbo:MusicGenre                                  dul:Concept\n",
       "18               dbo:Unknown                                   dul:Entity\n",
       "19                dbo:Person                                  foaf:Person\n",
       "20              dbo:Ideology                        dzero:CognitiveEntity\n",
       "21              dbo:Document                                foaf:Document\n",
       "22        dbo:TopicalConcept                                  dul:Concept\n",
       "23                  dbo:List                               dul:Collection\n",
       "24              dbo:Activity                               dzero:Activity\n",
       "25               dbo:Article                                 bibo:Article\n",
       "26              dbo:Database                        dul:InformationObject\n",
       "27                 dbo:Agent                                    dul:Agent\n",
       "28                 dbo:Event                                    dul:Event\n",
       "29            dbo:UnitOfWork                                dul:Situation\n",
       "30                dbo:Person                            dul:NaturalPerson\n",
       "31  dbo:MeanOfTransportation                         dul:DesignedArtifact\n",
       "32        dbo:GovernmentType                                  dul:Concept\n",
       "33                  dbo:Film  http://dbpedia.org/ontology/Wikidata:Q11424"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 185 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?a ?b {\n",
    "        ?a owl:equivalentClass ?b .\n",
    "        FILTER(!STRSTARTS(STR(?b),\"http://schema.org/\"))\n",
    "        FILTER(!STRSTARTS(STR(?b),\"http://www.wikidata.org/\"))    \n",
    "    }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The mapping from `dbo:Film` to `<http://dbpedia.org/ontology/Wikidata:Q11424>` is almost certainly a typo."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Disjoint Classes\n",
    "\n",
    "Another bit of OWL vocabulary used in the DBpedia Ontology is `owl:disjointWith`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "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>b</th>\n",
       "      <th>a</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:Fish</td>\n",
       "      <td>dbo:Mammal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:HistoricalPeriod</td>\n",
       "      <td>dbo:PrehistoricalPeriod</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:Mine</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:MeanOfTransportation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:Mountain</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:MovingWalkway</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:PeriodOfArtisticStyle</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:Tower</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:ProtohistoricalPeriod</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:GeologicalPeriod</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:Escalator</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:Activity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:UnitOfWork</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:HistoricalPeriod</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:Gate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:ConveyorSystem</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:Building</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:On-SiteTransportation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:TimePeriod</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:Person</td>\n",
       "      <td>dbo:Event</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:Agent</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>http://dbpedia.org/ontology/wgs84_pos:SpatialThing</td>\n",
       "      <td>dbo:ReligiousOrganisation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>http://dbpedia.org/ontology/wgs84_pos:SpatialThing</td>\n",
       "      <td>dbo:Work</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>http://dbpedia.org/ontology/wgs84_pos:SpatialThing</td>\n",
       "      <td>dbo:Organisation</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                     b                          a\n",
       "0                                             dbo:Fish                 dbo:Mammal\n",
       "1                                 dbo:HistoricalPeriod    dbo:PrehistoricalPeriod\n",
       "2                                           dbo:Person                   dbo:Mine\n",
       "3                                           dbo:Person   dbo:MeanOfTransportation\n",
       "4                                           dbo:Person               dbo:Mountain\n",
       "5                                           dbo:Person          dbo:MovingWalkway\n",
       "6                                           dbo:Person  dbo:PeriodOfArtisticStyle\n",
       "7                                           dbo:Person                  dbo:Tower\n",
       "8                                           dbo:Person  dbo:ProtohistoricalPeriod\n",
       "9                                           dbo:Person       dbo:GeologicalPeriod\n",
       "10                                          dbo:Person              dbo:Escalator\n",
       "11                                          dbo:Person               dbo:Activity\n",
       "12                                          dbo:Person             dbo:UnitOfWork\n",
       "13                                          dbo:Person       dbo:HistoricalPeriod\n",
       "14                                          dbo:Person                   dbo:Gate\n",
       "15                                          dbo:Person         dbo:ConveyorSystem\n",
       "16                                          dbo:Person               dbo:Building\n",
       "17                                          dbo:Person  dbo:On-SiteTransportation\n",
       "18                                          dbo:Person             dbo:TimePeriod\n",
       "19                                          dbo:Person                  dbo:Event\n",
       "20                                           dbo:Place                  dbo:Agent\n",
       "21  http://dbpedia.org/ontology/wgs84_pos:SpatialThing  dbo:ReligiousOrganisation\n",
       "22  http://dbpedia.org/ontology/wgs84_pos:SpatialThing                   dbo:Work\n",
       "23  http://dbpedia.org/ontology/wgs84_pos:SpatialThing           dbo:Organisation"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 67 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?b ?a {\n",
    "        ?a owl:disjointWith ?b .   \n",
    "    } ORDER BY ?b\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If two classes are disjoint,  that means that nothing can be an instance of both things.  For instance,  a Fish cannot be a Mammal,  a Person is not a building,  etc.  These sort of facts are helpful for validation,  but one should resist the impulse to make statements of disjointness which aren't strictly true.  (For instance,  it would be unlikely,  but not impossible,  to be the winner of both a Heisman Trophy and a Fields Metal,  so these are not disjoint categories.)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Datatypes\n",
    "\n",
    "RDF not only has \"types\" (classes) that represent named concepts,  but it also has literal datatypes.  These include the standard datatypes from XML such as `xsd:integer` and `xsd:datetime`,  but also derived types that specialize those types.  This makes it possible to tag quantities in terms of physical units,  currency units,  etc."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "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>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>http://dbpedia.org/datatype/thaiBaht</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>http://dbpedia.org/datatype/bar</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>xsd:boolean</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>http://dbpedia.org/datatype/degreeFahrenheit</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>rdf:langString</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>http://dbpedia.org/datatype/saintHelenaPound</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>http://dbpedia.org/datatype/giganewton</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>http://dbpedia.org/datatype/lithuanianLitas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>http://dbpedia.org/datatype/megametre</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>xsd:anyURI</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           type\n",
       "0          http://dbpedia.org/datatype/thaiBaht\n",
       "1               http://dbpedia.org/datatype/bar\n",
       "2                                   xsd:boolean\n",
       "3  http://dbpedia.org/datatype/degreeFahrenheit\n",
       "4                                rdf:langString\n",
       "5  http://dbpedia.org/datatype/saintHelenaPound\n",
       "6        http://dbpedia.org/datatype/giganewton\n",
       "7   http://dbpedia.org/datatype/lithuanianLitas\n",
       "8         http://dbpedia.org/datatype/megametre\n",
       "9                                    xsd:anyURI"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 24 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?type {\n",
    "        ?type a rdfs:Datatype .\n",
    "    } LIMIT 10\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 1 ms\n"
     ]
    }
   ],
   "source": [
    "g.bind(\"type\",\"http://dbpedia.org/datatype/\")\n",
    "e=LocalEndpoint(g)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "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>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>type:thaiBaht</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>type:bar</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>xsd:boolean</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>type:degreeFahrenheit</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>rdf:langString</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>type:saintHelenaPound</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>type:giganewton</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>type:lithuanianLitas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>type:megametre</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>xsd:anyURI</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                    type\n",
       "0          type:thaiBaht\n",
       "1               type:bar\n",
       "2            xsd:boolean\n",
       "3  type:degreeFahrenheit\n",
       "4         rdf:langString\n",
       "5  type:saintHelenaPound\n",
       "6        type:giganewton\n",
       "7   type:lithuanianLitas\n",
       "8         type:megametre\n",
       "9             xsd:anyURI"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 34.5 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?type {\n",
    "        ?type a rdfs:Datatype .\n",
    "    } LIMIT 10\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The information about these data types are currently sparse:  this particular type has just a label and a type."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "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>p</th>\n",
       "      <th>o</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>rdfs:label</td>\n",
       "      <td>lightYear</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>rdf:type</td>\n",
       "      <td>rdfs:Datatype</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            p              o\n",
       "0  rdfs:label      lightYear\n",
       "1    rdf:type  rdfs:Datatype"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 30 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?p ?o {\n",
    "        type:lightYear ?p ?o .\n",
    "    }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "These turn out to be the only properties that *any* datatypes have;  pretty clearly,  datatypes are not labeled in the rich set of languages that properties and classes are labeled in.  (Note that vocabulary exists in RDFS and OWL for doing just that,  such as specifying that `type:lightYear` would be represented as a number,  specifying that a particular type of numeric value is in a particular range,  etc.)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>p</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>rdf:type</th>\n",
       "      <td>382</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs:label</th>\n",
       "      <td>382</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            cnt\n",
       "p              \n",
       "rdf:type    382\n",
       "rdfs:label  382"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 136 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?p (COUNT(*) AS ?cnt) {\n",
    "        ?s a rdfs:Datatype .\n",
    "        ?s ?p ?o .\n",
    "    } GROUP BY ?p\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Another approach is to look at how datatypes get used,  that is,  how frequently various datatypes are used as the range of a property."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>xsd:string</th>\n",
       "      <td>779</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd:nonNegativeInteger</th>\n",
       "      <td>265</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd:double</th>\n",
       "      <td>187</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd:date</th>\n",
       "      <td>146</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd:gYear</th>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd:integer</th>\n",
       "      <td>53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdf:langString</th>\n",
       "      <td>49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:millimetre</th>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:kilogram</th>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd:float</th>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd:positiveInteger</th>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:kilometre</th>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:kelvin</th>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:squareKilometre</th>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:metre</th>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:hour</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:day</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd:boolean</th>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd:dateTime</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:inhabitantsPerSquareKilometre</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:cubicMetrePerSecond</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:kilogramPerCubicMetre</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:minute</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:cubicMetre</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:cubicKilometre</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:kilometrePerSecond</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd:anyURI</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:centimetre</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:fuelType</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:newtonMetre</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:kilowatt</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:megabyte</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:valvetrain</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:kilometrePerHour</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:gramPerKilometre</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:engineConfiguration</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:cubicCentimetre</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd:gYearMonth</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:squareMetre</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:second</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type:litre</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                    cnt\n",
       "type                                   \n",
       "xsd:string                          779\n",
       "xsd:nonNegativeInteger              265\n",
       "xsd:double                          187\n",
       "xsd:date                            146\n",
       "xsd:gYear                            60\n",
       "xsd:integer                          53\n",
       "rdf:langString                       49\n",
       "type:millimetre                      26\n",
       "type:kilogram                        25\n",
       "xsd:float                            25\n",
       "xsd:positiveInteger                  18\n",
       "type:kilometre                       15\n",
       "type:kelvin                          12\n",
       "type:squareKilometre                 10\n",
       "type:metre                            9\n",
       "type:hour                             6\n",
       "type:day                              6\n",
       "xsd:boolean                           5\n",
       "xsd:dateTime                          4\n",
       "type:inhabitantsPerSquareKilometre    4\n",
       "type:cubicMetrePerSecond              4\n",
       "type:kilogramPerCubicMetre            3\n",
       "type:minute                           2\n",
       "type:cubicMetre                       2\n",
       "type:cubicKilometre                   2\n",
       "type:kilometrePerSecond               2\n",
       "xsd:anyURI                            1\n",
       "type:centimetre                       1\n",
       "type:fuelType                         1\n",
       "type:newtonMetre                      1\n",
       "type:kilowatt                         1\n",
       "type:megabyte                         1\n",
       "type:valvetrain                       1\n",
       "type:kilometrePerHour                 1\n",
       "type:gramPerKilometre                 1\n",
       "type:engineConfiguration              1\n",
       "type:cubicCentimetre                  1\n",
       "xsd:gYearMonth                        1\n",
       "type:squareMetre                      1\n",
       "type:second                           1\n",
       "type:litre                            1"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 253 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?type (COUNT(*) AS ?cnt) {\n",
    "        ?p rdfs:range ?type .\n",
    "        ?type a rdfs:Datatype .\n",
    "    } GROUP BY ?type ORDER BY DESC(?cnt)\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "41"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 5 ms\n"
     ]
    }
   ],
   "source": [
    "len(_)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Out of 382 properties,  only 41 actually appear as the range of the properties in the schema.  Here are a few properties that are unused in the schema.\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "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>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>type:thaiBaht</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>type:bar</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>type:degreeFahrenheit</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>type:saintHelenaPound</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>type:giganewton</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>type:lithuanianLitas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>type:megametre</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>type:LinearMassDensity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>type:venezuelanBolívar</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>type:canadianDollar</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>type:bahamianDollar</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>type:perMil</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>type:australianDollar</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>type:burundianFranc</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>type:terabyte</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>type:nicaraguanCórdoba</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>type:jamaicanDollar</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>type:inchPound</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>type:nigerianNaira</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>type:astronomicalUnit</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      type\n",
       "0            type:thaiBaht\n",
       "1                 type:bar\n",
       "2    type:degreeFahrenheit\n",
       "3    type:saintHelenaPound\n",
       "4          type:giganewton\n",
       "5     type:lithuanianLitas\n",
       "6           type:megametre\n",
       "7   type:LinearMassDensity\n",
       "8   type:venezuelanBolívar\n",
       "9      type:canadianDollar\n",
       "10     type:bahamianDollar\n",
       "11             type:perMil\n",
       "12   type:australianDollar\n",
       "13     type:burundianFranc\n",
       "14           type:terabyte\n",
       "15  type:nicaraguanCórdoba\n",
       "16     type:jamaicanDollar\n",
       "17          type:inchPound\n",
       "18      type:nigerianNaira\n",
       "19   type:astronomicalUnit"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 7.5 s\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?type {\n",
    "        ?type a rdfs:Datatype .\n",
    "        MINUS { ?s ?p ?type }\n",
    "    } LIMIT 20\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "According to the [DBpedia Ontology documentation](http://mappings.dbpedia.org/index.php/DBpedia_Datatypes),  there are two kinds of datatype declarations in mappings.  In some cases the unit is explictly specified in the mapping field (ex. a field that contains a length is specified in meters) and in other cases,  a particular datatype is *specific* to the field.\n",
    "\n",
    "It turns out most of the knowledge in the DBpedia Ontology system is hard coded into a [scala file](https://github.com/dbpedia/extraction-framework/blob/master/core/src/main/scala/org/dbpedia/extraction/ontology/OntologyDatatypes.scala);  this file contains rich information that is not exposed in the RDF form of the Ontology,  such as conversion factors,  the fact that miles per hour is a speed,  etc.\n",
    "\n",
    "It is quite possible to encode datatypes directly into a fact,  for example,\n",
    "\n",
    "    :Iron :meltsAt \"1811 K\"^^type:kelvin .\n",
    "\n",
    "\n",
    "It is possible that such facts could be found in DBpedia or some other database,  but I'm not going to check for that in this notebook,  because this notebook is only considering facts that are in the ontology file supplied with this notebook. \n",
    "\n",
    "## Properties Measured in Kilograms"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "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>p</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>http://dbpedia.org/ontology/Rocket/mass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>http://dbpedia.org/ontology/MeanOfTransportation/mass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>http://dbpedia.org/ontology/Spacecraft/totalCargo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>http://dbpedia.org/ontology/Spacecraft/dryCargo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>http://dbpedia.org/ontology/Rocket/lowerEarthOrbitPayload</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>http://dbpedia.org/ontology/Spacecraft/cargoFuel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>http://dbpedia.org/ontology/MovingWalkway/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>http://dbpedia.org/ontology/ConveyorSystem/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>http://dbpedia.org/ontology/Spacecraft/cargoGas</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>http://dbpedia.org/ontology/Engine/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>http://dbpedia.org/ontology/Planet/mass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>http://dbpedia.org/ontology/Galaxy/mass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>http://dbpedia.org/ontology/Spacecraft/cargoWater</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>http://dbpedia.org/ontology/Person/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>http://dbpedia.org/ontology/SpaceMission/lunarSampleMass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>http://dbpedia.org/ontology/Escalator/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>http://dbpedia.org/ontology/Escalator/mass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>http://dbpedia.org/ontology/MovingWalkway/mass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>http://dbpedia.org/ontology/On-SiteTransportation/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>http://dbpedia.org/ontology/Spacecraft/totalMass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>http://dbpedia.org/ontology/SpaceMission/mass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>http://dbpedia.org/ontology/On-SiteTransportation/mass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>http://dbpedia.org/ontology/MeanOfTransportation/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>http://dbpedia.org/ontology/Weapon/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>http://dbpedia.org/ontology/ConveyorSystem/mass</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                            p\n",
       "0                     http://dbpedia.org/ontology/Rocket/mass\n",
       "1       http://dbpedia.org/ontology/MeanOfTransportation/mass\n",
       "2           http://dbpedia.org/ontology/Spacecraft/totalCargo\n",
       "3             http://dbpedia.org/ontology/Spacecraft/dryCargo\n",
       "4   http://dbpedia.org/ontology/Rocket/lowerEarthOrbitPayload\n",
       "5            http://dbpedia.org/ontology/Spacecraft/cargoFuel\n",
       "6            http://dbpedia.org/ontology/MovingWalkway/weight\n",
       "7           http://dbpedia.org/ontology/ConveyorSystem/weight\n",
       "8             http://dbpedia.org/ontology/Spacecraft/cargoGas\n",
       "9                   http://dbpedia.org/ontology/Engine/weight\n",
       "10                    http://dbpedia.org/ontology/Planet/mass\n",
       "11                    http://dbpedia.org/ontology/Galaxy/mass\n",
       "12          http://dbpedia.org/ontology/Spacecraft/cargoWater\n",
       "13                  http://dbpedia.org/ontology/Person/weight\n",
       "14   http://dbpedia.org/ontology/SpaceMission/lunarSampleMass\n",
       "15               http://dbpedia.org/ontology/Escalator/weight\n",
       "16                 http://dbpedia.org/ontology/Escalator/mass\n",
       "17             http://dbpedia.org/ontology/MovingWalkway/mass\n",
       "18   http://dbpedia.org/ontology/On-SiteTransportation/weight\n",
       "19           http://dbpedia.org/ontology/Spacecraft/totalMass\n",
       "20              http://dbpedia.org/ontology/SpaceMission/mass\n",
       "21     http://dbpedia.org/ontology/On-SiteTransportation/mass\n",
       "22    http://dbpedia.org/ontology/MeanOfTransportation/weight\n",
       "23                  http://dbpedia.org/ontology/Weapon/weight\n",
       "24            http://dbpedia.org/ontology/ConveyorSystem/mass"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 25 ms\n"
     ]
    }
   ],
   "source": [
    "\n",
    "e.select(\"\"\"\n",
    "    SELECT ?p {\n",
    "        ?p rdfs:range type:kilogram\n",
    "    }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "One unfortunate thing is that the DBpedia ontology sometimes composes property URIs by putting together the class (ex. \"Galaxy\") and the property (ex. \"mass\") with a slash between them.  Slash is not allowed in a localname,  which means that you can't write `ontology:Galaxy/mass`.  You can write the full URI,  or you could define a prefix `galaxy` such that you can write `Galaxy:mass`.  Yet another approach is to set the base URI to\n",
    "\n",
    "   http://dbpedia.org/ontology/\n",
    "   \n",
    "in which case you could write `<Galaxy/mass>`.  I was tempted to do that for this notebook,  but decided against it,  because soon I will be joining the schema with more DBpedia data,  where I like to set the base to\n",
    "\n",
    "   http://dbpedia.org/resource/\n",
    "\n",
    "In a slightly better world,  the property might be composed with a period,  so that the URI is just \"ontology:Galaxy.mass\".  *(Hmm...  Could Gastrodon do that for you?)*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Datatype properties vs Object Properties\n",
    "\n",
    "RDFS has a single class to represent a property,  `rdf:Property`;  OWL makes it a little more complex by defining both `owl:DatatypeProperty` and `owl:ObjectProperty`.  The difference between these two kinds of property is the range:  a Datatype Property has a literal value (object),  while an Object Property has a Resource (URI or blank node) as a value.\n",
    "\n",
    "I'd imagine that every rdf:Property should be either an `owl:DatatypeProperty` or `owl:ObjectProperty`,  so that the sums would match.  I wouldn't take it for granted,  so I'll check it:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "type\n",
       "rdf:Property            2695\n",
       "owl:DatatypeProperty    1734\n",
       "owl:ObjectProperty      1099\n",
       "Name: cnt, dtype: int64"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 1.17 s\n"
     ]
    }
   ],
   "source": [
    "counts=e.select(\"\"\"\n",
    "   SELECT ?type (COUNT(*) AS ?cnt) {\n",
    "      ?s a ?type .\n",
    "      FILTER (?type IN (rdf:Property,owl:DatatypeProperty,owl:ObjectProperty))\n",
    "   } GROUP BY ?type ORDER BY DESC(?cnt)\n",
    "\"\"\")[\"cnt\"]\n",
    "counts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2695"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 6.5 ms\n"
     ]
    }
   ],
   "source": [
    "counts[\"rdf:Property\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2833"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 11 ms\n"
     ]
    }
   ],
   "source": [
    "counts[\"owl:DatatypeProperty\"]+counts[\"owl:ObjectProperty\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The sums don't match.\n",
    "\n",
    "I'd expect the two kinds of DatatypeProperties to be disjoint;  and they are,  because I can't find any classes which are an instance of both."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "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>klasse</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [klasse]\n",
       "Index: []"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 122 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?klasse {\n",
    "      ?klasse a owl:DatatypeProperty .\n",
    "      ?klasse a owl:ObjectProperty .\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "However,  there are cases where a property is registered as an OWL property but not as an RDFS property:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "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>klasse</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>http://dbpedia.org/ontology/Spacecraft/dockedTime</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>http://dbpedia.org/ontology/On-SiteTransportation/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>http://dbpedia.org/ontology/PopulatedPlace/areaTotal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>http://dbpedia.org/ontology/Escalator/height</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>http://dbpedia.org/ontology/Planet/surfaceArea</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>http://dbpedia.org/ontology/Escalator/diameter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>http://dbpedia.org/ontology/Engine/width</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>http://dbpedia.org/ontology/MovingWalkway/length</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>http://dbpedia.org/ontology/Weapon/height</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>http://dbpedia.org/ontology/SpaceMission/stationEvaDuration</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>http://dbpedia.org/ontology/Building/floorArea</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>http://dbpedia.org/ontology/MovingWalkway/mass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>http://dbpedia.org/ontology/On-SiteTransportation/height</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>http://dbpedia.org/ontology/SpaceMission/lunarEvaTime</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>http://dbpedia.org/ontology/ChemicalSubstance/boilingPoint</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>http://dbpedia.org/ontology/PopulatedPlace/populationDensity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>http://dbpedia.org/ontology/ConveyorSystem/width</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>http://dbpedia.org/ontology/Canal/maximumBoatLength</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>http://dbpedia.org/ontology/Planet/maximumTemperature</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>http://dbpedia.org/ontology/ConveyorSystem/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>http://dbpedia.org/ontology/Spacecraft/periapsis</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>http://dbpedia.org/ontology/Work/runtime</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>http://dbpedia.org/ontology/Planet/meanRadius</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>http://dbpedia.org/ontology/MovingWalkway/height</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>http://dbpedia.org/ontology/Planet/orbitalPeriod</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>http://dbpedia.org/ontology/SpaceStation/volume</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>http://dbpedia.org/ontology/Galaxy/volume</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>http://dbpedia.org/ontology/GrandPrix/distance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>http://dbpedia.org/ontology/ConveyorSystem/diameter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>http://dbpedia.org/ontology/Engine/acceleration</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>108</th>\n",
       "      <td>http://dbpedia.org/ontology/Software/fileSize</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>109</th>\n",
       "      <td>http://dbpedia.org/ontology/ChemicalSubstance/meltingPoint</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>110</th>\n",
       "      <td>http://dbpedia.org/ontology/PopulatedPlace/populationMetroDensity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>111</th>\n",
       "      <td>http://dbpedia.org/ontology/On-SiteTransportation/width</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>112</th>\n",
       "      <td>http://dbpedia.org/ontology/MeanOfTransportation/diameter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>113</th>\n",
       "      <td>http://dbpedia.org/ontology/Person/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>114</th>\n",
       "      <td>http://dbpedia.org/ontology/Galaxy/temperature</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>115</th>\n",
       "      <td>http://dbpedia.org/ontology/Galaxy/density</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>116</th>\n",
       "      <td>http://dbpedia.org/ontology/Galaxy/periapsis</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>117</th>\n",
       "      <td>http://dbpedia.org/ontology/Engine/topSpeed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>118</th>\n",
       "      <td>http://dbpedia.org/ontology/MeanOfTransportation/weight</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>119</th>\n",
       "      <td>http://dbpedia.org/ontology/Engine/torqueOutput</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>120</th>\n",
       "      <td>http://dbpedia.org/ontology/Escalator/mass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>121</th>\n",
       "      <td>http://dbpedia.org/ontology/Rocket/lowerEarthOrbitPayload</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>122</th>\n",
       "      <td>http://dbpedia.org/ontology/Engine/diameter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>123</th>\n",
       "      <td>http://dbpedia.org/ontology/LunarCrater/diameter</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>124</th>\n",
       "      <td>http://dbpedia.org/ontology/Lake/areaOfCatchment</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125</th>\n",
       "      <td>http://dbpedia.org/ontology/Weapon/length</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>126</th>\n",
       "      <td>http://dbpedia.org/ontology/SpaceMission/mass</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>127</th>\n",
       "      <td>http://dbpedia.org/ontology/Engine/cylinderBore</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>128</th>\n",
       "      <td>http://dbpedia.org/ontology/Escalator/width</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>129</th>\n",
       "      <td>http://dbpedia.org/ontology/Lake/volume</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>130</th>\n",
       "      <td>http://dbpedia.org/ontology/Spacecraft/cargoFuel</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>131</th>\n",
       "      <td>http://dbpedia.org/ontology/GrandPrix/course</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>132</th>\n",
       "      <td>http://dbpedia.org/ontology/Engine/displacement</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>133</th>\n",
       "      <td>http://dbpedia.org/ontology/Astronaut/timeInSpace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>134</th>\n",
       "      <td>http://dbpedia.org/ontology/PopulatedPlace/areaUrban</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>135</th>\n",
       "      <td>http://dbpedia.org/ontology/SpaceMission/stationVisitDuration</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>136</th>\n",
       "      <td>http://dbpedia.org/ontology/Automobile/fuelCapacity</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>http://dbpedia.org/ontology/Infrastructure/length</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>138 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                                klasse\n",
       "0                    http://dbpedia.org/ontology/Spacecraft/dockedTime\n",
       "1             http://dbpedia.org/ontology/On-SiteTransportation/weight\n",
       "2                 http://dbpedia.org/ontology/PopulatedPlace/areaTotal\n",
       "3                         http://dbpedia.org/ontology/Escalator/height\n",
       "4                       http://dbpedia.org/ontology/Planet/surfaceArea\n",
       "5                       http://dbpedia.org/ontology/Escalator/diameter\n",
       "6                             http://dbpedia.org/ontology/Engine/width\n",
       "7                     http://dbpedia.org/ontology/MovingWalkway/length\n",
       "8                            http://dbpedia.org/ontology/Weapon/height\n",
       "9          http://dbpedia.org/ontology/SpaceMission/stationEvaDuration\n",
       "10                      http://dbpedia.org/ontology/Building/floorArea\n",
       "11                      http://dbpedia.org/ontology/MovingWalkway/mass\n",
       "12            http://dbpedia.org/ontology/On-SiteTransportation/height\n",
       "13               http://dbpedia.org/ontology/SpaceMission/lunarEvaTime\n",
       "14          http://dbpedia.org/ontology/ChemicalSubstance/boilingPoint\n",
       "15        http://dbpedia.org/ontology/PopulatedPlace/populationDensity\n",
       "16                    http://dbpedia.org/ontology/ConveyorSystem/width\n",
       "17                 http://dbpedia.org/ontology/Canal/maximumBoatLength\n",
       "18               http://dbpedia.org/ontology/Planet/maximumTemperature\n",
       "19                   http://dbpedia.org/ontology/ConveyorSystem/weight\n",
       "20                    http://dbpedia.org/ontology/Spacecraft/periapsis\n",
       "21                            http://dbpedia.org/ontology/Work/runtime\n",
       "22                       http://dbpedia.org/ontology/Planet/meanRadius\n",
       "23                    http://dbpedia.org/ontology/MovingWalkway/height\n",
       "24                    http://dbpedia.org/ontology/Planet/orbitalPeriod\n",
       "25                     http://dbpedia.org/ontology/SpaceStation/volume\n",
       "26                           http://dbpedia.org/ontology/Galaxy/volume\n",
       "27                      http://dbpedia.org/ontology/GrandPrix/distance\n",
       "28                 http://dbpedia.org/ontology/ConveyorSystem/diameter\n",
       "29                     http://dbpedia.org/ontology/Engine/acceleration\n",
       "..                                                                 ...\n",
       "108                      http://dbpedia.org/ontology/Software/fileSize\n",
       "109         http://dbpedia.org/ontology/ChemicalSubstance/meltingPoint\n",
       "110  http://dbpedia.org/ontology/PopulatedPlace/populationMetroDensity\n",
       "111            http://dbpedia.org/ontology/On-SiteTransportation/width\n",
       "112          http://dbpedia.org/ontology/MeanOfTransportation/diameter\n",
       "113                          http://dbpedia.org/ontology/Person/weight\n",
       "114                     http://dbpedia.org/ontology/Galaxy/temperature\n",
       "115                         http://dbpedia.org/ontology/Galaxy/density\n",
       "116                       http://dbpedia.org/ontology/Galaxy/periapsis\n",
       "117                        http://dbpedia.org/ontology/Engine/topSpeed\n",
       "118            http://dbpedia.org/ontology/MeanOfTransportation/weight\n",
       "119                    http://dbpedia.org/ontology/Engine/torqueOutput\n",
       "120                         http://dbpedia.org/ontology/Escalator/mass\n",
       "121          http://dbpedia.org/ontology/Rocket/lowerEarthOrbitPayload\n",
       "122                        http://dbpedia.org/ontology/Engine/diameter\n",
       "123                   http://dbpedia.org/ontology/LunarCrater/diameter\n",
       "124                   http://dbpedia.org/ontology/Lake/areaOfCatchment\n",
       "125                          http://dbpedia.org/ontology/Weapon/length\n",
       "126                      http://dbpedia.org/ontology/SpaceMission/mass\n",
       "127                    http://dbpedia.org/ontology/Engine/cylinderBore\n",
       "128                        http://dbpedia.org/ontology/Escalator/width\n",
       "129                            http://dbpedia.org/ontology/Lake/volume\n",
       "130                   http://dbpedia.org/ontology/Spacecraft/cargoFuel\n",
       "131                       http://dbpedia.org/ontology/GrandPrix/course\n",
       "132                    http://dbpedia.org/ontology/Engine/displacement\n",
       "133                  http://dbpedia.org/ontology/Astronaut/timeInSpace\n",
       "134               http://dbpedia.org/ontology/PopulatedPlace/areaUrban\n",
       "135      http://dbpedia.org/ontology/SpaceMission/stationVisitDuration\n",
       "136                http://dbpedia.org/ontology/Automobile/fuelCapacity\n",
       "137                  http://dbpedia.org/ontology/Infrastructure/length\n",
       "\n",
       "[138 rows x 1 columns]"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 19.3 s\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?klasse {\n",
    "      ?klasse a owl:DatatypeProperty .\n",
    "      MINUS {?klasse a rdf:Property}\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "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>klasse</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [klasse]\n",
       "Index: []"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 10.7 s\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?klasse {\n",
    "      ?klasse a owl:ObjectProperty .\n",
    "      MINUS {?klasse a rdf:Property}\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "However,  there are no properties defined as an RDFS property that are not defined in OWL."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "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>p</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [p]\n",
       "Index: []"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 26.6 s\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?p {\n",
    "      ?p a rdf:Property .\n",
    "      MINUS {\n",
    "          { ?p a owl:DatatypeProperty }\n",
    "          UNION\n",
    "          { ?p a owl:ObjectProperty }\n",
    "      }\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Conclusion:  to get a complete list of properties defined in the DBpedia Ontology,  is necessary and sufficient to use the OWL property declarations.  The analysis above that uses `rdfs:Property` should use the OWL property classes to get complete results."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Subproperties"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Subproperties are used in RDF to gather together properties that more or less say the same thing.\n",
    "\n",
    "For instance,  the mass of a galaxy is comparable (in principle) to the mass of objects like stars and planets that make it.  Thus in a perfect world,  the mass of a galaxy would be related to a more general \"mass\" property that could apply to anything from coins to aircraft carriers.\n",
    "\n",
    "I go looking for one..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "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>p</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [p]\n",
       "Index: []"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 22.5 ms\n"
     ]
    }
   ],
   "source": [
    "galaxyMass=URIRef(\"http://dbpedia.org/ontology/Galaxy/mass\")\n",
    "e.select(\"\"\"\n",
    "   SELECT ?p {\n",
    "      ?_galaxyMass rdfs:subPropertyOf ?p .\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "... and don't find it.  That's not really a problem,  because this I can always add one by adding a few more facts to my copy of the DBpedia Ontology.  Let's see what is really there..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "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>from</th>\n",
       "      <th>to</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:politicGovernmentDepartment</td>\n",
       "      <td>dul:hasPart</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:routeEndLocation</td>\n",
       "      <td>dul:hasCommonBoundary</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:highwaySystem</td>\n",
       "      <td>dul:isPartOf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:drama</td>\n",
       "      <td>dul:isParticipantIn</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:sire</td>\n",
       "      <td>dul:sameSettingAs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:organisation</td>\n",
       "      <td>dul:sameSettingAs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:olympicOathSwornByAthlete</td>\n",
       "      <td>dul:hasParticipant</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:relative</td>\n",
       "      <td>dul:sameSettingAs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:largestCity</td>\n",
       "      <td>dul:hasPart</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:governmentPlace</td>\n",
       "      <td>dul:sameSettingAs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:musicSubgenre</td>\n",
       "      <td>dul:isSpecializedBy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:codeMemorial</td>\n",
       "      <td>dbo:Code</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:languageFamily</td>\n",
       "      <td>dul:specializes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:launchPad</td>\n",
       "      <td>dul:hasParticipant</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:state</td>\n",
       "      <td>dul:hasLocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:federalState</td>\n",
       "      <td>dul:isPartOf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:mergedIntoParty</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:assistantPrincipal</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:appointer</td>\n",
       "      <td>dul:sameSettingAs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:followingEvent</td>\n",
       "      <td>dul:precedes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:map</td>\n",
       "      <td>dul:hasLocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>dbo:aircraftHelicopterObservation</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>dbo:subClassis</td>\n",
       "      <td>dbo:classis</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>dbo:tonyAward</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>dbo:distributor</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>dbo:showJudge</td>\n",
       "      <td>dul:hasParticipant</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>dbo:beatifiedPlace</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>dbo:subprefecture</td>\n",
       "      <td>dul:hasPart</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>dbo:foundationPlace</td>\n",
       "      <td>dul:hasLocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>dbo:sisterStation</td>\n",
       "      <td>dul:sameSettingAs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>941</th>\n",
       "      <td>dbo:chef</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>942</th>\n",
       "      <td>dbo:countryOrigin</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>943</th>\n",
       "      <td>dbo:previousEntity</td>\n",
       "      <td>dul:sameSettingAs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>944</th>\n",
       "      <td>dbo:soccerTournamentMostSuccesfull</td>\n",
       "      <td>dul:isSettingFor</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>945</th>\n",
       "      <td>dbo:southPlace</td>\n",
       "      <td>dbo:closeTo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>946</th>\n",
       "      <td>dbo:isoCodeRegion</td>\n",
       "      <td>dul:isPartOf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>947</th>\n",
       "      <td>dbo:nerve</td>\n",
       "      <td>dul:isLocationOf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>948</th>\n",
       "      <td>dbo:poleDriverCountry</td>\n",
       "      <td>dul:hasParticipant</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>949</th>\n",
       "      <td>dbo:locationCountry</td>\n",
       "      <td>dul:hasLocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>950</th>\n",
       "      <td>dbo:publisher</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>951</th>\n",
       "      <td>dbo:portrayer</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>952</th>\n",
       "      <td>dbo:restingPlace</td>\n",
       "      <td>dul:hasLocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>953</th>\n",
       "      <td>dbo:aircraftInterceptor</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>954</th>\n",
       "      <td>dbo:phylum</td>\n",
       "      <td>dul:isSpecializedBy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>955</th>\n",
       "      <td>dbo:artPatron</td>\n",
       "      <td>dul:sameSettingAs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>956</th>\n",
       "      <td>dbo:currentWorldChampion</td>\n",
       "      <td>dul:hasParticipant</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>957</th>\n",
       "      <td>dbo:organSystem</td>\n",
       "      <td>dul:isPartOf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>958</th>\n",
       "      <td>dbo:philosophicalSchool</td>\n",
       "      <td>dul:isMemberOf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>959</th>\n",
       "      <td>dbo:pastMember</td>\n",
       "      <td>dul:hasMember</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>960</th>\n",
       "      <td>dbo:regency</td>\n",
       "      <td>dul:sameSettingAs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>961</th>\n",
       "      <td>dbo:goldenGlobeAward</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>962</th>\n",
       "      <td>dbo:authority</td>\n",
       "      <td>dul:sameSettingAs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>963</th>\n",
       "      <td>dbo:layout</td>\n",
       "      <td>dul:hasQuality</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>964</th>\n",
       "      <td>dbo:countySeat</td>\n",
       "      <td>dul:hasLocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>965</th>\n",
       "      <td>dbo:aircraftHelicopter</td>\n",
       "      <td>dul:coparticipatesWith</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>966</th>\n",
       "      <td>dbo:academicDiscipline</td>\n",
       "      <td>dul:isAbout</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>967</th>\n",
       "      <td>dbo:alpsGroup</td>\n",
       "      <td>dul:hasLocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>968</th>\n",
       "      <td>dbo:runningMate</td>\n",
       "      <td>dul:sameSettingAs</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>969</th>\n",
       "      <td>dbo:championInDouble</td>\n",
       "      <td>dbo:champion</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>970</th>\n",
       "      <td>dbo:thirdDriverCountry</td>\n",
       "      <td>dul:hasParticipant</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>971 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                   from                      to\n",
       "0       dbo:politicGovernmentDepartment             dul:hasPart\n",
       "1                  dbo:routeEndLocation   dul:hasCommonBoundary\n",
       "2                     dbo:highwaySystem            dul:isPartOf\n",
       "3                             dbo:drama     dul:isParticipantIn\n",
       "4                              dbo:sire       dul:sameSettingAs\n",
       "5                      dbo:organisation       dul:sameSettingAs\n",
       "6         dbo:olympicOathSwornByAthlete      dul:hasParticipant\n",
       "7                          dbo:relative       dul:sameSettingAs\n",
       "8                       dbo:largestCity             dul:hasPart\n",
       "9                   dbo:governmentPlace       dul:sameSettingAs\n",
       "10                    dbo:musicSubgenre     dul:isSpecializedBy\n",
       "11                     dbo:codeMemorial                dbo:Code\n",
       "12                   dbo:languageFamily         dul:specializes\n",
       "13                        dbo:launchPad      dul:hasParticipant\n",
       "14                            dbo:state         dul:hasLocation\n",
       "15                     dbo:federalState            dul:isPartOf\n",
       "16                  dbo:mergedIntoParty  dul:coparticipatesWith\n",
       "17               dbo:assistantPrincipal  dul:coparticipatesWith\n",
       "18                        dbo:appointer       dul:sameSettingAs\n",
       "19                   dbo:followingEvent            dul:precedes\n",
       "20                              dbo:map         dul:hasLocation\n",
       "21    dbo:aircraftHelicopterObservation  dul:coparticipatesWith\n",
       "22                       dbo:subClassis             dbo:classis\n",
       "23                        dbo:tonyAward  dul:coparticipatesWith\n",
       "24                      dbo:distributor  dul:coparticipatesWith\n",
       "25                        dbo:showJudge      dul:hasParticipant\n",
       "26                   dbo:beatifiedPlace  dul:coparticipatesWith\n",
       "27                    dbo:subprefecture             dul:hasPart\n",
       "28                  dbo:foundationPlace         dul:hasLocation\n",
       "29                    dbo:sisterStation       dul:sameSettingAs\n",
       "..                                  ...                     ...\n",
       "941                            dbo:chef  dul:coparticipatesWith\n",
       "942                   dbo:countryOrigin  dul:coparticipatesWith\n",
       "943                  dbo:previousEntity       dul:sameSettingAs\n",
       "944  dbo:soccerTournamentMostSuccesfull        dul:isSettingFor\n",
       "945                      dbo:southPlace             dbo:closeTo\n",
       "946                   dbo:isoCodeRegion            dul:isPartOf\n",
       "947                           dbo:nerve        dul:isLocationOf\n",
       "948               dbo:poleDriverCountry      dul:hasParticipant\n",
       "949                 dbo:locationCountry         dul:hasLocation\n",
       "950                       dbo:publisher  dul:coparticipatesWith\n",
       "951                       dbo:portrayer  dul:coparticipatesWith\n",
       "952                    dbo:restingPlace         dul:hasLocation\n",
       "953             dbo:aircraftInterceptor  dul:coparticipatesWith\n",
       "954                          dbo:phylum     dul:isSpecializedBy\n",
       "955                       dbo:artPatron       dul:sameSettingAs\n",
       "956            dbo:currentWorldChampion      dul:hasParticipant\n",
       "957                     dbo:organSystem            dul:isPartOf\n",
       "958             dbo:philosophicalSchool          dul:isMemberOf\n",
       "959                      dbo:pastMember           dul:hasMember\n",
       "960                         dbo:regency       dul:sameSettingAs\n",
       "961                dbo:goldenGlobeAward  dul:coparticipatesWith\n",
       "962                       dbo:authority       dul:sameSettingAs\n",
       "963                          dbo:layout          dul:hasQuality\n",
       "964                      dbo:countySeat         dul:hasLocation\n",
       "965              dbo:aircraftHelicopter  dul:coparticipatesWith\n",
       "966              dbo:academicDiscipline             dul:isAbout\n",
       "967                       dbo:alpsGroup         dul:hasLocation\n",
       "968                     dbo:runningMate       dul:sameSettingAs\n",
       "969                dbo:championInDouble            dbo:champion\n",
       "970              dbo:thirdDriverCountry      dul:hasParticipant\n",
       "\n",
       "[971 rows x 2 columns]"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 163 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?from ?to {\n",
    "      ?from rdfs:subPropertyOf ?to .\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "It looks like terms on the left are always part of the DBpedia Ontology:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "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>from</th>\n",
       "      <th>to</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [from, to]\n",
       "Index: []"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 297 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?from ?to {\n",
    "      ?from rdfs:subPropertyOf ?to .\n",
    "      FILTER(!STRSTARTS(STR(?from),\"http://dbpedia.org/ontology/\"))\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Terms on the right are frequently part of the [http://ontologydesignpatterns.org/wiki/Ontology:DOLCE%2BDnS_Ultralite](http://ontologydesignpatterns.org/wiki/Ontology:DOLCE%2BDnS_Ultralite) (DUL)\n",
    "\n",
    "ontology and are a way to explain the meaning of DBpedia Ontology terms in terms of DUL.  Let's look at superproperties that aren't from the DUL ontology:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "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>from</th>\n",
       "      <th>to</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:codeMemorial</td>\n",
       "      <td>dbo:Code</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:subClassis</td>\n",
       "      <td>dbo:classis</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:nextEvent</td>\n",
       "      <td>dbo:followedBy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:dutchPPNCode</td>\n",
       "      <td>dbo:code</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:messierName</td>\n",
       "      <td>dbo:name</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:iso6391Code</td>\n",
       "      <td>dbo:LanguageCode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:distanceToCapital</td>\n",
       "      <td>dbo:Distance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:northWestPlace</td>\n",
       "      <td>dbo:closeTo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:chorusCharacterInPlay</td>\n",
       "      <td>dbo:characterInPlay</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:southEastPlace</td>\n",
       "      <td>dbo:closeTo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:northPlace</td>\n",
       "      <td>dbo:closeTo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:championInSingleFemale</td>\n",
       "      <td>dbo:championInSingle</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:dutchMIPCode</td>\n",
       "      <td>dbo:Code</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:literaryGenre</td>\n",
       "      <td>dbo:genre</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:homeColourHexCode</td>\n",
       "      <td>dbo:colourHexCode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:championInSingle</td>\n",
       "      <td>dbo:champion</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:olympicOathSwornByJudge</td>\n",
       "      <td>dbo:olympicOathSwornBy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:inseeCode</td>\n",
       "      <td>dbo:codeSettlement</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:championInDoubleMale</td>\n",
       "      <td>dbo:championInDouble</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:otherWins</td>\n",
       "      <td>dbo:Wins</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:iso6393Code</td>\n",
       "      <td>dbo:LanguageCode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>dbo:dutchWinkelID</td>\n",
       "      <td>dbo:code</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>dbo:dutchNAIdentifier</td>\n",
       "      <td>dbo:code</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>dbo:codeProvincialMonument</td>\n",
       "      <td>dbo:code</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>dbo:silverMedalist</td>\n",
       "      <td>dbo:Medalist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>dbo:zipCode</td>\n",
       "      <td>dbo:postalCode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>dbo:iso6392Code</td>\n",
       "      <td>dbo:LanguageCode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>dbo:northEastPlace</td>\n",
       "      <td>dbo:closeTo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>dbo:codeIndex</td>\n",
       "      <td>dbo:code</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>dbo:codeNationalMonument</td>\n",
       "      <td>dbo:code</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>dbo:silCode</td>\n",
       "      <td>dbo:LanguageCode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>dbo:premiereYear</td>\n",
       "      <td>dbo:releaseYear</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>dbo:superTribus</td>\n",
       "      <td>dbo:Tribus</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>dbo:protectionStatus</td>\n",
       "      <td>dbo:Status</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>dbo:ofsCode</td>\n",
       "      <td>dbo:isoCode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>dbo:codeLandRegistry</td>\n",
       "      <td>dbo:Code</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>dbo:commandant</td>\n",
       "      <td>dbo:keyPerson</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>dbo:maximumDepth</td>\n",
       "      <td>dbo:depth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>dbo:ngcName</td>\n",
       "      <td>dbo:name</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>dbo:senator</td>\n",
       "      <td>dbo:MemberOfParliament</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>56</th>\n",
       "      <td>dbo:olympicOathSwornByAthlete</td>\n",
       "      <td>dbo:olympicOathSwornBy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>dbo:communityIsoCode</td>\n",
       "      <td>dbo:isoCode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>58</th>\n",
       "      <td>dbo:rankingWins</td>\n",
       "      <td>dbo:Wins</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59</th>\n",
       "      <td>dbo:premiereDate</td>\n",
       "      <td>dbo:releaseDate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60</th>\n",
       "      <td>dbo:nextMission</td>\n",
       "      <td>dbo:followedBy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>61</th>\n",
       "      <td>dbo:playRole</td>\n",
       "      <td>dbo:uses</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>62</th>\n",
       "      <td>dbo:provinceIsoCode</td>\n",
       "      <td>dbo:isoCode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>63</th>\n",
       "      <td>dbo:eastPlace</td>\n",
       "      <td>dbo:closeTo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>64</th>\n",
       "      <td>dbo:championInSingleMale</td>\n",
       "      <td>dbo:championInSingle</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>65</th>\n",
       "      <td>dbo:goldMedalist</td>\n",
       "      <td>dbo:Medalist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>66</th>\n",
       "      <td>dbo:championInDoubleFemale</td>\n",
       "      <td>dbo:championInDouble</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>67</th>\n",
       "      <td>dbo:locationCountry</td>\n",
       "      <td>dbo:location</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>68</th>\n",
       "      <td>dbo:averageDepth</td>\n",
       "      <td>dbo:depth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>69</th>\n",
       "      <td>dbo:politicGovernmentDepartment</td>\n",
       "      <td>dbo:Department</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70</th>\n",
       "      <td>dbo:codeListOfHonour</td>\n",
       "      <td>dbo:code</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>71</th>\n",
       "      <td>dbo:ekatteCode</td>\n",
       "      <td>dbo:codeSettlement</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>72</th>\n",
       "      <td>dbo:alias</td>\n",
       "      <td>dbo:alternativeName</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>73</th>\n",
       "      <td>dbo:southWestPlace</td>\n",
       "      <td>dbo:closeTo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>dbo:southPlace</td>\n",
       "      <td>dbo:closeTo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>dbo:championInDouble</td>\n",
       "      <td>dbo:champion</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>76 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                               from                      to\n",
       "0                  dbo:codeMemorial                dbo:Code\n",
       "1                    dbo:subClassis             dbo:classis\n",
       "2                     dbo:nextEvent          dbo:followedBy\n",
       "3                  dbo:dutchPPNCode                dbo:code\n",
       "4                   dbo:messierName                dbo:name\n",
       "5                   dbo:iso6391Code        dbo:LanguageCode\n",
       "6             dbo:distanceToCapital            dbo:Distance\n",
       "7                dbo:northWestPlace             dbo:closeTo\n",
       "8         dbo:chorusCharacterInPlay     dbo:characterInPlay\n",
       "9                dbo:southEastPlace             dbo:closeTo\n",
       "10                   dbo:northPlace             dbo:closeTo\n",
       "11       dbo:championInSingleFemale    dbo:championInSingle\n",
       "12                 dbo:dutchMIPCode                dbo:Code\n",
       "13                dbo:literaryGenre               dbo:genre\n",
       "14            dbo:homeColourHexCode       dbo:colourHexCode\n",
       "15             dbo:championInSingle            dbo:champion\n",
       "16      dbo:olympicOathSwornByJudge  dbo:olympicOathSwornBy\n",
       "17                    dbo:inseeCode      dbo:codeSettlement\n",
       "18         dbo:championInDoubleMale    dbo:championInDouble\n",
       "19                    dbo:otherWins                dbo:Wins\n",
       "20                  dbo:iso6393Code        dbo:LanguageCode\n",
       "21                dbo:dutchWinkelID                dbo:code\n",
       "22            dbo:dutchNAIdentifier                dbo:code\n",
       "23       dbo:codeProvincialMonument                dbo:code\n",
       "24               dbo:silverMedalist            dbo:Medalist\n",
       "25                      dbo:zipCode          dbo:postalCode\n",
       "26                  dbo:iso6392Code        dbo:LanguageCode\n",
       "27               dbo:northEastPlace             dbo:closeTo\n",
       "28                    dbo:codeIndex                dbo:code\n",
       "29         dbo:codeNationalMonument                dbo:code\n",
       "..                              ...                     ...\n",
       "46                      dbo:silCode        dbo:LanguageCode\n",
       "47                 dbo:premiereYear         dbo:releaseYear\n",
       "48                  dbo:superTribus              dbo:Tribus\n",
       "49             dbo:protectionStatus              dbo:Status\n",
       "50                      dbo:ofsCode             dbo:isoCode\n",
       "51             dbo:codeLandRegistry                dbo:Code\n",
       "52                   dbo:commandant           dbo:keyPerson\n",
       "53                 dbo:maximumDepth               dbo:depth\n",
       "54                      dbo:ngcName                dbo:name\n",
       "55                      dbo:senator  dbo:MemberOfParliament\n",
       "56    dbo:olympicOathSwornByAthlete  dbo:olympicOathSwornBy\n",
       "57             dbo:communityIsoCode             dbo:isoCode\n",
       "58                  dbo:rankingWins                dbo:Wins\n",
       "59                 dbo:premiereDate         dbo:releaseDate\n",
       "60                  dbo:nextMission          dbo:followedBy\n",
       "61                     dbo:playRole                dbo:uses\n",
       "62              dbo:provinceIsoCode             dbo:isoCode\n",
       "63                    dbo:eastPlace             dbo:closeTo\n",
       "64         dbo:championInSingleMale    dbo:championInSingle\n",
       "65                 dbo:goldMedalist            dbo:Medalist\n",
       "66       dbo:championInDoubleFemale    dbo:championInDouble\n",
       "67              dbo:locationCountry            dbo:location\n",
       "68                 dbo:averageDepth               dbo:depth\n",
       "69  dbo:politicGovernmentDepartment          dbo:Department\n",
       "70             dbo:codeListOfHonour                dbo:code\n",
       "71                   dbo:ekatteCode      dbo:codeSettlement\n",
       "72                        dbo:alias     dbo:alternativeName\n",
       "73               dbo:southWestPlace             dbo:closeTo\n",
       "74                   dbo:southPlace             dbo:closeTo\n",
       "75             dbo:championInDouble            dbo:champion\n",
       "\n",
       "[76 rows x 2 columns]"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 292 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?from ?to {\n",
    "      ?from rdfs:subPropertyOf ?to .\n",
    "      FILTER(!STRSTARTS(STR(?to),\"http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#\"))\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Out of those 75 relationships,  I bet many of them point to the same superproperties:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>to</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>dbo:code</th>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:closeTo</th>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:LanguageCode</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:Code</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:championInDouble</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:Medalist</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:isPartOf</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:isoCode</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:followedBy</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:name</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:characterInPlay</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:championInSingle</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:colourHexCode</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:champion</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:olympicOathSwornBy</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:codeSettlement</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:Wins</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:Tribus</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:location</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:depth</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:classis</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:Distance</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:genre</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:postalCode</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:owner</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:ColourName</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:administrativeHeadCity</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:language</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:releaseYear</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:Status</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:keyPerson</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:MemberOfParliament</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:releaseDate</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:uses</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:Department</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo:alternativeName</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                            cnt\n",
       "to                             \n",
       "dbo:code                      9\n",
       "dbo:closeTo                   8\n",
       "dbo:LanguageCode              4\n",
       "dbo:Code                      3\n",
       "dbo:championInDouble          3\n",
       "dbo:Medalist                  3\n",
       "dbo:isPartOf                  3\n",
       "dbo:isoCode                   3\n",
       "dbo:followedBy                2\n",
       "dbo:name                      2\n",
       "dbo:characterInPlay           2\n",
       "dbo:championInSingle          2\n",
       "dbo:colourHexCode             2\n",
       "dbo:champion                  2\n",
       "dbo:olympicOathSwornBy        2\n",
       "dbo:codeSettlement            2\n",
       "dbo:Wins                      2\n",
       "dbo:Tribus                    2\n",
       "dbo:location                  2\n",
       "dbo:depth                     2\n",
       "dbo:classis                   1\n",
       "dbo:Distance                  1\n",
       "dbo:genre                     1\n",
       "dbo:postalCode                1\n",
       "dbo:owner                     1\n",
       "dbo:ColourName                1\n",
       "dbo:administrativeHeadCity    1\n",
       "dbo:language                  1\n",
       "dbo:releaseYear               1\n",
       "dbo:Status                    1\n",
       "dbo:keyPerson                 1\n",
       "dbo:MemberOfParliament        1\n",
       "dbo:releaseDate               1\n",
       "dbo:uses                      1\n",
       "dbo:Department                1\n",
       "dbo:alternativeName           1"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 296 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?to (COUNT(*) AS ?cnt) {\n",
    "      ?from rdfs:subPropertyOf ?to .\n",
    "      FILTER(!STRSTARTS(STR(?to),\"http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#\"))\n",
    "   } GROUP BY ?to ORDER BY DESC(?cnt)\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The most common superproperty is `dbo:code`,  which represents identifying codes.  For instance,\n",
    "this could be a postal Code,  UPC Code,  or a country or regional code.  Unfortunately,  only a small number of code-containing fields are so identified."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "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>about</th>\n",
       "      <th>from</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:codeMunicipalMonument</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:codeNationalMonument</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:WrittenWork</td>\n",
       "      <td>dbo:dutchPPNCode</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:codeProvincialMonument</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:UndergroundJournal</td>\n",
       "      <td>dbo:dutchWinkelID</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:Company</td>\n",
       "      <td>dbo:codeStockExchange</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:MemberResistanceMovement</td>\n",
       "      <td>dbo:codeListOfHonour</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:MemberResistanceMovement</td>\n",
       "      <td>dbo:codeIndex</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:MemberResistanceMovement</td>\n",
       "      <td>dbo:dutchNAIdentifier</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          about                        from\n",
       "0                     dbo:Place   dbo:codeMunicipalMonument\n",
       "1                     dbo:Place    dbo:codeNationalMonument\n",
       "2               dbo:WrittenWork            dbo:dutchPPNCode\n",
       "3                     dbo:Place  dbo:codeProvincialMonument\n",
       "4        dbo:UndergroundJournal           dbo:dutchWinkelID\n",
       "5                   dbo:Company       dbo:codeStockExchange\n",
       "6  dbo:MemberResistanceMovement        dbo:codeListOfHonour\n",
       "7  dbo:MemberResistanceMovement               dbo:codeIndex\n",
       "8  dbo:MemberResistanceMovement       dbo:dutchNAIdentifier"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 32.5 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?about ?from {\n",
    "      ?from \n",
    "          rdfs:subPropertyOf dbo:code ;\n",
    "          rdfs:domain ?about .\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Looking at the superproperty `dbo:closeTo`,  the subproperties represent (right-hand) locations that are adjacent to (left-hand) locations in the directions of the cardinal and ordinal ([definition](https://en.wikipedia.org/wiki/Cardinal_direction)) directions."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "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>about</th>\n",
       "      <th>from</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:northEastPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:southEastPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:southPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:westPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:northPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:eastPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:northWestPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:southWestPlace</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       about                from\n",
       "0  dbo:Place  dbo:northEastPlace\n",
       "1  dbo:Place  dbo:southEastPlace\n",
       "2  dbo:Place      dbo:southPlace\n",
       "3  dbo:Place       dbo:westPlace\n",
       "4  dbo:Place      dbo:northPlace\n",
       "5  dbo:Place       dbo:eastPlace\n",
       "6  dbo:Place  dbo:northWestPlace\n",
       "7  dbo:Place  dbo:southWestPlace"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 32 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?about ?from {\n",
    "      ?from \n",
    "          rdfs:subPropertyOf dbo:closeTo ;\n",
    "          rdfs:domain ?about .\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Looking a the superproperties in DUL,  these look much like the kind of properties one would expect to\n",
    "defined in an upper or middle ontology:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "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>cnt</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>to</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>dul:coparticipatesWith</th>\n",
       "      <td>226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:sameSettingAs</th>\n",
       "      <td>169</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:hasLocation</th>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:hasParticipant</th>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:isParticipantIn</th>\n",
       "      <td>42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:isPartOf</th>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:isClassifiedBy</th>\n",
       "      <td>38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:hasCommonBoundary</th>\n",
       "      <td>33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:isMemberOf</th>\n",
       "      <td>31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:hasPart</th>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:isLocationOf</th>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:hasQuality</th>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:isSettingFor</th>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:hasMember</th>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:isDescribedBy</th>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:specializes</th>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:nearTo</th>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:hasComponent</th>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:isSpecializedBy</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:isExpressedBy</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:hasSetting</th>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:hasRole</th>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:precedes</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:conceptualizes</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:hasConstituent</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:associatedWith</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:hasRegion</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:unifies</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:follows</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:isAbout</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:overlaps</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:concretelyExpresses</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul:isRoleOf</th>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                         cnt\n",
       "to                          \n",
       "dul:coparticipatesWith   226\n",
       "dul:sameSettingAs        169\n",
       "dul:hasLocation           85\n",
       "dul:hasParticipant        63\n",
       "dul:isParticipantIn       42\n",
       "dul:isPartOf              39\n",
       "dul:isClassifiedBy        38\n",
       "dul:hasCommonBoundary     33\n",
       "dul:isMemberOf            31\n",
       "dul:hasPart               26\n",
       "dul:isLocationOf          24\n",
       "dul:hasQuality            15\n",
       "dul:isSettingFor          15\n",
       "dul:hasMember             13\n",
       "dul:isDescribedBy          9\n",
       "dul:specializes            8\n",
       "dul:nearTo                 8\n",
       "dul:hasComponent           7\n",
       "dul:isSpecializedBy        6\n",
       "dul:isExpressedBy          6\n",
       "dul:hasSetting             6\n",
       "dul:hasRole                4\n",
       "dul:precedes               3\n",
       "dul:conceptualizes         3\n",
       "dul:hasConstituent         3\n",
       "dul:associatedWith         2\n",
       "dul:hasRegion              2\n",
       "dul:unifies                2\n",
       "dul:follows                2\n",
       "dul:isAbout                2\n",
       "dul:overlaps               1\n",
       "dul:concretelyExpresses    1\n",
       "dul:isRoleOf               1"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 272 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?to (COUNT(*) AS ?cnt) {\n",
    "      ?from rdfs:subPropertyOf ?to .\n",
    "      FILTER(STRSTARTS(STR(?to),\"http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#\"))\n",
    "   } GROUP BY ?to ORDER BY DESC(?cnt)\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A really  common kind of property is a \"part-of\" relationship,  known as *meronymy* if you like greek.  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {
    "scrolled": true
   },
   "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>domain</th>\n",
       "      <th>p</th>\n",
       "      <th>range</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:Department</td>\n",
       "      <td>dbo:prefecture</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>http://dbpedia.org/ontology/Parish,_Deanery</td>\n",
       "      <td>dbo:diocese</td>\n",
       "      <td>dbo:Diocese</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:Island</td>\n",
       "      <td>dbo:governmentRegion</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>http://dbpedia.org/ontology/Diocese,_Parish</td>\n",
       "      <td>dbo:deanery</td>\n",
       "      <td>dbo:Deanery</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:Mountain</td>\n",
       "      <td>dbo:mountainRange</td>\n",
       "      <td>dbo:MountainRange</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:Settlement</td>\n",
       "      <td>dbo:federalState</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:WineRegion</td>\n",
       "      <td>dbo:isPartOfWineRegion</td>\n",
       "      <td>dbo:WineRegion</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:Island</td>\n",
       "      <td>dbo:lowestState</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:province</td>\n",
       "      <td>dbo:Province</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:MilitaryConflict</td>\n",
       "      <td>dbo:isPartOfMilitaryConflict</td>\n",
       "      <td>dbo:MilitaryConflict</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "      <td>dbo:lieutenancyArea</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "      <td>dbo:metropolitanBorough</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "      <td>dbo:oldDistrict</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:provinceLink</td>\n",
       "      <td>dbo:Province</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:Settlement</td>\n",
       "      <td>dbo:isoCodeRegion</td>\n",
       "      <td>xsd:string</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "      <td>dbo:councilArea</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:Brain</td>\n",
       "      <td>dbo:isPartOfAnatomicalStructure</td>\n",
       "      <td>dbo:AnatomicalStructure</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:AnatomicalStructure</td>\n",
       "      <td>dbo:organSystem</td>\n",
       "      <td>dbo:AnatomicalStructure</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:district</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:Country</td>\n",
       "      <td>dbo:continent</td>\n",
       "      <td>dbo:Continent</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "      <td>dbo:parish</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>dbo:Place</td>\n",
       "      <td>dbo:sovereignCountry</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>dbo:Settlement</td>\n",
       "      <td>dbo:geolocDepartment</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "      <td>dbo:sheading</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>dbo:Settlement</td>\n",
       "      <td>dbo:jointCommunity</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "      <td>dbo:oldProvince</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "      <td>dbo:department</td>\n",
       "      <td>dbo:PopulatedPlace</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                         domain                                p  \\\n",
       "0                                dbo:Department                   dbo:prefecture   \n",
       "1   http://dbpedia.org/ontology/Parish,_Deanery                      dbo:diocese   \n",
       "2                                    dbo:Island             dbo:governmentRegion   \n",
       "3   http://dbpedia.org/ontology/Diocese,_Parish                      dbo:deanery   \n",
       "4                                  dbo:Mountain                dbo:mountainRange   \n",
       "5                                dbo:Settlement                 dbo:federalState   \n",
       "6                                dbo:WineRegion           dbo:isPartOfWineRegion   \n",
       "7                                    dbo:Island                  dbo:lowestState   \n",
       "8                                     dbo:Place                     dbo:province   \n",
       "9                          dbo:MilitaryConflict     dbo:isPartOfMilitaryConflict   \n",
       "10                           dbo:PopulatedPlace              dbo:lieutenancyArea   \n",
       "11                           dbo:PopulatedPlace          dbo:metropolitanBorough   \n",
       "12                           dbo:PopulatedPlace                  dbo:oldDistrict   \n",
       "13                                    dbo:Place                 dbo:provinceLink   \n",
       "14                               dbo:Settlement                dbo:isoCodeRegion   \n",
       "15                           dbo:PopulatedPlace                  dbo:councilArea   \n",
       "16                                    dbo:Brain  dbo:isPartOfAnatomicalStructure   \n",
       "17                      dbo:AnatomicalStructure                  dbo:organSystem   \n",
       "18                                    dbo:Place                     dbo:district   \n",
       "19                                  dbo:Country                    dbo:continent   \n",
       "20                           dbo:PopulatedPlace                       dbo:parish   \n",
       "21                                    dbo:Place             dbo:sovereignCountry   \n",
       "22                               dbo:Settlement             dbo:geolocDepartment   \n",
       "23                           dbo:PopulatedPlace                     dbo:sheading   \n",
       "24                               dbo:Settlement               dbo:jointCommunity   \n",
       "25                           dbo:PopulatedPlace                  dbo:oldProvince   \n",
       "26                           dbo:PopulatedPlace                   dbo:department   \n",
       "\n",
       "                      range  \n",
       "0        dbo:PopulatedPlace  \n",
       "1               dbo:Diocese  \n",
       "2        dbo:PopulatedPlace  \n",
       "3               dbo:Deanery  \n",
       "4         dbo:MountainRange  \n",
       "5        dbo:PopulatedPlace  \n",
       "6            dbo:WineRegion  \n",
       "7        dbo:PopulatedPlace  \n",
       "8              dbo:Province  \n",
       "9      dbo:MilitaryConflict  \n",
       "10       dbo:PopulatedPlace  \n",
       "11       dbo:PopulatedPlace  \n",
       "12       dbo:PopulatedPlace  \n",
       "13             dbo:Province  \n",
       "14               xsd:string  \n",
       "15       dbo:PopulatedPlace  \n",
       "16  dbo:AnatomicalStructure  \n",
       "17  dbo:AnatomicalStructure  \n",
       "18       dbo:PopulatedPlace  \n",
       "19            dbo:Continent  \n",
       "20       dbo:PopulatedPlace  \n",
       "21       dbo:PopulatedPlace  \n",
       "22       dbo:PopulatedPlace  \n",
       "23       dbo:PopulatedPlace  \n",
       "24       dbo:PopulatedPlace  \n",
       "25       dbo:PopulatedPlace  \n",
       "26       dbo:PopulatedPlace  "
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 52 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "   SELECT ?domain ?p ?range {\n",
    "      ?p \n",
    "          rdfs:subPropertyOf dul:isPartOf ;\n",
    "          rdfs:domain ?domain ;\n",
    "          rdfs:range ?range .\n",
    "   }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Equivalent Property\n",
    "\n",
    "The case of \"part of\" properties is a good example of a subproperty relationship in that,  say,  \"Mountain X is a part of Y Mountain range\" is clearly a specialization of \"X is a part of Y.\"  That's different from the case where two properties mean exactly the same thing.\n",
    "\n",
    "Let's take a look at equivalent properties defined in the DBpedia Ontology:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "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>a</th>\n",
       "      <th>b</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:icaoAirlineCode</td>\n",
       "      <td>http://www.wikidata.org/entity/P230</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:absoluteMagnitude</td>\n",
       "      <td>http://www.wikidata.org/entity/P1457</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:generalManager</td>\n",
       "      <td>http://www.wikidata.org/entity/P505</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:followedBy</td>\n",
       "      <td>http://www.wikidata.org/entity/P156</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:alias</td>\n",
       "      <td>http://www.wikidata.org/entity/P742</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:director</td>\n",
       "      <td>http://www.wikidata.org/entity/P57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:foundingDate</td>\n",
       "      <td>http://www.wikidata.org/entity/P571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:doctoralStudent</td>\n",
       "      <td>http://www.wikidata.org/entity/P185</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:unloCode</td>\n",
       "      <td>http://www.wikidata.org/entity/P1937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:birthDate</td>\n",
       "      <td>http://www.wikidata.org/entity/P569</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:iso31661Code</td>\n",
       "      <td>http://www.wikidata.org/entity/P298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:religion</td>\n",
       "      <td>http://www.wikidata.org/entity/P140</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:iataAirlineCode</td>\n",
       "      <td>http://www.wikidata.org/entity/P229</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:numberOfPages</td>\n",
       "      <td>schema:numberOfPages</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:coordinates</td>\n",
       "      <td>http://www.wikidata.org/entity/P625</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:ideology</td>\n",
       "      <td>http://www.wikidata.org/entity/P1142</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:kingdom</td>\n",
       "      <td>http://www.wikidata.org/entity/P75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:orientation</td>\n",
       "      <td>http://www.wikidata.org/entity/P91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:dcc</td>\n",
       "      <td>http://www.wikidata.org/entity/P1036</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:iso31661Code</td>\n",
       "      <td>http://www.wikidata.org/entity/P299</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:artist</td>\n",
       "      <td>schema:byArtist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>dbo:instrument</td>\n",
       "      <td>http://www.wikidata.org/entity/P1303</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>dbo:picture</td>\n",
       "      <td>schema:image</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>dbo:albumRuntime</td>\n",
       "      <td>schema:duration</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>dbo:placeOfBurial</td>\n",
       "      <td>http://www.wikidata.org/entity/P119</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>dbo:originalLanguage</td>\n",
       "      <td>http://www.wikidata.org/entity/P364</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>dbo:duration</td>\n",
       "      <td>schema:duration</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>dbo:city</td>\n",
       "      <td>http://www.wikidata.org/entity/P131</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>dbo:locatedInArea</td>\n",
       "      <td>http://www.wikidata.org/entity/P131</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>dbo:deathDate</td>\n",
       "      <td>schema:deathDate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>192</th>\n",
       "      <td>dbo:selibrId</td>\n",
       "      <td>http://www.wikidata.org/entity/P906</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>193</th>\n",
       "      <td>dbo:bSide</td>\n",
       "      <td>http://www.wikidata.org/entity/P1432</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>194</th>\n",
       "      <td>dbo:artist</td>\n",
       "      <td>http://www.wikidata.org/entity/P175</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>dbo:okatoCode</td>\n",
       "      <td>http://www.wikidata.org/entity/P721</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>dbo:cosparId</td>\n",
       "      <td>http://www.wikidata.org/entity/P247</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>dbo:ofsCode</td>\n",
       "      <td>http://www.wikidata.org/entity/P771</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>dbo:illustrator</td>\n",
       "      <td>http://www.wikidata.org/entity/P110</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>dbo:relative</td>\n",
       "      <td>schema:relatedTo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>200</th>\n",
       "      <td>dbo:endDate</td>\n",
       "      <td>schema:endDate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>201</th>\n",
       "      <td>dbo:citizenship</td>\n",
       "      <td>http://www.wikidata.org/entity/P27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>202</th>\n",
       "      <td>dbo:club</td>\n",
       "      <td>dbo:team</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>203</th>\n",
       "      <td>dbo:atomicNumber</td>\n",
       "      <td>http://www.wikidata.org/entity/P1086</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>204</th>\n",
       "      <td>dbo:jureLanguage</td>\n",
       "      <td>dbo:language</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>205</th>\n",
       "      <td>dbo:filmRuntime</td>\n",
       "      <td>schema:duration</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>206</th>\n",
       "      <td>dbo:headquarter</td>\n",
       "      <td>http://www.wikidata.org/entity/P159</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>207</th>\n",
       "      <td>dbo:namedAfter</td>\n",
       "      <td>http://www.wikidata.org/entity/P138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>208</th>\n",
       "      <td>dbo:inseeCode</td>\n",
       "      <td>http://www.wikidata.org/entity/P374</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>209</th>\n",
       "      <td>dbo:meshId</td>\n",
       "      <td>http://www.wikidata.org/entity/P486</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>210</th>\n",
       "      <td>dbo:employer</td>\n",
       "      <td>http://www.wikidata.org/entity/P108</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>211</th>\n",
       "      <td>dbo:killedBy</td>\n",
       "      <td>http://www.wikidata.org/entity/P157</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>212</th>\n",
       "      <td>dbo:follows</td>\n",
       "      <td>http://www.wikidata.org/entity/P155</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>213</th>\n",
       "      <td>dbo:crewMember</td>\n",
       "      <td>http://www.wikidata.org/entity/P1029</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>214</th>\n",
       "      <td>dbo:icd9</td>\n",
       "      <td>http://www.wikidata.org/entity/P493</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>215</th>\n",
       "      <td>dbo:publisher</td>\n",
       "      <td>schema:publisher</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>216</th>\n",
       "      <td>dbo:director</td>\n",
       "      <td>schema:director</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>217</th>\n",
       "      <td>dbo:rkdArtistsId</td>\n",
       "      <td>http://www.wikidata.org/entity/P650</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>218</th>\n",
       "      <td>dbo:numberOfEpisodes</td>\n",
       "      <td>schema:numberOfEpisodes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>219</th>\n",
       "      <td>dbo:order</td>\n",
       "      <td>http://www.wikidata.org/entity/P70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>220</th>\n",
       "      <td>dbo:compressionRatio</td>\n",
       "      <td>http://www.wikidata.org/entity/P1247</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>221</th>\n",
       "      <td>dbo:composer</td>\n",
       "      <td>http://www.wikidata.org/entity/P86</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>222 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                         a                                     b\n",
       "0      dbo:icaoAirlineCode   http://www.wikidata.org/entity/P230\n",
       "1    dbo:absoluteMagnitude  http://www.wikidata.org/entity/P1457\n",
       "2       dbo:generalManager   http://www.wikidata.org/entity/P505\n",
       "3           dbo:followedBy   http://www.wikidata.org/entity/P156\n",
       "4                dbo:alias   http://www.wikidata.org/entity/P742\n",
       "5             dbo:director    http://www.wikidata.org/entity/P57\n",
       "6         dbo:foundingDate   http://www.wikidata.org/entity/P571\n",
       "7      dbo:doctoralStudent   http://www.wikidata.org/entity/P185\n",
       "8             dbo:unloCode  http://www.wikidata.org/entity/P1937\n",
       "9            dbo:birthDate   http://www.wikidata.org/entity/P569\n",
       "10        dbo:iso31661Code   http://www.wikidata.org/entity/P298\n",
       "11            dbo:religion   http://www.wikidata.org/entity/P140\n",
       "12     dbo:iataAirlineCode   http://www.wikidata.org/entity/P229\n",
       "13       dbo:numberOfPages                  schema:numberOfPages\n",
       "14         dbo:coordinates   http://www.wikidata.org/entity/P625\n",
       "15            dbo:ideology  http://www.wikidata.org/entity/P1142\n",
       "16             dbo:kingdom    http://www.wikidata.org/entity/P75\n",
       "17         dbo:orientation    http://www.wikidata.org/entity/P91\n",
       "18                 dbo:dcc  http://www.wikidata.org/entity/P1036\n",
       "19        dbo:iso31661Code   http://www.wikidata.org/entity/P299\n",
       "20              dbo:artist                       schema:byArtist\n",
       "21          dbo:instrument  http://www.wikidata.org/entity/P1303\n",
       "22             dbo:picture                          schema:image\n",
       "23        dbo:albumRuntime                       schema:duration\n",
       "24       dbo:placeOfBurial   http://www.wikidata.org/entity/P119\n",
       "25    dbo:originalLanguage   http://www.wikidata.org/entity/P364\n",
       "26            dbo:duration                       schema:duration\n",
       "27                dbo:city   http://www.wikidata.org/entity/P131\n",
       "28       dbo:locatedInArea   http://www.wikidata.org/entity/P131\n",
       "29           dbo:deathDate                      schema:deathDate\n",
       "..                     ...                                   ...\n",
       "192           dbo:selibrId   http://www.wikidata.org/entity/P906\n",
       "193              dbo:bSide  http://www.wikidata.org/entity/P1432\n",
       "194             dbo:artist   http://www.wikidata.org/entity/P175\n",
       "195          dbo:okatoCode   http://www.wikidata.org/entity/P721\n",
       "196           dbo:cosparId   http://www.wikidata.org/entity/P247\n",
       "197            dbo:ofsCode   http://www.wikidata.org/entity/P771\n",
       "198        dbo:illustrator   http://www.wikidata.org/entity/P110\n",
       "199           dbo:relative                      schema:relatedTo\n",
       "200            dbo:endDate                        schema:endDate\n",
       "201        dbo:citizenship    http://www.wikidata.org/entity/P27\n",
       "202               dbo:club                              dbo:team\n",
       "203       dbo:atomicNumber  http://www.wikidata.org/entity/P1086\n",
       "204       dbo:jureLanguage                          dbo:language\n",
       "205        dbo:filmRuntime                       schema:duration\n",
       "206        dbo:headquarter   http://www.wikidata.org/entity/P159\n",
       "207         dbo:namedAfter   http://www.wikidata.org/entity/P138\n",
       "208          dbo:inseeCode   http://www.wikidata.org/entity/P374\n",
       "209             dbo:meshId   http://www.wikidata.org/entity/P486\n",
       "210           dbo:employer   http://www.wikidata.org/entity/P108\n",
       "211           dbo:killedBy   http://www.wikidata.org/entity/P157\n",
       "212            dbo:follows   http://www.wikidata.org/entity/P155\n",
       "213         dbo:crewMember  http://www.wikidata.org/entity/P1029\n",
       "214               dbo:icd9   http://www.wikidata.org/entity/P493\n",
       "215          dbo:publisher                      schema:publisher\n",
       "216           dbo:director                       schema:director\n",
       "217       dbo:rkdArtistsId   http://www.wikidata.org/entity/P650\n",
       "218   dbo:numberOfEpisodes               schema:numberOfEpisodes\n",
       "219              dbo:order    http://www.wikidata.org/entity/P70\n",
       "220   dbo:compressionRatio  http://www.wikidata.org/entity/P1247\n",
       "221           dbo:composer    http://www.wikidata.org/entity/P86\n",
       "\n",
       "[222 rows x 2 columns]"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 90 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?a ?b {\n",
    "        ?a owl:equivalentProperty ?b\n",
    "    }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Many of these properties are from Wikidata,  so it probably makes sense to bind a namespace for Wikidata."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 2 ms\n"
     ]
    }
   ],
   "source": [
    "g.bind(\"wikidata\",\"http://www.wikidata.org/entity/\")\n",
    "e=LocalEndpoint(g)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This kind of equivalency with Wikidata is meaningful precisely because DBpedia and Wikidata are competitive (and cooperative) databases that cover the same domain.  Let's take a look at equivalencies to databases other than Wikidata:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "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>a</th>\n",
       "      <th>b</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:numberOfPages</td>\n",
       "      <td>schema:numberOfPages</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:artist</td>\n",
       "      <td>schema:byArtist</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:picture</td>\n",
       "      <td>schema:image</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:albumRuntime</td>\n",
       "      <td>schema:duration</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:duration</td>\n",
       "      <td>schema:duration</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>dbo:deathDate</td>\n",
       "      <td>schema:deathDate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>dbo:illustrator</td>\n",
       "      <td>schema:illustrator</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>dbo:startDate</td>\n",
       "      <td>schema:startDate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>dbo:episodeNumber</td>\n",
       "      <td>schema:episodeNumber</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>dbo:author</td>\n",
       "      <td>schema:author</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>dbo:parentOrganisation</td>\n",
       "      <td>schema:branchOf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>dbo:firstPublisher</td>\n",
       "      <td>schema:publisher</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>dbo:nationality</td>\n",
       "      <td>schema:nationality</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>dbo:language</td>\n",
       "      <td>schema:inLanguage</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>dbo:genre</td>\n",
       "      <td>schema:genre</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>dbo:award</td>\n",
       "      <td>schema:awards</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>dbo:spouse</td>\n",
       "      <td>schema:spouse</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>dbo:runtime</td>\n",
       "      <td>schema:duration</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>dbo:isbn</td>\n",
       "      <td>schema:isbn</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>dbo:landArea</td>\n",
       "      <td>dbo:area</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>dbo:waterArea</td>\n",
       "      <td>dbo:area</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>dbo:mediaType</td>\n",
       "      <td>schema:bookFormat</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>dbo:map</td>\n",
       "      <td>schema:maps</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>dbo:deFactoLanguage</td>\n",
       "      <td>dbo:language</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>dbo:producer</td>\n",
       "      <td>schema:producer</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>dbo:restingDate</td>\n",
       "      <td>schema:deathDate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>dbo:locatedInArea</td>\n",
       "      <td>schema:containedIn</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>dbo:birthDate</td>\n",
       "      <td>schema:birthDate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>dbo:starring</td>\n",
       "      <td>schema:actors</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>dbo:musicComposer</td>\n",
       "      <td>schema:musicBy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>dbo:relative</td>\n",
       "      <td>schema:relatedTo</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>dbo:endDate</td>\n",
       "      <td>schema:endDate</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>dbo:club</td>\n",
       "      <td>dbo:team</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>dbo:jureLanguage</td>\n",
       "      <td>dbo:language</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>dbo:filmRuntime</td>\n",
       "      <td>schema:duration</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>dbo:publisher</td>\n",
       "      <td>schema:publisher</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>dbo:director</td>\n",
       "      <td>schema:director</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>dbo:numberOfEpisodes</td>\n",
       "      <td>schema:numberOfEpisodes</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                         a                        b\n",
       "0        dbo:numberOfPages     schema:numberOfPages\n",
       "1               dbo:artist          schema:byArtist\n",
       "2              dbo:picture             schema:image\n",
       "3         dbo:albumRuntime          schema:duration\n",
       "4             dbo:duration          schema:duration\n",
       "5            dbo:deathDate         schema:deathDate\n",
       "6          dbo:illustrator       schema:illustrator\n",
       "7            dbo:startDate         schema:startDate\n",
       "8        dbo:episodeNumber     schema:episodeNumber\n",
       "9               dbo:author            schema:author\n",
       "10  dbo:parentOrganisation          schema:branchOf\n",
       "11      dbo:firstPublisher         schema:publisher\n",
       "12         dbo:nationality       schema:nationality\n",
       "13            dbo:language        schema:inLanguage\n",
       "14               dbo:genre             schema:genre\n",
       "15               dbo:award            schema:awards\n",
       "16              dbo:spouse            schema:spouse\n",
       "17             dbo:runtime          schema:duration\n",
       "18                dbo:isbn              schema:isbn\n",
       "19            dbo:landArea                 dbo:area\n",
       "20           dbo:waterArea                 dbo:area\n",
       "21           dbo:mediaType        schema:bookFormat\n",
       "22                 dbo:map              schema:maps\n",
       "23     dbo:deFactoLanguage             dbo:language\n",
       "24            dbo:producer          schema:producer\n",
       "25         dbo:restingDate         schema:deathDate\n",
       "26       dbo:locatedInArea       schema:containedIn\n",
       "27           dbo:birthDate         schema:birthDate\n",
       "28            dbo:starring            schema:actors\n",
       "29       dbo:musicComposer           schema:musicBy\n",
       "30            dbo:relative         schema:relatedTo\n",
       "31             dbo:endDate           schema:endDate\n",
       "32                dbo:club                 dbo:team\n",
       "33        dbo:jureLanguage             dbo:language\n",
       "34         dbo:filmRuntime          schema:duration\n",
       "35           dbo:publisher         schema:publisher\n",
       "36            dbo:director          schema:director\n",
       "37    dbo:numberOfEpisodes  schema:numberOfEpisodes"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 117 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?a ?b {\n",
    "        ?a owl:equivalentProperty ?b\n",
    "        FILTER(!STRSTARTS(STR(?b),\"http://www.wikidata.org/entity/\"))\n",
    "    }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The vast number of those link to schema.org,  except for a handful which link to other DBpedia Ontology properties."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "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>a</th>\n",
       "      <th>b</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>dbo:landArea</td>\n",
       "      <td>dbo:area</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>dbo:waterArea</td>\n",
       "      <td>dbo:area</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>dbo:deFactoLanguage</td>\n",
       "      <td>dbo:language</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>dbo:club</td>\n",
       "      <td>dbo:team</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>dbo:jureLanguage</td>\n",
       "      <td>dbo:language</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     a             b\n",
       "0         dbo:landArea      dbo:area\n",
       "1        dbo:waterArea      dbo:area\n",
       "2  dbo:deFactoLanguage  dbo:language\n",
       "3             dbo:club      dbo:team\n",
       "4     dbo:jureLanguage  dbo:language"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 98 ms\n"
     ]
    }
   ],
   "source": [
    "e.select(\"\"\"\n",
    "    SELECT ?a ?b {\n",
    "        ?a owl:equivalentProperty ?b\n",
    "        FILTER(STRSTARTS(STR(?b),\"http://dbpedia.org/ontology/\"))\n",
    "    }\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The quality of these equivalencies are questionable to me;  for instance,  in geography,  people often publish separate \"land area\" and \"water areas\" for a region.  Still,  out of 30,000 facts,  I've seen fewer than 30 that looked obviously wrong:  an error rate of 0.1% is not bad on some terms,  but if we put these facts into a reasoning system,  small errors in the schema can result in an avalanche of inferred facts resulting in a disproportionately large impact on results."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Namespaces\n",
    "\n",
    "Rather than starting with a complete list of namespaces used in the DBpedia Ontology,  I gradually added them as they turned up in queries.  It would be nice to have a tool that automatically generates this kind of list,  but for the time being,  I am saving this list here for future reference."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "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>prefix</th>\n",
       "      <th>namespace</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>bibo</th>\n",
       "      <td>http://purl.org/ontology/bibo/</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>cc</th>\n",
       "      <td>http://creativecommons.org/ns#</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbo</th>\n",
       "      <td>http://dbpedia.org/ontology/</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dc</th>\n",
       "      <td>http://purl.org/dc/terms/</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dul</th>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dzero</th>\n",
       "      <td>http://www.ontologydesignpatterns.org/ont/d0.owl#</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>foaf</th>\n",
       "      <td>http://xmlns.com/foaf/0.1/</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>owl</th>\n",
       "      <td>http://www.w3.org/2002/07/owl#</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>prov</th>\n",
       "      <td>http://www.w3.org/ns/prov#</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdf</th>\n",
       "      <td>http://www.w3.org/1999/02/22-rdf-syntax-ns#</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>rdfs</th>\n",
       "      <td>http://www.w3.org/2000/01/rdf-schema#</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>schema</th>\n",
       "      <td>http://schema.org/</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>skos</th>\n",
       "      <td>http://www.w3.org/2004/02/skos/core#</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>type</th>\n",
       "      <td>http://dbpedia.org/datatype/</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>vann</th>\n",
       "      <td>http://purl.org/vocab/vann/</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>wikidata</th>\n",
       "      <td>http://www.wikidata.org/entity/</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xml</th>\n",
       "      <td>http://www.w3.org/XML/1998/namespace</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>xsd</th>\n",
       "      <td>http://www.w3.org/2001/XMLSchema#</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "prefix                                                 namespace\n",
       "bibo                              http://purl.org/ontology/bibo/\n",
       "cc                                http://creativecommons.org/ns#\n",
       "dbo                                 http://dbpedia.org/ontology/\n",
       "dc                                     http://purl.org/dc/terms/\n",
       "dul       http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#\n",
       "dzero          http://www.ontologydesignpatterns.org/ont/d0.owl#\n",
       "foaf                                  http://xmlns.com/foaf/0.1/\n",
       "owl                               http://www.w3.org/2002/07/owl#\n",
       "prov                                  http://www.w3.org/ns/prov#\n",
       "rdf                  http://www.w3.org/1999/02/22-rdf-syntax-ns#\n",
       "rdfs                       http://www.w3.org/2000/01/rdf-schema#\n",
       "schema                                        http://schema.org/\n",
       "skos                        http://www.w3.org/2004/02/skos/core#\n",
       "type                                http://dbpedia.org/datatype/\n",
       "vann                                 http://purl.org/vocab/vann/\n",
       "wikidata                         http://www.wikidata.org/entity/\n",
       "xml                         http://www.w3.org/XML/1998/namespace\n",
       "xsd                            http://www.w3.org/2001/XMLSchema#"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 15 ms\n"
     ]
    }
   ],
   "source": [
    "e.namespaces()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Conclusion and next steps\n",
    "\n",
    "In this notebook,  I've made a quick survey of the contents of the DBpedia Ontology.  This data set is useful to build into the \"local\" tests for Gastrodon because it is small enough to work with in memory,  but complex enough to be a real-life example.  For other notebooks,  I work over the queries and data repeatedly to eliminate imperfections that make the notebooks unclear,  but here the data set is a fixed target,  which makes it a good shakedown cruise for Gastrodon in which I was able to fix a number of bugs and make a number of improvements.\n",
    "\n",
    "One longer term goal is to explore data from DBpedia and use it as a basis for visualization and data analysis.  The next step towards that is to gather data from the full DBpedia that will help prioritize the exploration (which properties really get used?) and answer some questions that are still unclear (what about the data types which aren't used the schema?)\n",
    "\n",
    "Another goal is to develop tools to further simplify the exploration of data sets and schemas.  The `top_properties` function defined above is an example of the kind of function that could be built into a function library that would reduce the need to write so many SPARQL queries by hand."
   ]
  }
 ],
 "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.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
