{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Introduction to SPARQL, RDF, and LOD\n", "\n", "While many databases, services, or museums might expose their data via a web API, there can be limitations. Matthew Lincoln has an excellent tutorial at [The Programming Historian](https://programminghistorian.org/en/lessons/graph-databases-and-SPARQL) that walks us through some of these differences, but the key one is in the way the data is represented. When data is described using a 'Resource Description Framework', RDF, the resource - the 'thing'- is described via a series of relationships, rather than as rows in a table or keys having values. \n", "\n", "Information is in the relationships. It's a network. It's a _graph_. Thus, every 'thing' in this graph can have its own _uniform resource identifier_ (URI) that lives as a location on the internet. Information can then be created by making _statements_ that use these URIs, similarly to how English grammar creates meaning: subject verb object. Or, in RDF-speak, 'subject predicate object', also known as a _triple_. In this way, data in _different_ places can be linked together by referencing the elements they have in common. This is Linked Open Data (LOD). The access point for interrogating LOD is called an 'endpoint'. \n", "\n", "Finally, _SPARQL_ is an acronymn for SPARQL Protocol and RDF Query Language (yes, it's one of _those_ kinds of acronyms).\n", "\n", "In this notebook, we're not using Python or R directly. Instead, we've set up a 'kernel' (think of that as the 'engine' for the notebook) that already includes everything necessary to set up and run SPARQL queries. (For reference, the kernel code is [here](https://github.com/paulovn/sparql-kernel)). Both R and Python can interact with and query endpoints, and manipulate linked open data, but for the sake of learning a bit of what one can do with SPARQL, this notebook keeps all of that ancillary code tucked away. The [followup notebook](Using R to Retrieve and Visualize Data from SPARQL.ipynb) to this one shows you how to use R to do some basic manipulations of the query results." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---\n", "\n", "## Simple RDF example\n", "\n", "Here, we are following [Matthew Lincoln's tutorial](https://programminghistorian.org/en/lessons/graph-databases-and-SPARQL). \n", "\n", "Let's look at his example, which concerns the painting, 'The Nightwatch'. \n", "\n", "` .`\n", "\n", "This _statement_ has three elements: \n", "\n", "+ the subject: ``\n", "+ the predicate: ``\n", "+ the object: ``\n", "\n", "Lincoln combines these, and other such statements, into a (pseudo-)RDF database like so:\n", "\n", "```\n", " .\n", " <1642> .\n", " .\n", " <1606> .\n", " .\n", " .\n", " .\n", " .\n", "```\n", "\n", "Such RDF databases are describing nodes and links, and so we can visualize as a graph like so:\n", "\n", "![A network visualization of the pseudo-RDF shown above. Arrows indicate the ‘direction’ of the predicate. For example, that ‘Woman with a Balance was created by Vermeer’, and not the other way around.](https://programminghistorian.org/images/graph-databases-and-SPARQL/sparql01.svg)\n", "\n", "But there is a difference between the pseudo-RDF that Lincoln shows us, and what _actual_ RDF might look like:\n", "\n", "```\n", " \n", "```\n", "\n", "The human-readable version requires _more_ statements:\n", "\n", "```\n", " \"The Nightwatch\" .\n", "\n", " \"was created by\" .\n", "\n", " \"Rembrandt van Rijn\" .\n", "```\n", "\n", "This is just a quick introduction; please do examine [Lincoln's tutorial](https://programminghistorian.org/en/lessons/graph-databases-and-SPARQL) for more details. But now, let's explore how this notebook can be used to write some queries.\n", "\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Available magics:
%auth %display %endpoint %format %graph %lang %log %lsmagics %outfile %prefix %qparam %show

%auth (basic|digest|none) <username> <passwd> : send HTTP authentication
%display raw | table [withtypes] | diagram [svg|png] [withliterals] : set display format
%endpoint <url> : set SPARQL endpoint. **REQUIRED**
%format JSON | N3 | XML | any | default : set requested result format
%graph <uri> : set default graph for the queries
%lang <lang> [...] | default | all : language(s) preferred for labels
%log critical | error | warning | info | debug : set logging level
%lsmagics : list all magics
%outfile <filename> | NONE : save raw output to a file (use "%d" in name to add cell number, "NONE" to cancel saving)
%prefix <name> [<uri>] : set (or delete) a persistent URI prefix for all queries
%qparam <name> [<value>] : add (or delete) a persistent custom parameter to the endpoint query
%show <n> | all : maximum number of shown results
" ], "text/plain": [ "Available magics:\n", "%auth %display %endpoint %format %graph %lang %log %lsmagics %outfile %prefix %qparam %show\n", "\n", "%auth (basic|digest|none) : send HTTP authentication\n", "%display raw | table [withtypes] | diagram [svg|png] [withliterals] : set display format\n", "%endpoint : set SPARQL endpoint. **REQUIRED**\n", "%format JSON | N3 | XML | any | default : set requested result format\n", "%graph : set default graph for the queries\n", "%lang [...] | default | all : language(s) preferred for labels\n", "%log critical | error | warning | info | debug : set logging level\n", "%lsmagics : list all magics\n", "%outfile | NONE : save raw output to a file (use \"%d\" in name to add cell number, \"NONE\" to cancel saving)\n", "%prefix [] : set (or delete) a persistent URI prefix for all queries\n", "%qparam [] : add (or delete) a persistent custom parameter to the endpoint query\n", "%show | all : maximum number of shown results\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Jupyter notebooks have various built-in commands called 'magics' that are accessed with the '%' character; these depend on the kernel. \n", "# Let's see what the SPARQL kernel has\n", "%lsmagics" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Endpoint set to: http://collection.britishmuseum.org/sparql
" ], "text/plain": [ "Endpoint set to: http://collection.britishmuseum.org/sparql\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# when using this notebook, the first thing we have to do - or rather, the first time we run _any_ query,\n", "# is to tell it what endpoint we're going to use. Let's use the British Museum's:\n", "\n", "%endpoint http://collection.britishmuseum.org/sparql" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lincoln suggests that when we first encountered a new RDF graph, that we explore the network of relationships from an example object to understand what is going on in the database, to see what is available for querying. Since we're querying the British Museum, let's take [the Rosetta Stone](http://collection.britishmuseum.org/id/object/YCA62958) as our example.\n", "\n", "In the query below, `p` and `o` stand for 'predicate' and 'object'. Thus, we're building up a query that asks, 'show me every statment structured ` `. When the results load up, you can right-click on each statement (which is a URI, remember) to see what we've discovered. This could give you the necessary information to construct more complicated queries.\n", "\n", "*Nb* The British Museum sparql endpoint and the underlying infrastructure does not appear to be well supported. Results are sometimes flaky or not reachable." ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
ptypeotype
http://www.cidoc-crm.org/cidoc-crm/P138i_has_representationurihttps://images.researchspace.org/collectionimages/AN00020/AN00020516_001_l.jpguri
http://www.cidoc-crm.org/cidoc-crm/P138i_has_representationurihttps://images.researchspace.org/collectionimages/AN00773/AN00773236_001_l.jpguri
http://www.cidoc-crm.org/cidoc-crm/P138i_has_representationurihttps://images.researchspace.org/collectionimages/AN00773/AN00773255_001_l.jpguri
http://www.cidoc-crm.org/cidoc-crm/P138i_has_representationurihttps://images.researchspace.org/collectionimages/AN00871/AN00871967_001_l.jpguri
http://www.cidoc-crm.org/cidoc-crm/P138i_has_representationurihttps://images.researchspace.org/collectionimages/AN00928/AN00928245_001_l.jpguri
http://www.researchspace.org/ontology/PX_has_main_representationurihttps://images.researchspace.org/collectionimages/AN00016/AN00016456_004_l.jpguri
http://www.researchspace.org/ontology/Thing_created_on_Timeurihttp://collection.britishmuseum.org/id/object/YCA62958/production/1/dateuri
http://www.researchspace.org/ontology/Thing_has_material_type_Concepturihttp://collection.britishmuseum.org/id/thesauri/x10901uri
http://www.researchspace.org/ontology/Thing_has_material_type_Concepturihttp://collection.britishmuseum.org/id/thesauri/x11794uri
http://www.researchspace.org/ontology/Thing_has_material_type_Concepturihttp://collection.britishmuseum.org/id/thesauri/x11014uri
http://www.researchspace.org/ontology/Thing_instance_of_Classurihttp://www.cidoc-crm.org/cidoc-crm/E1_CRM_Entityuri
http://www.researchspace.org/ontology/Thing_instance_of_Classurihttp://www.cidoc-crm.org/cidoc-crm/E18_Physical_Thinguri
http://www.researchspace.org/ontology/Thing_instance_of_Classurihttp://www.cidoc-crm.org/cidoc-crm/E19_Physical_Objecturi
http://www.researchspace.org/ontology/Thing_instance_of_Classurihttp://www.cidoc-crm.org/cidoc-crm/E24_Physical_Man-Made_Thinguri
http://www.researchspace.org/ontology/Thing_instance_of_Classurihttp://www.cidoc-crm.org/cidoc-crm/E70_Thinguri
http://www.researchspace.org/ontology/Thing_instance_of_Classurihttp://www.cidoc-crm.org/cidoc-crm/E71_Man-Made_Thinguri
http://www.researchspace.org/ontology/Thing_instance_of_Classurihttp://www.cidoc-crm.org/cidoc-crm/E72_Legal_Objecturi
http://www.researchspace.org/ontology/Thing_instance_of_Classurihttp://www.cidoc-crm.org/cidoc-crm/E77_Persistent_Itemuri
http://www.researchspace.org/ontology/Thing_instance_of_Classurihttp://www.cidoc-crm.org/cidoc-crm/E22_Man-Made_Objecturi
http://www.researchspace.org/ontology/Thing_refers_to_Thingurihttp://collection.britishmuseum.org/id/object/YCA62958/inscription/1uri
Total: 234, Shown: 20
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "SELECT ?p ?o\n", "WHERE {\n", " ?p ?o .\n", "}\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this next query, we look for objects in the collection that have the label 'fibula'." ] }, { "cell_type": "code", "execution_count": 91, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
Endpoint set to: http://collection.britishmuseum.org/sparql
Display: table
" ], "text/plain": [ "Endpoint set to: http://collection.britishmuseum.org/sparql\n", "Display: table\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%endpoint http://collection.britishmuseum.org/sparql\n", "%display table\n", "PREFIX bmo: \n", "PREFIX skos: \n", "\n", "SELECT ?object\n", "WHERE {\n", "\n", " # Search for all values of ?object that have a given \"object type\"\n", " ?object bmo:PX_object_type ?object_type .\n", "\n", " # That object type should have the label \"fibula\"\n", " ?object_type skos:prefLabel \"fibula\" .\n", "}\n", "LIMIT 10" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Wikidata\n", "\n", "Wikidata is another endpoint we can query. Below we have a query by Sebastian Heath that extracts some of the genealogical data on Roman emperors contained in that database. The `wd:Q842606` can be expanded to refer to [https://www.wikidata.org/wiki/Q842606](https://www.wikidata.org/wiki/Q842606), which describes the concept 'Roman Emperor'. `wdt:P39` is a predicate meaning 'Position held' [https://www.wikidata.org/wiki/Property:P39](https://www.wikidata.org/wiki/Property:P39). " ] }, { "cell_type": "code", "execution_count": 75, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
Endpoint set to: http://query.wikidata.org/sparql
Display: table
" ], "text/plain": [ "Endpoint set to: http://query.wikidata.org/sparql\n", "Display: table\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
emperorLabelemperor_dobchildLabelmotherLabelmaternalGrandfatherLabelmaternalGrandmotherLabelemperorchildmothermaternalGrandfathermaternalGrandmother
Augustus-062-01-01T00:00:00ZJulia the ElderScriboniaLucius Scribonius Libohttp://www.wikidata.org/entity/Q1405http://www.wikidata.org/entity/Q2259http://www.wikidata.org/entity/Q233444http://www.wikidata.org/entity/Q1159617
Tiberius-041-11-14T00:00:00ZTiberius Julius CaesarJulia the ElderAugustusScriboniahttp://www.wikidata.org/entity/Q1407http://www.wikidata.org/entity/Q4222774http://www.wikidata.org/entity/Q2259http://www.wikidata.org/entity/Q1405http://www.wikidata.org/entity/Q233444
Tiberius-041-11-14T00:00:00ZDrusus Julius CaesarVipsania AgrippinaMarcus Vipsanius AgrippaPomponia Caecilia Atticahttp://www.wikidata.org/entity/Q1407http://www.wikidata.org/entity/Q313737http://www.wikidata.org/entity/Q232090http://www.wikidata.org/entity/Q48174http://www.wikidata.org/entity/Q152626
Claudius-009-07-30T00:00:00ZClaudia OctaviaMessalinaMarcus Valerius Messalla BarbatusDomitia Lepida the Youngerhttp://www.wikidata.org/entity/Q1411http://www.wikidata.org/entity/Q231262http://www.wikidata.org/entity/Q229871http://www.wikidata.org/entity/Q1246807http://www.wikidata.org/entity/Q268964
Claudius-009-07-30T00:00:00ZBritannicusMessalinaMarcus Valerius Messalla BarbatusDomitia Lepida the Youngerhttp://www.wikidata.org/entity/Q1411http://www.wikidata.org/entity/Q313115http://www.wikidata.org/entity/Q229871http://www.wikidata.org/entity/Q1246807http://www.wikidata.org/entity/Q268964
Claudius-009-07-30T00:00:00ZClaudius DrususPlautia UrgulanillaMarcus Plautius Silvanushttp://www.wikidata.org/entity/Q1411http://www.wikidata.org/entity/Q2975271http://www.wikidata.org/entity/Q236259http://www.wikidata.org/entity/Q1232026
Claudius-009-07-30T00:00:00ZClaudia AntoniaAelia PaetinaSextus Aelius Catushttp://www.wikidata.org/entity/Q1411http://www.wikidata.org/entity/Q255410http://www.wikidata.org/entity/Q238448http://www.wikidata.org/entity/Q778051
Vespasian0009-11-15T00:00:00ZTitusDomitilla the ElderFlavius Liberalishttp://www.wikidata.org/entity/Q1419http://www.wikidata.org/entity/Q1421http://www.wikidata.org/entity/Q241102http://www.wikidata.org/entity/Q1114524
Vespasian0009-11-15T00:00:00ZDomitianDomitilla the ElderFlavius Liberalishttp://www.wikidata.org/entity/Q1419http://www.wikidata.org/entity/Q1423http://www.wikidata.org/entity/Q241102http://www.wikidata.org/entity/Q1114524
Vespasian0009-11-15T00:00:00ZDomitilla the YoungerDomitilla the ElderFlavius Liberalishttp://www.wikidata.org/entity/Q1419http://www.wikidata.org/entity/Q260156http://www.wikidata.org/entity/Q241102http://www.wikidata.org/entity/Q1114524
Caligula0012-08-29T00:00:00ZJulia DrusillaMilonia CaesoniaVistiliahttp://www.wikidata.org/entity/Q1409http://www.wikidata.org/entity/Q235586http://www.wikidata.org/entity/Q240928http://www.wikidata.org/entity/Q3658103
Vitellius0015-09-22T00:00:00ZVitellius GermanicusGaleria Fundanahttp://www.wikidata.org/entity/Q1417http://www.wikidata.org/entity/Q662631http://www.wikidata.org/entity/Q260039
Nero0037-12-13T00:00:00ZClaudia AugustaPoppaea SabinaTitus Olliushttp://www.wikidata.org/entity/Q1413http://www.wikidata.org/entity/Q1275952http://www.wikidata.org/entity/Q230716http://www.wikidata.org/entity/Q7810322
Titus0039-12-28T00:00:00ZJulia FlaviaMarcia FurnillaQuintus Marcius Barea Surahttp://www.wikidata.org/entity/Q1421http://www.wikidata.org/entity/Q239314http://www.wikidata.org/entity/Q731059http://www.wikidata.org/entity/Q16203434
Titus0039-12-28T00:00:00ZJulia FlaviaArrecina Tertullahttp://www.wikidata.org/entity/Q1421http://www.wikidata.org/entity/Q239314http://www.wikidata.org/entity/Q1528430
Antoninus Pius0086-09-17T00:00:00ZFaustina the YoungerFaustina the ElderMarcus Annius VerusRupiliahttp://www.wikidata.org/entity/Q1429http://www.wikidata.org/entity/Q236936http://www.wikidata.org/entity/Q234734http://www.wikidata.org/entity/Q745241http://www.wikidata.org/entity/Q2068391
Marcus Aurelius Antoninus0121-04-25T00:00:00ZCommodusFaustina the YoungerAntoninus PiusFaustina the Elderhttp://www.wikidata.org/entity/Q1430http://www.wikidata.org/entity/Q1434http://www.wikidata.org/entity/Q236936http://www.wikidata.org/entity/Q1429http://www.wikidata.org/entity/Q234734
Marcus Aurelius Antoninus0121-04-25T00:00:00ZLucillaFaustina the YoungerAntoninus PiusFaustina the Elderhttp://www.wikidata.org/entity/Q1430http://www.wikidata.org/entity/Q242466http://www.wikidata.org/entity/Q236936http://www.wikidata.org/entity/Q1429http://www.wikidata.org/entity/Q234734
Marcus Aurelius Antoninus0121-04-25T00:00:00ZAnnia Cornificia Faustina MinorFaustina the YoungerAntoninus PiusFaustina the Elderhttp://www.wikidata.org/entity/Q1430http://www.wikidata.org/entity/Q441706http://www.wikidata.org/entity/Q236936http://www.wikidata.org/entity/Q1429http://www.wikidata.org/entity/Q234734
Marcus Aurelius Antoninus0121-04-25T00:00:00ZMarcus Annius Verus CaesarFaustina the YoungerAntoninus PiusFaustina the Elderhttp://www.wikidata.org/entity/Q1430http://www.wikidata.org/entity/Q567222http://www.wikidata.org/entity/Q236936http://www.wikidata.org/entity/Q1429http://www.wikidata.org/entity/Q234734
Total: 82, Shown: 20
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%endpoint http://query.wikidata.org/sparql\n", "%display table\n", "\n", "SELECT ?emperorLabel ?emperor_dob\n", " ?childLabel\n", " ?motherLabel ?maternalGrandfatherLabel ?maternalGrandmotherLabel\n", " ?emperor ?child ?mother ?maternalGrandfather ?maternalGrandmother WHERE {\n", " \n", " ?emperor wdt:P39 wd:Q842606 . #p39: position held. Q842606: Roman Emperor\n", " ?emperor wdt:P569 ?emperor_dob . # p569: date of birth\n", " ?child wdt:P22 ?emperor . #p22: father\n", " ?child wdt:P25 ?mother . #p25: mother\n", " OPTIONAL { ?mother wdt:P22 ?maternalGrandfather }\n", " OPTIONAL { ?mother wdt:P25 ?maternalGrandmother }\n", " \n", " # automatic label expander\n", " SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\". }\n", " \n", "} ORDER BY ?emperor_dob\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's visualize these relationships. We're running the same query, but we use CONSTRUCT to create the nodes and edges that represent these familial relationships. We want to show 'emperor x is the father of person y' and 'person a is the mother of person y'. That gives us the structure. To get the content, we run the SELECT command where we first tell it to retrieve those individuals who were emperor, and then retrieve the children data. \n", "\n", "Once you've run the query, use ctrl+f to find someone familiar, like Augustus (Q1405). In the resulting graph, an edge labeled 'p22' eg Q1405 ->P22 -> Q2259 can be read, 'Q1405 is the father of Q2259', or rather, 'Augustus is the father of Julia the Elder'.\n", "\n", "Roman geneaology.... it's complicated! " ] }, { "cell_type": "code", "execution_count": 122, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Endpoint set to: http://query.wikidata.org/sparql
Display: svg
" ], "text/plain": [ "Endpoint set to: http://query.wikidata.org/sparql\n", "Display: svg\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", "\n", "\n", "%3\n", "\n", "\n", "\n", "node0\n", "\n", "Q1407\n", "\n", "\n", "\n", "\n", "\n", "node1\n", "\n", "Q313737\n", "\n", "\n", "\n", "\n", "\n", "node0->node1\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node41\n", "\n", "Q4222774\n", "\n", "\n", "\n", "\n", "\n", "node0->node41\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node2\n", "\n", "Q1430\n", "\n", "\n", "\n", "\n", "\n", "node3\n", "\n", "Q2055853\n", "\n", "\n", "\n", "\n", "\n", "node2->node3\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node44\n", "\n", "Q3656003\n", "\n", "\n", "\n", "\n", "\n", "node2->node44\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node79\n", "\n", "Q3655950\n", "\n", "\n", "\n", "\n", "\n", "node2->node79\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node81\n", "\n", "Q567222\n", "\n", "\n", "\n", "\n", "\n", "node2->node81\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node97\n", "\n", "Q242466\n", "\n", "\n", "\n", "\n", "\n", "node2->node97\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node106\n", "\n", "Q1434\n", "\n", "\n", "\n", "\n", "\n", "node2->node106\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node115\n", "\n", "Q441706\n", "\n", "\n", "\n", "\n", "\n", "node2->node115\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node4\n", "\n", "Q46720\n", "\n", "\n", "\n", "\n", "\n", "node5\n", "\n", "Q46846\n", "\n", "\n", "\n", "\n", "\n", "node4->node5\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node42\n", "\n", "Q189108\n", "\n", "\n", "\n", "\n", "\n", "node4->node42\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node102\n", "\n", "Q236999\n", "\n", "\n", "\n", "\n", "\n", "node4->node102\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node6\n", "\n", "Q164210\n", "\n", "\n", "\n", "\n", "\n", "node7\n", "\n", "Q234562\n", "\n", "\n", "\n", "\n", "\n", "node6->node7\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node8\n", "\n", "Q1327859\n", "\n", "\n", "\n", "\n", "\n", "node9\n", "\n", "Q13130598\n", "\n", "\n", "\n", "\n", "\n", "node8->node9\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node33\n", "\n", "Q3887731\n", "\n", "\n", "\n", "\n", "\n", "node8->node33\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node51\n", "\n", "Q4067684\n", "\n", "\n", "\n", "\n", "\n", "node8->node51\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node107\n", "\n", "Q507675\n", "\n", "\n", "\n", "\n", "\n", "node8->node107\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node10\n", "\n", "Q159369\n", "\n", "\n", "\n", "\n", "\n", "node11\n", "\n", "Q160353\n", "\n", "\n", "\n", "\n", "\n", "node10->node11\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node69\n", "\n", "Q231919\n", "\n", "\n", "\n", "\n", "\n", "node10->node69\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node108\n", "\n", "Q2696588\n", "\n", "\n", "\n", "\n", "\n", "node10->node108\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node55\n", "\n", "Q232329\n", "\n", "\n", "\n", "\n", "\n", "node11->node55\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node12\n", "\n", "Q2479052\n", "\n", "\n", "\n", "\n", "\n", "node13\n", "\n", "Q453551\n", "\n", "\n", "\n", "\n", "\n", "node12->node13\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node14\n", "\n", "Q1411\n", "\n", "\n", "\n", "\n", "\n", "node15\n", "\n", "Q313115\n", "\n", "\n", "\n", "\n", "\n", "node14->node15\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node27\n", "\n", "Q255410\n", "\n", "\n", "\n", "\n", "\n", "node14->node27\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node124\n", "\n", "Q231262\n", "\n", "\n", "\n", "\n", "\n", "node14->node124\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node132\n", "\n", "Q2975271\n", "\n", "\n", "\n", "\n", "\n", "node14->node132\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node16\n", "\n", "Q46418\n", "\n", "\n", "\n", "\n", "\n", "node17\n", "\n", "Q437472\n", "\n", "\n", "\n", "\n", "\n", "node16->node17\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node18\n", "\n", "Q232094\n", "\n", "\n", "\n", "\n", "\n", "node19\n", "\n", "Q504556\n", "\n", "\n", "\n", "\n", "\n", "node18->node19\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node24\n", "\n", "Q238023\n", "\n", "\n", "\n", "\n", "\n", "node18->node24\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node39\n", "\n", "Q486630\n", "\n", "\n", "\n", "\n", "\n", "node18->node39\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node75\n", "\n", "Q291738\n", "\n", "\n", "\n", "\n", "\n", "node18->node75\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node87\n", "\n", "Q450702\n", "\n", "\n", "\n", "\n", "\n", "node18->node87\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node105\n", "\n", "Q1427539\n", "\n", "\n", "\n", "\n", "\n", "node18->node105\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node20\n", "\n", "Q211772\n", "\n", "\n", "\n", "\n", "\n", "node21\n", "\n", "Q882941\n", "\n", "\n", "\n", "\n", "\n", "node20->node21\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node23\n", "\n", "Q2528282\n", "\n", "\n", "\n", "\n", "\n", "node20->node23\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node62\n", "\n", "Q2269678\n", "\n", "\n", "\n", "\n", "\n", "node20->node62\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node96\n", "\n", "Q2271845\n", "\n", "\n", "\n", "\n", "\n", "node20->node96\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node127\n", "\n", "Q2322166\n", "\n", "\n", "\n", "\n", "\n", "node20->node127\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node22\n", "\n", "Q380773\n", "\n", "\n", "\n", "\n", "\n", "node22->node21\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node22->node23\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node22->node62\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node22->node96\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node22->node127\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node25\n", "\n", "Q166731\n", "\n", "\n", "\n", "\n", "\n", "node24->node25\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node26\n", "\n", "Q238448\n", "\n", "\n", "\n", "\n", "\n", "node26->node27\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node28\n", "\n", "Q236466\n", "\n", "\n", "\n", "\n", "\n", "node29\n", "\n", "Q273253\n", "\n", "\n", "\n", "\n", "\n", "node28->node29\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node129\n", "\n", "Q46837\n", "\n", "\n", "\n", "\n", "\n", "node28->node129\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node30\n", "\n", "Q1405\n", "\n", "\n", "\n", "\n", "\n", "node31\n", "\n", "Q2259\n", "\n", "\n", "\n", "\n", "\n", "node30->node31\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node31->node41\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node32\n", "\n", "Q211396\n", "\n", "\n", "\n", "\n", "\n", "node32->node9\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node32->node33\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node32->node51\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node32->node107\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node34\n", "\n", "Q229246\n", "\n", "\n", "\n", "\n", "\n", "node35\n", "\n", "Q183089\n", "\n", "\n", "\n", "\n", "\n", "node34->node35\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node103\n", "\n", "Q1446\n", "\n", "\n", "\n", "\n", "\n", "node34->node103\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node36\n", "\n", "Q241474\n", "\n", "\n", "\n", "\n", "\n", "node37\n", "\n", "Q318865\n", "\n", "\n", "\n", "\n", "\n", "node36->node37\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node38\n", "\n", "Q131195\n", "\n", "\n", "\n", "\n", "\n", "node38->node19\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node38->node24\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node38->node39\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node53\n", "\n", "Q8413\n", "\n", "\n", "\n", "\n", "\n", "node38->node53\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node38->node75\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node38->node87\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node38->node105\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node39->node75\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node40\n", "\n", "Q1442\n", "\n", "\n", "\n", "\n", "\n", "node40->node35\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node40->node103\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node43\n", "\n", "Q236936\n", "\n", "\n", "\n", "\n", "\n", "node43->node3\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node43->node44\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node43->node79\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node43->node81\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node43->node97\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node43->node106\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node43->node115\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node45\n", "\n", "Q174323\n", "\n", "\n", "\n", "\n", "\n", "node46\n", "\n", "Q260033\n", "\n", "\n", "\n", "\n", "\n", "node45->node46\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node47\n", "\n", "Q184549\n", "\n", "\n", "\n", "\n", "\n", "node47->node25\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node48\n", "\n", "Q1413\n", "\n", "\n", "\n", "\n", "\n", "node49\n", "\n", "Q1275952\n", "\n", "\n", "\n", "\n", "\n", "node48->node49\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node50\n", "\n", "Q230716\n", "\n", "\n", "\n", "\n", "\n", "node50->node49\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node52\n", "\n", "Q233444\n", "\n", "\n", "\n", "\n", "\n", "node52->node31\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node53->node16\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node54\n", "\n", "Q464452\n", "\n", "\n", "\n", "\n", "\n", "node53->node54\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node66\n", "\n", "Q46734\n", "\n", "\n", "\n", "\n", "\n", "node53->node66\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node89\n", "\n", "Q311646\n", "\n", "\n", "\n", "\n", "\n", "node53->node89\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node91\n", "\n", "Q1001933\n", "\n", "\n", "\n", "\n", "\n", "node53->node91\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node111\n", "\n", "Q185538\n", "\n", "\n", "\n", "\n", "\n", "node53->node111\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node55->node45\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node59\n", "\n", "Q462395\n", "\n", "\n", "\n", "\n", "\n", "node55->node59\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node56\n", "\n", "Q1419\n", "\n", "\n", "\n", "\n", "\n", "node57\n", "\n", "Q1421\n", "\n", "\n", "\n", "\n", "\n", "node56->node57\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node70\n", "\n", "Q1423\n", "\n", "\n", "\n", "\n", "\n", "node56->node70\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node125\n", "\n", "Q260156\n", "\n", "\n", "\n", "\n", "\n", "node56->node125\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node74\n", "\n", "Q239314\n", "\n", "\n", "\n", "\n", "\n", "node57->node74\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node58\n", "\n", "Q170026\n", "\n", "\n", "\n", "\n", "\n", "node58->node45\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node58->node59\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node60\n", "\n", "Q1417\n", "\n", "\n", "\n", "\n", "\n", "node61\n", "\n", "Q662631\n", "\n", "\n", "\n", "\n", "\n", "node60->node61\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node63\n", "\n", "Q1248608\n", "\n", "\n", "\n", "\n", "\n", "node64\n", "\n", "Q104475\n", "\n", "\n", "\n", "\n", "\n", "node63->node64\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node90\n", "\n", "Q552224\n", "\n", "\n", "\n", "\n", "\n", "node64->node90\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node99\n", "\n", "Q297494\n", "\n", "\n", "\n", "\n", "\n", "node64->node99\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node65\n", "\n", "Q231063\n", "\n", "\n", "\n", "\n", "\n", "node65->node16\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node65->node54\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node65->node66\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node65->node91\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node65->node111\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node67\n", "\n", "Q201905\n", "\n", "\n", "\n", "\n", "\n", "node67->node58\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node88\n", "\n", "Q232271\n", "\n", "\n", "\n", "\n", "\n", "node67->node88\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node68\n", "\n", "Q232981\n", "\n", "\n", "\n", "\n", "\n", "node68->node11\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node68->node69\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node68->node108\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node71\n", "\n", "Q46696\n", "\n", "\n", "\n", "\n", "\n", "node71->node10\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node72\n", "\n", "Q237907\n", "\n", "\n", "\n", "\n", "\n", "node71->node72\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node77\n", "\n", "Q159798\n", "\n", "\n", "\n", "\n", "\n", "node71->node77\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node83\n", "\n", "Q1282616\n", "\n", "\n", "\n", "\n", "\n", "node71->node83\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node72->node58\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node72->node88\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node73\n", "\n", "Q731059\n", "\n", "\n", "\n", "\n", "\n", "node73->node74\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node76\n", "\n", "Q235603\n", "\n", "\n", "\n", "\n", "\n", "node76->node10\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node76->node77\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node76->node83\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node78\n", "\n", "Q193678\n", "\n", "\n", "\n", "\n", "\n", "node78->node46\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node80\n", "\n", "Q1817\n", "\n", "\n", "\n", "\n", "\n", "node80->node37\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node82\n", "\n", "Q229871\n", "\n", "\n", "\n", "\n", "\n", "node82->node15\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node82->node124\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node84\n", "\n", "Q1429\n", "\n", "\n", "\n", "\n", "\n", "node84->node43\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node85\n", "\n", "Q1409\n", "\n", "\n", "\n", "\n", "\n", "node86\n", "\n", "Q235586\n", "\n", "\n", "\n", "\n", "\n", "node85->node86\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node92\n", "\n", "Q240928\n", "\n", "\n", "\n", "\n", "\n", "node92->node86\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node93\n", "\n", "Q1528430\n", "\n", "\n", "\n", "\n", "\n", "node93->node74\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node94\n", "\n", "Q2724125\n", "\n", "\n", "\n", "\n", "\n", "node95\n", "\n", "Q46840\n", "\n", "\n", "\n", "\n", "\n", "node94->node95\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node98\n", "\n", "Q43107\n", "\n", "\n", "\n", "\n", "\n", "node98->node7\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node100\n", "\n", "Q234734\n", "\n", "\n", "\n", "\n", "\n", "node100->node43\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node101\n", "\n", "Q1233341\n", "\n", "\n", "\n", "\n", "\n", "node101->node42\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node102->node72\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node104\n", "\n", "Q239015\n", "\n", "\n", "\n", "\n", "\n", "node104->node90\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node104->node99\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node109\n", "\n", "Q241102\n", "\n", "\n", "\n", "\n", "\n", "node109->node57\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node109->node70\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node109->node125\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node110\n", "\n", "Q260039\n", "\n", "\n", "\n", "\n", "\n", "node110->node61\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node112\n", "\n", "Q63533\n", "\n", "\n", "\n", "\n", "\n", "node112->node17\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node113\n", "\n", "Q46768\n", "\n", "\n", "\n", "\n", "\n", "node113->node18\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node113->node65\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node114\n", "\n", "Q182070\n", "\n", "\n", "\n", "\n", "\n", "node113->node114\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node116\n", "\n", "Q170164\n", "\n", "\n", "\n", "\n", "\n", "node116->node53\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node117\n", "\n", "Q254471\n", "\n", "\n", "\n", "\n", "\n", "node117->node5\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node117->node102\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node118\n", "\n", "Q1777\n", "\n", "\n", "\n", "\n", "\n", "node119\n", "\n", "Q518890\n", "\n", "\n", "\n", "\n", "\n", "node118->node119\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node120\n", "\n", "Q171023\n", "\n", "\n", "\n", "\n", "\n", "node121\n", "\n", "Q202222\n", "\n", "\n", "\n", "\n", "\n", "node120->node121\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node122\n", "\n", "Q232090\n", "\n", "\n", "\n", "\n", "\n", "node122->node1\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node123\n", "\n", "Q45530\n", "\n", "\n", "\n", "\n", "\n", "node123->node18\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node123->node65\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node123->node114\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node126\n", "\n", "Q45522\n", "\n", "\n", "\n", "\n", "\n", "node126->node89\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node128\n", "\n", "Q1830\n", "\n", "\n", "\n", "\n", "\n", "node128->node29\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node128->node129\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node130\n", "\n", "Q1440\n", "\n", "\n", "\n", "\n", "\n", "node130->node13\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node131\n", "\n", "Q236259\n", "\n", "\n", "\n", "\n", "\n", "node131->node132\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node133\n", "\n", "Q172471\n", "\n", "\n", "\n", "\n", "\n", "node134\n", "\n", "Q749909\n", "\n", "\n", "\n", "\n", "\n", "node133->node134\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node135\n", "\n", "Q229307\n", "\n", "\n", "\n", "\n", "\n", "node135->node55\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node136\n", "\n", "Q272630\n", "\n", "\n", "\n", "\n", "\n", "node136->node134\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node137\n", "\n", "Q3372698\n", "\n", "\n", "\n", "\n", "\n", "node137->node119\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n", "node138\n", "\n", "Q46750\n", "\n", "\n", "\n", "\n", "\n", "node138->node64\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node139\n", "\n", "Q1752\n", "\n", "\n", "\n", "\n", "\n", "node139->node95\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P22\n", "\n", "\n", "\n", "\n", "\n", "node140\n", "\n", "Q383304\n", "\n", "\n", "\n", "\n", "\n", "node140->node121\n", "\n", "\n", "\n", "\n", "\n", "\n", "wdt:P25\n", "\n", "\n", "\n", "\n", "\n" ] }, "metadata": { "unconfined": true }, "output_type": "display_data" } ], "source": [ "%endpoint http://query.wikidata.org/sparql\n", "%display diagram \n", "\n", "CONSTRUCT {\n", " ?emperor wdt:P22 ?child . #p22: father\n", " ?mother wdt:P25 ?child . #p25: mother \n", " }\n", "\n", "WHERE {\n", " \n", " ?emperor wdt:P39 wd:Q842606 .\n", " ?child wdt:P22 ?emperor . #p22: father\n", " ?child wdt:P25 ?mother . #p25: mother\n", " OPTIONAL { ?mother wdt:P22 ?maternalGrandfather }\n", " OPTIONAL { ?mother wdt:P25 ?maternalGrandmother }\n", "} " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Nomisma\n", "\n", "Another excellent SPARQL endpoint is the Nomisma portal for numismatic materials. \n", "\n", "http://nomisma.org/sparql" ] }, { "cell_type": "code", "execution_count": 131, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Endpoint set to: http://nomisma.org/query
" ], "text/plain": [ "Endpoint set to: http://nomisma.org/query\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%endpoint http://nomisma.org/query" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, if you actually go to [http://query.wikidata.org/sparql](http://query.wikidata.org/sparql) you'll find a query builder with the following information already preloaded:\n", "\n", "```\n", "PREFIX rdf:\t\n", "PREFIX bio:\t\n", "PREFIX crm:\t\n", "PREFIX dcmitype:\t\n", "PREFIX dcterms:\t\n", "PREFIX foaf:\t\n", "PREFIX geo:\t\n", "PREFIX nm:\t\n", "PREFIX nmo:\t\n", "PREFIX org:\t\n", "PREFIX osgeo:\t\n", "PREFIX rdac:\t\n", "PREFIX skos:\t\n", "PREFIX spatial: \n", "PREFIX void:\t\n", "PREFIX xsd:\t\n", "\n", "SELECT * WHERE {\n", " ?s ?p ?o\n", "} LIMIT 100\n", "```\n", "\n", "All those prefixes are the ontologies being used to describe the materials. The `?s ?p ?o` are the subject, predicate, objects that we're going to search for. Let's run some of the [example queries](http://nomisma.org/documentation/sparql) that Nomisma can handle. Since Roman Emperors are often depicted on coins, let's see which emperors are present in Nomisma." ] }, { "cell_type": "code", "execution_count": 132, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Display: table
" ], "text/plain": [ "Display: table\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%display table \n", "PREFIX rdf:\t\n", "PREFIX bio:\t\n", "PREFIX crm:\t\n", "PREFIX dcmitype:\t\n", "PREFIX dcterms:\t\n", "PREFIX foaf:\t\n", "PREFIX geo:\t\n", "PREFIX nm:\t\n", "PREFIX nmo:\t\n", "PREFIX org:\t\n", "PREFIX osgeo:\t\n", "PREFIX rdac:\t\n", "PREFIX skos:\t\n", "PREFIX spatial: \n", "PREFIX void:\t\n", "PREFIX xsd:\t\n", "\n", "SELECT ?uri ?label WHERE {\n", "?uri a foaf:Person ;\n", " skos:prefLabel ?label ; \n", " org:hasMembership ?membership .\n", "?membership org:role nm:roman_emperor .\n", "FILTER(langMatches(lang(?label), \"EN\"))\n", "} " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can also do spatial queries; this one looks coins from mints within 50 km of Athens.\n", "\n", "It also specifies the format in which we wants the results returned, and to write these results to a json file for further manipulation." ] }, { "cell_type": "code", "execution_count": 137, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Return format: JSON
Display: table
Output file: mints.json
" ], "text/plain": [ "Return format: JSON\n", "Display: table\n", "Output file: mints.json\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
loclatlongmintlabel
http://nomisma.org/id/rome#this41.912.5http://nomisma.org/id/romeRome
http://nomisma.org/id/caesareia_cappadocia#this38.73333335.483333http://nomisma.org/id/caesareia_cappadociaCaesarea in Cappadocia
http://nomisma.org/id/nicomedia#this40.76666729.916667http://nomisma.org/id/nicomediaNicomedia
http://nomisma.org/id/siscia#this45.48316816.371388http://nomisma.org/id/sisciaSiscia
http://nomisma.org/id/emisa#this34.75189936.724237http://nomisma.org/id/emisaEmisa
http://nomisma.org/id/viminacium#this44.71647121.166605http://nomisma.org/id/viminaciumViminacium
http://nomisma.org/id/panticapaeum#this45.33861136.468056http://nomisma.org/id/panticapaeumPanticapaeum
http://nomisma.org/id/phanagoria#this45.18936.825http://nomisma.org/id/phanagoriaPhangoria
http://nomisma.org/id/thasos#this40.77762624.703702http://nomisma.org/id/thasosThasos
http://nomisma.org/id/thessalian_league#this39.64166722.416667http://nomisma.org/id/thessalian_leagueThessalian League
http://nomisma.org/id/agrigentum#this37.31666713.583333http://nomisma.org/id/agrigentumAgrigentum
http://nomisma.org/id/gela#this37.06315614.258219http://nomisma.org/id/gelaGela
http://nomisma.org/id/leontini#this37.28547814.998115http://nomisma.org/id/leontiniLeontini
http://nomisma.org/id/messana#this38.19225115.556634http://nomisma.org/id/messanaMessana
http://nomisma.org/id/syracuse#this37.08333315.283333http://nomisma.org/id/syracuseSyracuse
http://nomisma.org/id/parthia#this32.324275653.1738281http://nomisma.org/id/parthiaParthia
http://nomisma.org/id/seleuceia_ad_tigrim#this33.13722244.517222http://nomisma.org/id/seleuceia_ad_tigrimSeleuceia ad Tigrim
http://nomisma.org/id/antiocheia_syria#this36.236.15http://nomisma.org/id/antiocheia_syriaAntioch
http://nomisma.org/id/tarsus#this36.91666734.9http://nomisma.org/id/tarsusTarsus
http://nomisma.org/id/massalia#this43.2968545.382499http://nomisma.org/id/massaliaMassalia
Total: 1798, Shown: 20
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%format json \n", "%display table \n", "%outfile mints.json \n", "PREFIX rdf:\t\n", "PREFIX dcterms:\t\n", "PREFIX geo:\t\n", "PREFIX nm:\t\n", "PREFIX nmo:\t\n", "PREFIX skos:\t\n", "PREFIX spatial: \n", "PREFIX xsd:\t\n", "\n", "SELECT * WHERE {\n", " ?loc spatial:nearby (37.974722 23.7225 50 'km') ;\n", " geo:lat ?lat ;\n", " geo:long ?long .\n", " ?mint geo:location ?loc ;\n", " skos:prefLabel ?label ;\n", " a nmo:Mint\n", " FILTER langMatches (lang(?label), 'en')\n", "}\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "SPARQL", "language": "sparql", "name": "sparql" }, "language_info": { "codemirror_mode": { "name": "sparql" }, "mimetype": "application/sparql-query", "name": "sparql", "pygments_lexer": "sparql-nb" } }, "nbformat": 4, "nbformat_minor": 2 }