Last active
August 29, 2015 14:01
-
-
Save drcjar/f318994fdc2031241f6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX owl: <http://www.w3.org/2002/07/owl#> | |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX foaf: <http://xmlns.com/foaf/0.1/> | |
PREFIX dc: <http://purl.org/dc/elements/1.1/> | |
PREFIX : <http://dbpedia.org/resource/> | |
PREFIX dbpedia2: <http://dbpedia.org/property/> | |
PREFIX dbpedia: <http://dbpedia.org/> | |
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> | |
PREFIX dbo: <http://dbpedia.org/ontology/> | |
SELECT DISTINCT ?person ?occupation ?cause WHERE { | |
?person dbo:occupation ?occupation . | |
?person dbo:deathCause ?cause . | |
} | |
ORDER BY ?person |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "wikideaths" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "import os, datetime\nimport pandas as pd\nimport pickle\nimport csv\nimport xlrd\nfrom pandas import Series, DataFrame, Panel\nfrom datetime import datetime, date, timedelta\nfrom os import sys\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport folium", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "wdf1 = pd.read_csv('sparql')", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 123 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "wdf1.cause.describe()", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 124, | |
"text": "count 3929\nunique 325\ntop http://dbpedia.org/resource/Myocardial_infarction\nfreq 594\nName: cause, dtype: object" | |
} | |
], | |
"prompt_number": 124 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "wdf1.occupation.describe()", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 125, | |
"text": "count 3929\nunique 2615\ntop http://dbpedia.org/resource/Actor\nfreq 341\nName: occupation, dtype: object" | |
} | |
], | |
"prompt_number": 125 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "wdf1.occupation.value_counts()", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 129, | |
"text": "http://dbpedia.org/resource/Actor 341\nhttp://dbpedia.org/resource/Film_director 45\nhttp://dbpedia.org/resource/Comedian 45\nhttp://dbpedia.org/resource/Child_actor 32\nhttp://dbpedia.org/resource/Writer 31\nhttp://dbpedia.org/resource/Singing 30\nhttp://dbpedia.org/resource/Film_producer 29\nhttp://dbpedia.org/resource/Journalist 28\nhttp://dbpedia.org/resource/Screenwriter 27\nhttp://dbpedia.org/resource/Businessperson 23\nhttp://dbpedia.org/resource/Presenter 21\nhttp://dbpedia.org/resource/Film 21\nhttp://dbpedia.org/resource/Television_producer 19\nhttp://dbpedia.org/resource/Television 18\nhttp://dbpedia.org/resource/Voice_acting 18\n...\nhttp://dbpedia.org/resource/Nora_Denney__1 1\nhttp://dbpedia.org/resource/Nate_Watt__1 1\nhttp://dbpedia.org/resource/Landscape_architecture 1\nhttp://dbpedia.org/resource/Confidence_trick 1\nhttp://dbpedia.org/resource/Friedrich_Akel__3 1\nhttp://dbpedia.org/resource/Friedrich_Akel__2 1\nhttp://dbpedia.org/resource/Friedrich_Akel__1 1\nhttp://dbpedia.org/resource/Geoffrey_Hughes__1 1\nhttp://dbpedia.org/resource/Lee_Matasi__1 1\nhttp://dbpedia.org/resource/Alex_Macdonald_(trade_unionist)__1 1\nhttp://dbpedia.org/resource/James_H._Snook__1 1\nhttp://dbpedia.org/resource/Peter_Ling__1 1\nhttp://dbpedia.org/resource/Floristry 1\nhttp://dbpedia.org/resource/Donald_Justin_Wolfram__1 1\nhttp://dbpedia.org/resource/Pete_Postlethwaite__1 1\nLength: 2615, dtype: int64" | |
} | |
], | |
"prompt_number": 129 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "wdf1.cause.value_counts()[:10]", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 137, | |
"text": "http://dbpedia.org/resource/Myocardial_infarction 594\nhttp://dbpedia.org/resource/Cancer 312\nhttp://dbpedia.org/resource/Pneumonia 201\nhttp://dbpedia.org/resource/Stroke 167\nhttp://dbpedia.org/resource/Lung_cancer 167\nhttp://dbpedia.org/resource/Heart_failure 165\nhttp://dbpedia.org/resource/Suicide 146\nhttp://dbpedia.org/resource/Pancreatic_cancer 88\nhttp://dbpedia.org/resource/Murder 77\nhttp://dbpedia.org/resource/Death_by_natural_causes 72\ndtype: int64" | |
} | |
], | |
"prompt_number": 137 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "wdf1[wdf1['cause'] == 'http://dbpedia.org/resource/Lung_cancer'].occupation.value_counts()[:10]", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 136, | |
"text": "http://dbpedia.org/resource/Actor 25\nhttp://dbpedia.org/resource/Writer 3\nhttp://dbpedia.org/resource/Comedian 3\nhttp://dbpedia.org/resource/Presenter 2\nhttp://dbpedia.org/resource/Television 2\nhttp://dbpedia.org/resource/Musician 2\nhttp://dbpedia.org/resource/Television_producer 2\nhttp://dbpedia.org/resource/Film_director 2\nhttp://dbpedia.org/resource/Dance 2\nhttp://dbpedia.org/resource/Voice_acting 2\ndtype: int64" | |
} | |
], | |
"prompt_number": 136 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "wdf1[wdf1['cause'] == 'http://dbpedia.org/resource/Murder'].occupation.value_counts()[:10]", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 138, | |
"text": "http://dbpedia.org/resource/Maryknoll 2\nhttp://dbpedia.org/resource/Police_officer 2\nhttp://dbpedia.org/resource/Rum-running 2\nhttp://dbpedia.org/resource/Crime 1\nhttp://dbpedia.org/resource/Skateboarding 1\nhttp://dbpedia.org/resource/Dean_O'Banion__2 1\nhttp://dbpedia.org/resource/Harry_Lazarus__1 1\nhttp://dbpedia.org/resource/Student 1\nhttp://dbpedia.org/resource/Singing 1\nhttp://dbpedia.org/resource/John_Williams_Gunnison__1 1\ndtype: int64" | |
} | |
], | |
"prompt_number": 138 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "wdf1[(wdf1['cause'] == 'http://dbpedia.org/resource/Murder') & (wdf1['occupation'] == 'http://dbpedia.org/resource/Skateboarding')]", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>person</th>\n <th>occupation</th>\n <th>cause</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>2227</th>\n <td> http://dbpedia.org/resource/Lee_Matasi</td>\n <td> http://dbpedia.org/resource/Skateboarding</td>\n <td> http://dbpedia.org/resource/Murder</td>\n </tr>\n </tbody>\n</table>\n<p>1 rows \u00d7 3 columns</p>\n</div>", | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 140, | |
"text": " person \\\n2227 http://dbpedia.org/resource/Lee_Matasi \n\n occupation \\\n2227 http://dbpedia.org/resource/Skateboarding \n\n cause \n2227 http://dbpedia.org/resource/Murder \n\n[1 rows x 3 columns]" | |
} | |
], | |
"prompt_number": 140 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": "", | |
"language": "python", | |
"metadata": {}, | |
"outputs": [] | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment