Instructions for using the Ontology2 Edition of DBpedia 2016-04

Note

The Ontology2 Edition of DBpedia is more complete than the DBpedia public SPARQL endpoint. Cases where queries return substantially better results than the public endpoint are highlighted in red.

This web page contains instructions for the product B01HMUNH4Q at the AWS marketplace: this product contains data from DBpedia 2016-04 integrated with a triple store and high performance hardware that enables productive work with DBpedia data. You can query DBpedia with the SPARQL query language: if you don't have it already, you should get a copy of Learning SPARQL by Bob DuCharme. The SPARQL 1.1 specification is also a useful reference. On this page we will work through booting the database and running a few example queries that demonstrate the use of SPARQL to get a broad overview of a data set.

Waiting for the database to to be ready

To meet security requirements for the AWS Marketplace, this product is not usable until the boot scripts are able to set a database password, which in turn, requires the database to boot. If you log into the instance while it is still initializing, you we see something like:

Using username "ubuntu".
Authenticating with public key "imported-openssh-key"
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-74-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Mon Oct 17 17:55:26 UTC 2016

  System load:  3.33              Processes:           125
  Usage of /:   33.1% of 7.74GB   Users logged in:     1
  Memory usage: 60%               IP address for eth0: 10.0.0.142
  Swap usage:   0%

Last login: Mon Oct 17 17:55:26 2016 from ip-10-0-0-215.ec2.internal
"running .bash.d/RDFeasy-paths.sh"

Database is still initializing.  When initialization is complete
database credentials will appear on login
ubuntu@ip-10-0-0-147:~$
The answer to this is simply to wait. When I tried it, it took about 4200 seconds (roughly an hour and 15 minutes) for the database to become available. During the initialization phase, we are causing Amazon to copy the contents of a 73 GB snapshot onto an EBS volume. This takes some time. Once the data has been copied off the snapshot, the triple store runs quickly and predictably. This process happens only once, the first time you boot the instance -- future boots take approximately ten minutes.

Once the product is ready, you will see a message like the following on login.

Using username "ubuntu".
Authenticating with public key "imported-openssh-key"
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-74-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Mon Oct 17 17:55:26 UTC 2016

  System load:  3.33              Processes:           125
  Usage of /:   33.1% of 7.74GB   Users logged in:     1
  Memory usage: 60%               IP address for eth0: 10.0.0.142
  Swap usage:   0%

Last login: Mon Oct 17 17:55:26 2016 from ip-10-0-0-215.ec2.internal
"running .bash.d/RDFeasy-paths.sh"
Log into the virtuoso database with the following credentials:

username: dba
password: y1t7b9fyl4BctmRp
At this point, have several options to access the server, including accessing it from the command line and the web interface:

Running SPARQL queries at the command line

The easiest way to run queries against the database is from the command line, because the database connection information is embedded in the utility. Here are some example queries you can run. You can get into the Openlink Virtuoso SQL monitor by typing the 'sql' command, and then do sparql queries by prefixing them with the word 'sparql'.

1.Count Number of Facts.

ubuntu@ip-10-0-0-142:~$ sql
Connected to OpenLink Virtuoso
Driver: 07.20.3217 OpenLink Virtuoso ODBC Driver
OpenLink Interactive SQL (Virtuoso), version 0.9849b.
Type HELP; for help and EXIT; to exit.
SQL> sparql select count(*) {?s ?p ?o .};
callret-0
INTEGER
_______________________________________________________________________________

1078008670

1 Rows. -- 2133 msec.

By comparison, only 401,837,353 facts are found at the DBpedia public SPARQL endpoint on October 8, 2016. The Ontology2 Edition of DBpedia 2015-10 (the previous version of this product) had only 651,012,048 facts. That's a 73% increase over the last version, and a 168% increase over the public SPARQL endpoint.

2.Most popular predicates.

SQL> sparql
  select ?p (count(*) as ?cnt)
  {?s ?p ?o . }
  group by ?p
  order by desc(?cnt)
  limit 100;

p                                                                                 cnt
LONG VARCHAR                                                                      LONG VARCHAR
_______________________________________________________________________________

http://dbpedia.org/ontology/wikiPageWikiLink                                      172300575
http://wikidata.dbpedia.org/ontology/wikiPageWikiLink                             149972753
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   107786160
http://www.w3.org/2002/07/owl#sameAs                                              62143804
http://purl.org/dc/terms/subject                                                  43723553
http://dbpedia.org/property/wikiPageUsesTemplate                                  37031656
http://dbpedia.org/ontology/wikiPageWikiLinkText                                  23809294
http://www.w3.org/2000/01/rdf-schema#label                                        20002156
http://dbpedia.org/property/isCitedBy                                             16686612
http://dbpedia.org/ontology/wikiPageRevisionID                                    15227118
http://dbpedia.org/ontology/wikiPageID                                            15227118
http://www.w3.org/ns/prov#wasDerivedFrom                                          15227105
http://dbpedia.org/ontology/wikiPageRedirects                                     14678188
http://dbpedia.org/property/title                                                 14465694
http://dbpedia.org/ontology/wikiPageLength                                        12301672
http://dbpedia.org/ontology/wikiPageOutDegree                                     12301672
http://xmlns.com/foaf/0.1/isPrimaryTopicOf                                        12301653
http://xmlns.com/foaf/0.1/primaryTopic                                            12301653
http://purl.org/dc/elements/1.1/language                                          12301653
http://dbpedia.org/property/url                                                   10927914
http://xmlns.com/foaf/0.1/name                                                    9573755
http://www.w3.org/2000/01/rdf-schema#comment                                      9284284
http://dbpedia.org/property/accessdate                                            9256031
http://dbpedia.org/property/publisher                                             7653663
http://dbpedia.org/ontology/wikiPageExternalLink                                  7584367
http://wikidata.dbpedia.org/ontology/wikiPageExternalLink                         7514965
http://dbpedia.org/property/date                                                  6743523
http://purl.org/dc/elements/1.1/rights                                            5507896
http://www.w3.org/2004/02/skos/core#broader                                       5199787
http://dbpedia.org/ontology/abstract                                              4667821
http://wikidata.dbpedia.org/ontology/abstract                                     4616355
http://dbpedia.org/property/name                                                  4086301
http://purl.org/linguistics/gold/hypernym                                         4013670
http://dbpedia.org/ontology/team                                                  3797750
http://purl.org/dc/elements/1.1/description                                       3457200
http://xmlns.com/foaf/0.1/depiction                                               3218592
http://dbpedia.org/ontology/birthPlace                                            2941041
http://dbpedia.org/property/work                                                  2912238
http://dbpedia.org/property/last                                                  2901410
http://dbpedia.org/property/first                                                 2829162
http://xmlns.com/foaf/0.1/thumbnail                                               2753957
http://www.w3.org/2004/02/skos/core#prefLabel                                     2500223
http://xmlns.com/foaf/0.1/homepage                                                2433672
http://www.w3.org/2003/01/geo/wgs84_pos#long                                      2283402
http://www.w3.org/2003/01/geo/wgs84_pos#lat                                       2283397
http://www.georss.org/georss/point                                                2277015
http://dbpedia.org/property/year                                                  2015922
http://dbpedia.org/ontology/careerStation                                         1840856
http://dbpedia.org/ontology/isPartOf                                              1796396
http://wikidata.dbpedia.org/ontology/birthPlace                                   1768261
http://dbpedia.org/property/author                                                1755169
http://xmlns.com/foaf/0.1/givenName                                               1677514
http://xmlns.com/foaf/0.1/surname                                                 1614688
http://dbpedia.org/ontology/thumbnail                                             1611674
http://wikidata.dbpedia.org/ontology/thumbnail                                    1597490
http://dbpedia.org/ontology/birthDate                                             1556570
http://wikidata.dbpedia.org/ontology/birthDate                                    1545895
http://dbpedia.org/property/location                                              1533875
http://dbpedia.org/ontology/country                                               1531125
http://dbpedia.org/ontology/wikiPageDisambiguates                                 1476266
http://wikidata.dbpedia.org/ontology/wikiPageDisambiguates                        1359970
http://dbpedia.org/property/subdivisionType                                       1301145
http://dbpedia.org/property/pages                                                 1292066
http://dbpedia.org/property/goals                                                 1141970
http://dbpedia.org/ontology/genre                                                 1116553
http://dbpedia.org/property/subdivisionName                                       1044984
http://dbpedia.org/property/birthPlace                                            1019401
http://dbpedia.org/property/years                                                 1007246
http://dbpedia.org/property/journal                                               998882
http://dbpedia.org/property/volume                                                925751
http://dbpedia.org/property/language                                              922606
http://dbpedia.org/property/website                                               889662
http://dbpedia.org/property/shortDescription                                      887278
http://wikidata.dbpedia.org/ontology/isPartOf                                     885984
http://dbpedia.org/ontology/years                                                 872289
http://dbpedia.org/property/page                                                  857410
http://dbpedia.org/property/length                                                828908
http://dbpedia.org/ontology/birthYear                                             814423
http://wikidata.dbpedia.org/ontology/birthYear                                    810570
http://dbpedia.org/ontology/starring                                              803146
http://dbpedia.org/ontology/location                                              788481
http://dbpedia.org/ontology/type                                                  787937
http://dbpedia.org/property/issue                                                 784315
http://dbpedia.org/ontology/deathPlace                                            772989
http://dbpedia.org/ontology/family                                                769707
http://wikidata.dbpedia.org/ontology/team                                         753815
http://en.dbpedia.org/property/templateUsesParameter                              753678
http://wikidata.dbpedia.org/ontology/country                                      752345
http://dbpedia.org/property/dateOfBirth                                           742843
http://dbpedia.org/property/birthDate                                             721316
http://dbpedia.org/property/rd1Team                                               692277
http://dbpedia.org/ontology/order                                                 691866
http://dbpedia.org/property/last1                                                 686114
http://dbpedia.org/property/first1                                                684704
http://dbpedia.org/property/isbn                                                  673169
http://dbpedia.org/property/newspaper                                             669240
http://dbpedia.org/ontology/occupation                                            660947
http://dbpedia.org/property/clubs                                                 652901
http://dbpedia.org/property/placeOfBirth                                          650522
http://dbpedia.org/property/archiveurl                                            647465

100 Rows. -- 18424 msec.

3. Most common Surnames

One property on that list that catches my eye is the foaf:surname field. It's generally worthwhile to look at the most common values an attribute takes, and it is easy in SPARQL:

ubuntu@ip-10-0-0-67:~$ sql
Connected to OpenLink Virtuoso
Driver: 07.20.3217 OpenLink Virtuoso ODBC Driver
OpenLink Interactive SQL (Virtuoso), version 0.9849b.
Type HELP; for help and EXIT; to exit.
SQL> sparql
  select ?surname (count(*) as ?cnt)
  {?s <http://xmlns.com/foaf/0.1/surname> ?surname . }
  group by ?surname
  order by desc(?cnt)
  limit 100;

surname                                                                           cnt
LONG VARCHAR                                                                      LONG VARCHAR
_______________________________________________________________________________

Smith                                                                             6737
Jones                                                                             4212
Williams                                                                          4142
Brown                                                                             3979
Johnson                                                                           3586
Lee                                                                               3174
Wilson                                                                            2874
Taylor                                                                            2646
Miller                                                                            2522
Davis                                                                             2350
Anderson                                                                          2234
Martin                                                                            2143
Thomas                                                                            2109
Kim                                                                               2080
White                                                                             1953
Thompson                                                                          1909
Moore                                                                             1905
Robinson                                                                          1800
Campbell                                                                          1788
Singh                                                                             1757
Harris                                                                            1755
Lewis                                                                             1744
Evans                                                                             1741
Scott                                                                             1726
Walker                                                                            1698
Jackson                                                                           1688
Hall                                                                              1652
Young                                                                             1648
Wright                                                                            1620
Clark                                                                             1566
King                                                                              1494
Hill                                                                              1493
Allen                                                                             1485
Roberts                                                                           1405
Baker                                                                             1362
Kelly                                                                             1350
Green                                                                             1337
Davies                                                                            1335
Stewart                                                                           1331
Li                                                                                1327
Adams                                                                             1323
Murphy                                                                            1300
Wang                                                                              1270
Edwards                                                                           1222
Mitchell                                                                          1212
Khan                                                                              1210
Bell                                                                              1198
Turner                                                                            1192
Morgan                                                                            1189
James                                                                             1172
Hughes                                                                            1152
Wood                                                                              1149
Morris                                                                            1098
Parker                                                                            1082
Cooper                                                                            1074
Clarke                                                                            1066
Murray                                                                            1059
Ward                                                                              1058
Collins                                                                           1050
Phillips                                                                          1046
Watson                                                                            1042
Bennett                                                                           1007
Zhang                                                                             1006
Gordon                                                                            1002
Russell                                                                           1001
Hamilton                                                                          998
Ryan                                                                              974
Carter                                                                            970
Richardson                                                                        963
Ross                                                                              948
Nelson                                                                            920
Rogers                                                                            911
Kennedy                                                                           909
Gray                                                                              904
Chen                                                                              904
Howard                                                                            903
Graham                                                                            890
Harrison                                                                          882
Marshall                                                                          877
Robertson                                                                         875
Alexander                                                                         870
Butler                                                                            867
Park                                                                              866
Shaw                                                                              866
Cook                                                                              854
Garcia                                                                            852
Silva                                                                             843
Cohen                                                                             841
Price                                                                             839
Liu                                                                               834
Hansen                                                                            829
Henderson                                                                         820
Foster                                                                            812
Rodriguez                                                                         810
Walsh                                                                             799
Fisher                                                                            798
Simpson                                                                           786
Cox                                                                               780
Reid                                                                              780
Ellis                                                                             769

100 Rows. -- 5019 msec.

4. Common Given Name Plus Surname

This query is a step up from the last one, we're now using an RDF prefix declaration, matching two facts, which are bound to the same subject with the square brackets, then grouping on two facts:
SQL>
sparql
  prefix foaf: <http://xmlns.com/foaf/0.1/>
  select ?givenName ?surname (count(*) as ?cnt)
  { [
     foaf:surname ?surname ;
     foaf:givenName ?givenName ;
  ] }
  group by ?givenName ?surname
  order by desc(?cnt) limit 100;

givenName                                                                         surname                                                                           cnt
LONG VARCHAR                                                                      LONG VARCHAR                                                                      LONG VARCHAR
_______________________________________________________________________________

John                                                                              Smith                                                                             140
George                                                                            Smith                                                                             86
John                                                                              Williams                                                                          82
John                                                                              Wilson                                                                            80
John                                                                              Campbell                                                                          80
John                                                                              Brown                                                                             78
William                                                                           Smith                                                                             74
John                                                                              Jones                                                                             70
John                                                                              Taylor                                                                            70
John                                                                              Harris                                                                            70
John                                                                              Anderson                                                                          68
John                                                                              Scott                                                                             66
David                                                                             Smith                                                                             60
James                                                                             Smith                                                                             59
John                                                                              Evans                                                                             58
James                                                                             Brown                                                                             58
John                                                                              Martin                                                                            56
John                                                                              Marshall                                                                          56
David                                                                             Williams                                                                          56
David                                                                             Jones                                                                             54
William                                                                           Anderson                                                                          52
William                                                                           Wilson                                                                            50
Paul                                                                              Smith                                                                             50
Thomas                                                                            Smith                                                                             50
William                                                                           Jones                                                                             48
John                                                                              Moore                                                                             48
John                                                                              Jackson                                                                           48
John                                                                              Hill                                                                              48
William                                                                           Williams                                                                          46
John                                                                              Bell                                                                              46
John                                                                              Murray                                                                            46
James                                                                             Wilson                                                                            46
David                                                                             Brown                                                                             46
George                                                                            Brown                                                                             46
Robert                                                                            Williams                                                                          44
John                                                                              Baker                                                                             44
John                                                                              Russell                                                                           44
John                                                                              White                                                                             44
John                                                                              Hughes                                                                            44
David                                                                             Lewis                                                                             44
John                                                                              Ward                                                                              44
David                                                                             Wilson                                                                            42
John                                                                              Davis                                                                             42
David                                                                             Lee                                                                               42
John                                                                              Allen                                                                             40
William                                                                           Brown                                                                             40
James                                                                             Walker                                                                            40
John                                                                              Edwards                                                                           40
John                                                                              Walker                                                                            40
John                                                                              Kelly                                                                             40
John                                                                              Rogers                                                                            40
John                                                                              Roberts                                                                           40
Robert                                                                            Smith                                                                             40
John                                                                              Murphy                                                                            40
Dave                                                                              Smith                                                                             40
John                                                                              Bennett                                                                           38
William                                                                           Davies                                                                            38
John                                                                              Thompson                                                                          38
Robert                                                                            Brown                                                                             38
John                                                                              Fraser                                                                            38
John                                                                              Lewis                                                                             38
John                                                                              Watson                                                                            38
Tom                                                                               Smith                                                                             38
John                                                                              Morgan                                                                            38
Steve                                                                             Smith                                                                             38
John                                                                              Miller                                                                            38
John                                                                              Young                                                                             38
John                                                                              Kennedy                                                                           38
James                                                                             Stewart                                                                           36
John                                                                              Robinson                                                                          36
John                                                                              Wood                                                                              36
John                                                                              Johnson                                                                           36
Chris                                                                             Smith                                                                             36
John                                                                              Phillips                                                                          36
John                                                                              Stewart                                                                           36
John                                                                              Carter                                                                            36
John                                                                              Parker                                                                            36
John                                                                              Harvey                                                                            36
John                                                                              Davies                                                                            36
Richard                                                                           Williams                                                                          36
James                                                                             Martin                                                                            36
James                                                                             Johnson                                                                           36
John                                                                              Adams                                                                             36
Robert                                                                            Campbell                                                                          36
David                                                                             Evans                                                                             34
John                                                                              Mitchell                                                                          34
Colin                                                                             Campbell                                                                          34
John                                                                              Hall                                                                              34
John                                                                              Gordon                                                                            34
John                                                                              Ellis                                                                             34
Robert                                                                            Bruce                                                                             34
John                                                                              Lee                                                                               34
George                                                                            Wilson                                                                            34
Paul                                                                              Williams                                                                          34
John                                                                              Gray                                                                              34
John                                                                              Butler                                                                            34
William                                                                           Miller                                                                            32
Mark                                                                              Smith                                                                             32
John                                                                              Grant                                                                             32
William                                                                           Morgan                                                                            32

5. See what got loaded

This query shows how the data was divided into named graphs, showing how many facts are in each graph.

SQL>
sparql select (count(*) as ?cnt) ?g {
   graph ?g { ?s ?p ?o . }
} group by ?g order by desc(?cnt) ;

cnr               g                                                                           g
LONG VARCHAR      LONG VARCHAR
____________      ____________

172300575         http://downloads.dbpedia.org/2016-04/core-i18n/en/page_links_en.ttl.bz2
149972753         http://downloads.dbpedia.org/2016-04/core-i18n/en/page_links_wkd_uris_en.ttl.bz2
76223926          http://downloads.dbpedia.org/2016-04/core-i18n/en/citation_data_en.ttl.bz2
49780412          http://downloads.dbpedia.org/2016-04/core-i18n/en/infobox_properties_mapped_en.ttl.bz2
49206612          http://downloads.dbpedia.org/2016-04/core-i18n/en/wikipedia_links_en.ttl.bz2
34682877          http://downloads.dbpedia.org/2016-04/core-i18n/en/interlanguage_links_en.ttl.bz2
33000229          http://downloads.dbpedia.org/2016-04/core-i18n/en/article_templates_en.ttl.bz2
31490585          http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_transitive_en.ttl.bz2
30006006          http://downloads.dbpedia.org/2016-04/core-i18n/en/infobox_properties_en.ttl.bz2
25363984          http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_transitive_wkd_uris_en.ttl.bz2
23809294          http://downloads.dbpedia.org/2016-04/core-i18n/en/anchor_text_en.ttl.bz2
22583308          http://downloads.dbpedia.org/2016-04/core-i18n/en/article_categories_en.ttl.bz2
21505897          http://downloads.dbpedia.org/2016-04/core-i18n/en/interlanguage_links_chapters_en.ttl.bz2
21050333          http://downloads.dbpedia.org/2016-04/core-i18n/en/article_categories_wkd_uris_en.ttl.bz2
18253957          http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_uncleaned_en.ttl.bz2
18187437          http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_en.ttl.bz2
16897941          http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_literals_en.ttl.bz2
16686612          http://downloads.dbpedia.org/2016-04/core-i18n/en/citation_links_en.ttl.bz2
15227118          http://downloads.dbpedia.org/2016-04/core-i18n/en/page_ids_en.ttl.bz2
15227118          http://downloads.dbpedia.org/2016-04/core-i18n/en/revision_ids_en.ttl.bz2
15227105          http://downloads.dbpedia.org/2016-04/core-i18n/en/revision_uris_en.ttl.bz2
14816457          http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_wkd_uris_en.ttl.bz2
13475759          http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_literals_wkd_uris_en.ttl.bz2
12301672          http://downloads.dbpedia.org/2016-04/core-i18n/en/out_degree_en.ttl.bz2
12301672          http://downloads.dbpedia.org/2016-04/core-i18n/en/page_length_en.ttl.bz2
12301665          http://downloads.dbpedia.org/2016-04/core-i18n/en/labels_en.ttl.bz2
10108218          http://downloads.dbpedia.org/2016-04/core-i18n/en/images_en.ttl.bz2
10079850          http://downloads.dbpedia.org/2016-04/core-i18n/en/images_wkd_uris_en.ttl.bz2
7867882           http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_dbtax_ext_en.ttl.bz2
7584367           http://downloads.dbpedia.org/2016-04/core-i18n/en/external_links_en.ttl.bz2
7514965           http://downloads.dbpedia.org/2016-04/core-i18n/en/external_links_wkd_uris_en.ttl.bz2
7339096           http://downloads.dbpedia.org/2016-04/core-i18n/en/redirects_en.ttl.bz2
7339092           http://downloads.dbpedia.org/2016-04/core-i18n/en/transitive_redirects_en.ttl.bz2
6067032           http://downloads.dbpedia.org/2016-04/core-i18n/en/persondata_en.ttl.bz2
6054376           http://downloads.dbpedia.org/2016-04/core-i18n/en/persondata_wkd_uris_en.ttl.bz2
5622959           http://downloads.dbpedia.org/2016-04/core-i18n/en/skos_categories_en.ttl.bz2
5214240           http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_en.ttl.bz2
5078122           http://downloads.dbpedia.org/2016-04/core-i18n/en/labels_wkd_uris_en.ttl.bz2
4667928           http://downloads.dbpedia.org/2016-04/core-i18n/en/short_abstracts_en.ttl.bz2
4667821           http://downloads.dbpedia.org/2016-04/core-i18n/en/long_abstracts_en.ttl.bz2
4663764           http://downloads.dbpedia.org/2016-04/core-i18n/en/skos_categories_wkd_uris_en.ttl.bz2
4616355           http://downloads.dbpedia.org/2016-04/core-i18n/en/long_abstracts_wkd_uris_en.ttl.bz2
4616355           http://downloads.dbpedia.org/2016-04/core-i18n/en/short_abstracts_wkd_uris_en.ttl.bz2
4449859           http://downloads.dbpedia.org/2016-04/core-i18n/en/freebase_links_en.ttl.bz2
4031427           http://downloads.dbpedia.org/2016-04/core-i18n/en/article_templates_nested_en.ttl.bz2
4013670           http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_lhd_ext_en.ttl.bz2
3782400           http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_lhd_dbo_en.ttl.bz2
3704680           http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_dbtax_dbo_en.ttl.bz2
3394306           http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_wkd_uris_en.ttl.bz2
2465545           http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_sdtyped_dbo_en.ttl.bz2
2356443           http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_mappingbased_en.ttl.bz2
2271364           http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_en.ttl.bz2
2254680           http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_wkd_uris_en.ttl.bz2
2241268           http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_mappingbased_wkd_uris_en.ttl.bz2
1476266           http://downloads.dbpedia.org/2016-04/core-i18n/en/disambiguations_en.ttl.bz2
1367759           http://downloads.dbpedia.org/2016-04/core-i18n/en/category_labels_en.ttl.bz2
1359970           http://downloads.dbpedia.org/2016-04/core-i18n/en/disambiguations_wkd_uris_en.ttl.bz2
1132464           http://downloads.dbpedia.org/2016-04/core-i18n/en/category_labels_wkd_uris_en.ttl.bz2
986715            http://downloads.dbpedia.org/2016-04/core-i18n/en/uri_same_as_iri_en.ttl.bz2
913692            http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2
882961            http://downloads.dbpedia.org/2016-04/core-i18n/en/specific_mappingbased_properties_en.ttl.bz2
862566            http://downloads.dbpedia.org/2016-04/core-i18n/en/specific_mappingbased_properties_wkd_uris_en.ttl.bz2
753678            http://downloads.dbpedia.org/2016-04/core-i18n/en/template_parameters_en.ttl.bz2
661255            http://downloads.dbpedia.org/2016-04/core-i18n/en/homepages_en.ttl.bz2
653785            http://downloads.dbpedia.org/2016-04/core-i18n/en/homepages_wkd_uris_en.ttl.bz2
518456            http://downloads.dbpedia.org/2016-04/core-i18n/en/geonames_links_en.ttl.bz2
167619            http://downloads.dbpedia.org/2016-04/core-i18n/en/topical_concepts_en.ttl.bz2
122106            http://downloads.dbpedia.org/2016-04/core-i18n/en/infobox_property_definitions_wkd_uris_en.ttl.bz2
122106            http://downloads.dbpedia.org/2016-04/core-i18n/en/infobox_property_definitions_en.ttl.bz2
52130             http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_disjoint_range_en.ttl.bz2
15701             http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_disjoint_domain_en.ttl.bz2
4418              http://downloads.dbpedia.org/2016-04/core-i18n/en/genders_en.ttl.bz2
3003              http://localhost:8890/DAV/
2475              http://www.openlinksw.com/schemas/virtrdf#
160               http://www.w3.org/2002/07/owl#
14                http://localhost:8890/sparql
3                 http://www.w3.org/ns/ldp#

77 Rows. -- 18551 msec.

Note that the /mnt/data/rdf files are not present in your machine image, but were present on an attached file system while the database was loaded. We load each file from the DBpedia Foundation into a named graph which is the same as the download URI for a file. (And yes, we converted the files to gzip before loading into the database!)

6. Get the facts about a person (or other topic)

The most easy way to find a topic in DBpedia is to find it in Wikipedia, and write the name of the article, as given in the local part of the Wikipedia URI, in the local part of a URI in the <http://dbpedia.org/resource/>namespace. In the interest of brevity, we map this namespace to ":" in this query.

sparql
  prefix : <http://dbpedia.org/resource/>
  select ?p ?o
  { :Garrett_Morgan ?p ?o . }

p                                                                                 o
LONG VARCHAR                                                                      LONG VARCHAR
_______________________________________________________________________________

http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.w3.org/2002/07/owl#Thing
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://schema.org/Person
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.wikidata.org/entity/Q215627
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.wikidata.org/entity/Q5
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#Agent
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.ontologydesignpatterns.org/ont/dul/DUL.owl#NaturalPerson
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://xmlns.com/foaf/0.1/Person
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://dbpedia.org/ontology/Agent
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://dbpedia.org/dbtax/Burial
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://dbpedia.org/dbtax/History
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://dbpedia.org/ontology/Person
http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://dbpedia.org/ontology/Person
http://www.w3.org/2000/01/rdf-schema#label                                        Garrett Morgan
http://www.w3.org/2000/01/rdf-schema#comment                                      Garrett Augustus Morgan, Sr. (March 4, 1877 â July 27, 1963) was an American inventor and community leader. He worked on the development of a chemical for hair-straightening. He was the subject of a newspaper expose in Cleveland, Ohio, for a heroic rescue in 1916 of workers trapped within a water intake tunnel, 50 ft (15 m) beneath Lake Erie.
http://www.w3.org/2000/01/rdf-schema#seeAlso                                      http://dbpedia.org/resource/Traffic_signal
http://www.w3.org/2000/01/rdf-schema#seeAlso                                      http://dbpedia.org/resource/Traffic_light
http://www.w3.org/2000/01/rdf-schema#seeAlso                                      http://dbpedia.org/resource/Traffic_light
http://www.w3.org/2002/07/owl#sameAs                                              http://wikidata.dbpedia.org/resource/Q1316686
http://www.w3.org/2002/07/owl#sameAs                                              http://wikidata.dbpedia.org/resource/Q1316686
http://www.w3.org/2002/07/owl#sameAs                                              http://rdf.freebase.com/ns/m.01tp2v
http://www.w3.org/2002/07/owl#sameAs                                              http://fr.dbpedia.org/resource/Garrett_A._Morgan
http://www.w3.org/2002/07/owl#sameAs                                              http://fr.dbpedia.org/resource/Garrett_A._Morgan
http://www.w3.org/2002/07/owl#sameAs                                              http://de.dbpedia.org/resource/Garrett_Morgan
http://www.w3.org/2002/07/owl#sameAs                                              http://de.dbpedia.org/resource/Garrett_Morgan
http://www.w3.org/2002/07/owl#sameAs                                              http://www.wikidata.org/entity/Q1316686
http://www.w3.org/2002/07/owl#sameAs                                              http://www.wikidata.org/entity/Q1316686
http://www.w3.org/2002/07/owl#sameAs                                              http://es.dbpedia.org/resource/Garrett_Augustus_Morgan
http://www.w3.org/2002/07/owl#sameAs                                              http://es.dbpedia.org/resource/Garrett_Augustus_Morgan
http://www.w3.org/2002/07/owl#sameAs                                              http://ko.dbpedia.org/resource/ê°ë¦¿_모건
http://www.w3.org/2002/07/owl#sameAs                                              http://ko.dbpedia.org/resource/ê°ë¦¿_모건
http://www.w3.org/2002/07/owl#sameAs                                              http://pl.dbpedia.org/resource/Garrett_Morgan
http://www.w3.org/2002/07/owl#sameAs                                              http://pl.dbpedia.org/resource/Garrett_Morgan
http://www.w3.org/2002/07/owl#sameAs                                              http://pt.dbpedia.org/resource/Garrett_Morgan
http://dbpedia.org/ontology/wikiPageWikiLinkText                                  Garrett A. Morgan.org/resource/Garrett_Morgan              à®à®©à¯
http://dbpedia.org/ontology/wikiPageWikiLinkText                                  Garrett Morgandia.org/resource/Garrett_Augustus_மாரà¯
http://dbpedia.org/ontology/wikiPageWikiLinkText                                  Garret Morgan.dbpedia.org/resource/Garà®°à¯à®à¯an
http://purl.org/dc/terms/subject                                                  http://dbpedia.org/resource/Category:History_of_Cleveland,_Ohio
http://purl.org/dc/terms/subject                                                  http://dbpedia.org/resource/Category:Traffic_signals
http://purl.org/dc/terms/subject                                                  http://dbpedia.org/resource/Category:People_from_Paris,_Kentucky
http://purl.org/dc/terms/subject                                                  http://dbpedia.org/resource/Category:1877_births
http://purl.org/dc/terms/subject                                                  http://dbpedia.org/resource/Category:1963_deaths
http://purl.org/dc/terms/subject                                                  http://dbpedia.org/resource/Category:African-American_inventors
http://purl.org/dc/terms/subject                                                  http://dbpedia.org/resource/Category:American_inventors
http://purl.org/dc/terms/subject                                                  http://dbpedia.org/resource/Category:Burials_at_Lake_View_Cemetery,_Cleveland
http://purl.org/dc/terms/subject                                                  http://dbpedia.org/resource/Category:People_from_Cleveland,_Ohio
http://dbpedia.org/property/wikiPageUsesTemplate                                  http://dbpedia.org/resource/Template:Authority_control
http://dbpedia.org/property/wikiPageUsesTemplate                                  http://dbpedia.org/resource/Template:Birth_date
http://dbpedia.org/property/wikiPageUsesTemplate                                  http://dbpedia.org/resource/Template:Commons_category
http://dbpedia.org/property/wikiPageUsesTemplate                                  http://dbpedia.org/resource/Template:Convert
http://dbpedia.org/property/wikiPageUsesTemplate                                  http://dbpedia.org/resource/Template:Death_date_and_age
http://dbpedia.org/property/wikiPageUsesTemplate                                  http://dbpedia.org/resource/Template:Find_a_Grave
http://dbpedia.org/property/wikiPageUsesTemplate                                  http://dbpedia.org/resource/Template:Infobox_person
http://dbpedia.org/property/wikiPageUsesTemplate                                  http://dbpedia.org/resource/Template:Portal
http://dbpedia.org/property/wikiPageUsesTemplate                                  http://dbpedia.org/resource/Template:Reflist
http://dbpedia.org/property/wikiPageUsesTemplate                                  http://dbpedia.org/resource/Template:See_also
http://dbpedia.org/property/wikiPageUsesTemplate                                  http://dbpedia.org/resource/Template:Use_mdy_dates
http://dbpedia.org/property/deathPlace                                            http://dbpedia.org/resource/Cleveland
http://dbpedia.org/property/deathPlace                                            http://dbpedia.org/resource/Ohio
http://dbpedia.org/property/occupation                                            Inventor, Entrepreneur
http://xmlns.com/foaf/0.1/name                                                    Garrett Morgan
http://dbpedia.org/ontology/alias                                                 Big Chief Mason
http://dbpedia.org/ontology/birthDate                                             1877-03-04
http://dbpedia.org/ontology/birthPlace                                            http://dbpedia.org/resource/Paris,_Kentucky
http://dbpedia.org/ontology/birthPlace                                            http://dbpedia.org/resource/Paris,_Kentucky
http://dbpedia.org/ontology/birthYear                                             1877-01-01
http://dbpedia.org/ontology/deathDate                                             1963-07-27
http://dbpedia.org/ontology/deathPlace                                            http://dbpedia.org/resource/Cleveland
http://dbpedia.org/ontology/deathPlace                                            http://dbpedia.org/resource/Cleveland
http://dbpedia.org/ontology/deathPlace                                            http://dbpedia.org/resource/Ohio
http://dbpedia.org/ontology/deathPlace                                            http://dbpedia.org/resource/Ohio
http://dbpedia.org/ontology/deathYear                                             1963-01-01
http://dbpedia.org/ontology/knownFor                                              http://dbpedia.org/resource/Gas_mask
http://dbpedia.org/ontology/knownFor                                              http://dbpedia.org/resource/Gas_mask
http://dbpedia.org/ontology/occupation                                            http://dbpedia.org/resource/Garrett_Morgan__1
http://dbpedia.org/ontology/occupation                                            http://dbpedia.org/resource/Garrett_Morgan__1
http://dbpedia.org/property/caption                                               Garrett Augustus Morgan
http://dbpedia.org/property/otherNames                                            Big Chief Mason
http://dbpedia.org/property/name                                                  Garrett Morgan
http://dbpedia.org/property/knownFor                                              Inventor of a type of respiratory protective hood
http://dbpedia.org/property/birthDate                                             1877-03-04
http://dbpedia.org/property/birthPlace                                            (Claysville Community), Kentucky
http://dbpedia.org/property/deathDate                                             1963-07-27
http://dbpedia.org/ontology/wikiPageExternalLink                                  http://ech.cwru.edu/ech-cgi/article.pl?id=WTD
http://dbpedia.org/ontology/wikiPageExternalLink                                  http://inventors.about.com/library/inventors/blgas_mask2.htm
http://xmlns.com/foaf/0.1/depiction                                               http://en.wikipedia.org/wiki/Special:FilePath/Garrett_Morgan.gif
http://dbpedia.org/ontology/thumbnail                                             http://en.wikipedia.org/wiki/Special:FilePath/Garrett_Morgan.gif?width=300
http://dbpedia.org/ontology/wikiPageOutDegree                                     51
http://dbpedia.org/ontology/wikiPageRevisionID                                    707298625
http://dbpedia.org/ontology/wikiPageLength                                        22121
http://dbpedia.org/ontology/wikiPageID                                            314626
http://www.w3.org/ns/prov#wasDerivedFrom                                          http://en.wikipedia.org/wiki/Garrett_Morgan?oldid=707298625
http://dbpedia.org/ontology/abstract                                              Garrett Augustus Morgan, Sr. (March 4, 1877 â July 27, 1963) was an American inventor and community leader. He worked on the development of a chemical for hair-straightening. He was the subject of a newspaper expose in Cleveland, Ohio, for a heroic rescue in 1916 of workers trapped within a water intake tunnel, 50 ft (15 m) beneath Lake Erie. He performed his rescue using a hood fashioned to protect his eyes from smoke and featuring a series of air tubes that hung near the ground to draw clean air beneath the rising smoke. By using this simple principle of heat, it allowed Morgan to lengthen his ability to endure the inhospitable conditions of a smoke-filled room. Morgan is also credited as the first African American in Cleveland to own an automobile.
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Freemasonry
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Glaucoma
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/100_Greatest_African_Americans
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Alpha_Phi_Alpha
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/John_Hunt_Morgan
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Molefi_Kete_Asante
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Morgan's_Raid
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Washington_Metro
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Morgan_Boulevard_station
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Cleveland_Association_of_Colored_Men
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/International_Association_of_Fire_Engineers
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Chicago
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Cincinnati
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Cleveland
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Confederate_States_Army
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Henry_Ford
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Illinois
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Lexington,_Kentucky
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/National_Association_for_the_Advancement_of_Colored_People
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Native_Americans_in_the_United_States
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Ohio
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Carnegie_Hero_Fund
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Historically_black_colleges_and_universities
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Prince_George's_County,_Maryland
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Gas_mask
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Lake_Erie
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Cleveland_City_Council
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Lake_View_Cemetery
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Category:History_of_Cleveland,_Ohio
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Country_club
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Prince_Hall_Freemasonry
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Hair_straightening
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Paris,_Kentucky
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Call_and_Post
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Walpole_Island_First_Nation
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Category:Traffic_signals
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Category:People_from_Paris,_Kentucky
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Category:1877_births
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Category:1963_deaths
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Category:African-American_inventors
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Category:American_inventors
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Category:Burials_at_Lake_View_Cemetery,_Cleveland
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/Category:People_from_Cleveland,_Ohio
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/File:Morgan_signal.jpg
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/File:Morgan_grave_sm.jpg
http://dbpedia.org/ontology/wikiPageWikiLink                                      http://dbpedia.org/resource/File:Morgan_rescue.jpg
http://xmlns.com/foaf/0.1/isPrimaryTopicOf                                        http://en.wikipedia.org/wiki/Garrett_Morgan

143 Rows. -- 2281 msec.

7. What topics link to this topic?

This query looks two links back from :Garret_Morgan and groups on the first link, to find the most linked pages that link to :Garret_Morgan.

This query returns no results against the DBpedia SPARQL endpoint because the :wikiPageWikiLink property is not populated in th4e DBpedia SPARQL endpoint.

SQL>
sparql
  prefix : <http://dbpedia.org/resource/>
  prefix ontology: <http://dbpedia.org/ontology/>
  select ?link (count(*) as ?cnt)
  {
     ?link ontology:wikiPageWikiLink :Garrett_Morgan .
	  ?secondLink ontology:wikiPageWikiLink ?link .
  }
  group by ?link
  order by desc(?cnt);

link                                                                              cnt
LONG VARCHAR                                                                      LONG VARCHAR
_______________________________________________________________________________

http://dbpedia.org/resource/African_Americans                                     15853
http://dbpedia.org/resource/Traffic_light                                         843
http://dbpedia.org/resource/March_4                                               545
http://dbpedia.org/resource/Gas_mask                                              322
http://dbpedia.org/resource/John_Hunt_Morgan                                      285
http://dbpedia.org/resource/Paris,_Kentucky                                       281
http://dbpedia.org/resource/1877                                                  244
http://dbpedia.org/resource/Lake_View_Cemetery                                    120
http://dbpedia.org/resource/100_Greatest_African_Americans                        85
http://dbpedia.org/resource/Afro-textured_hair                                    70
http://dbpedia.org/resource/1920s                                                 46
http://dbpedia.org/resource/List_of_inventors                                     40
http://dbpedia.org/resource/History_of_Ohio                                       30
http://dbpedia.org/resource/Relaxer                                               28
http://dbpedia.org/resource/Call_and_Post                                         25
http://dbpedia.org/resource/Morgan_Boulevard_station                              17
http://dbpedia.org/resource/List_of_people_from_Kentucky                          15
http://dbpedia.org/resource/List_of_people_from_Cleveland                         13
http://dbpedia.org/resource/Natural_hair_movement                                 13
http://dbpedia.org/resource/Smoke_hood                                            12
http://dbpedia.org/resource/Morgan_(surname)                                      12
http://dbpedia.org/resource/History_of_Cleveland                                  11
http://dbpedia.org/resource/List_of_people_from_Ohio                              9
http://dbpedia.org/resource/List_of_Alpha_Phi_Alpha_brothers                      7
http://dbpedia.org/resource/Black_Man_(song)                                      7
http://dbpedia.org/resource/Garrett_(name)                                        6
http://dbpedia.org/resource/Ruth_Inge_Hardison                                    5
http://dbpedia.org/resource/July_1963                                             5
http://dbpedia.org/resource/Timeline_of_African-American_history                  4
http://dbpedia.org/resource/Edward_W._Crosby                                      4
http://dbpedia.org/resource/August_1963                                           4

31 Rows. -- 1449 msec.

8. Similarity Queries with the web user interface

Virtuoso comes with a convenient web user interface for making queries. In this example, we will look for topics that are similar to :Garrett_Morgan in the sense that they have similar properties, or predicate-object pairs. The first step is logging in, which you do at

http://server_ip:8890/conductor

you will see a screen like this where you can type in your login credentials (user "dba", password the password generated by the system)

After login, next click on Database, and then Interactive SQL, and then type in your command

Note that this box accepts Virtuoso SQL queries, so as with the SQL command, you must write the word "sparql" in front of a SPARQL query. For your cut-and-paste pleasure, he is the command:

sparql
prefix : <http://dbpedia.org/resource/>

select ?x (count(*) as ?cnt)
{
 {
    :Garrett_Morgan ?p ?y .
                 ?x ?p ?y .
} union {
     ?y ?p :Garrett_Morgan .
     ?y ?p ?x .
 }
}
group by ?x order by DESC(?cnt)

After clicking on execute, the database will think for about a minute and you will see the results like so:

Let's take a moment to think about this query and its result. The above query consists of the union of two graph patterns. Let's look at the query with just one graph pattern:

sparql
prefix : <http://dbpedia.org/resource/>

select ?x (count(*) as ?cnt) {
    :Garrett_Morgan ?p ?y .
                 ?x ?p ?y .
}
group by ?x order by desc(?cnt)

This query counts the number of predicate-object pairs that are shared by Garrett Morgan and every other topic in the database. One such predicate-object pair would be

?x <http://dbpedia.org/property/deathPlace> <http://dbpedia.org/resource/Cleveland> .

which selects for people who have died in Cleveland, as did Garrett Morgan. This query lists the topics in descending order of how many pairs they share. For most topics, this algorithm produces satisfying answers to the question "What are some topics that are similar to this one?"

The full query considers not only forward links, but also backwards links such as the pattern

<http://dbpedia.org/resource/100_Greatest_African_Americans> <http://dbpedia.org/ontology/wikiPageWikiLink> ?x

This is an example of a query that works on a statistical basis and is thus a bit insensitive to data quality and organization. Most likely it would be straightforward to make a better ranking function (than the count) because (i) some predicate-object pairs are more important than others, and (ii) some normalization would reduce the effect in which highly linked records do better in the result. For instance, John D. Rockefeller is probably on the list because he is a famous person with a large number of relationships and facts, not because he is particularly similar to Garrett Morgan.

9.Named Graphs, Set Operations, Alternate Points of View

If you do not specify a graph while writing a query, your queries will run on the default graph, which is the union of all the graphs in DBpedia. Most of the graphs in DBpedia do not overlap with each other, mainly because the graphs use different predicates and vocabulary. There are some cases, however, where different graphs represent different viewpoints about the world.

In particular, items in DBpedia are members of classes identified with the rdf:type predicate such as dbo:Person. DBpedia tries a number of different strategies to infer types, and these strategies can give different results. The dataset graph:instance_types_dbtax_dbo_en is constructed from analysis of Wikipeda categories and has 3,704,680 facts:

SQL>
sparql
prefix graph: <http://downloads.dbpedia.org/2016-04/core-i18n/en/>

select count(*) as ?cnt {
   graph graph:instance_types_dbtax_dbo_en.ttl.bz2 {
      ?s ?p ?o .
   }
}

cnt
INTEGER
_______________________________________________________________________________

3704680

1 Rows. -- 95 msec.

Another dataset, graph:instance_types_sdtyped_dbo_en.ttl.bz2 was generated based on the SDType algorithm talked about in this paper has 2,465,545 facts.

SQL>
sparql
prefix graph: <http://downloads.dbpedia.org/2016-04/core-i18n/en/>

select count(*) as ?cnt {
   graph graph:instance_types_sdtyped_dbo_en.ttl.bz2 {
      ?s ?p ?o .
   }
}

cnt
INTEGER
_______________________________________________________________________________

2465545

SPARQL has set operations that we can use to see how these two different type assignments can be compared to each other. For instance, the intersection of the two graphs is relatively small with just 81,411 facts.

SQL>
sparql
prefix graph: <http://downloads.dbpedia.org/2016-04/core-i18n/en/>

select count(*) as ?cnt {
   graph graph:instance_types_dbtax_dbo_en.ttl.bz2 {
      ?s ?p ?o .
   }

   graph graph:instance_types_sdtyped_dbo_en.ttl.bz2 {
      ?s ?p ?o .
   }
}

cnt
INTEGER
_______________________________________________________________________________

81411

The minus operator can be used to do logical negation, in this case, subtracting the sdtyped graph from the dbtax graph we find there are 3,623,269 facts that exist only in the dbtax graph:

SQL>
sparql
prefix graph: <http://downloads.dbpedia.org/2016-04/core-i18n/en/>
select count(*) as ?cnt {
   {
      graph graph:instance_types_dbtax_dbo_en.ttl.bz2 {
         ?s ?p ?o .
      }
   } minus {
      graph graph:instance_types_sdtyped_dbo_en.ttl.bz2 {
         ?s ?p ?o .
      }
   }
}

cnt
INTEGER
_______________________________________________________________________________

3623269

1 Rows. -- 12146 msec.

Doing the subtraction in the opposite order turns up 2,384,134 facts that only exist in the sdtyped graph.

SQL>
sparql
prefix graph: <http://downloads.dbpedia.org/2016-04/core-i18n/en/>
select count(*) as ?cnt {
   {
      graph graph:instance_types_sdtyped_dbo_en.ttl.bz2  {
         ?s ?p ?o .
      }
   } minus {
      graph graph:instance_types_dbtax_dbo_en.ttl.bz2 {
         ?s ?p ?o .
      }
   }
}

cnt
INTEGER
_______________________________________________________________________________

2384134

1 Rows. -- 5763 msec.

If we just want to look at a few facts shared by both graphs, we can query for the facts rather than the aggregate count:

SQL>
sparql
prefix graph: <http://downloads.dbpedia.org/2016-04/core-i18n/en/>

select ?s ?p ?o {
   graph graph:instance_types_dbtax_dbo_en.ttl.bz2 {
      ?s ?p ?o .
   }

   graph graph:instance_types_sdtyped_dbo_en.ttl.bz2 {
      ?s ?p ?o .
   }
} limit 25

s                                                        p                                                  o
LONG VARCHAR                                             LONG VARCHAR                                       LONG VARCHAR
____________                                             ____________                                       ____________

http://dbpedia.org/resource/Françoise_Mbango_Etone       http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Gezahegne_Abera              http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Wyomia_Tyus                  http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Brendan_Hansen               http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Cael_Sanderson               http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Georgios_Roubanis            http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Hasely_Crawford              http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Ian_Crocker                  http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Launceston_Elliot            http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Michael_Phelps               http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Natalie_Coughlin             http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Novlene_Williams-Mills       http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Rulon_Gardner                http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Tadeusz_Ślusarski            http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Usain_Bolt                   http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Tonique_Williams-Darling     http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Alexei_Aidarov               http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Anatoly_Alyabyev             http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Emil_Zátopek                 http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Frank_Luck                   http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Frank_Ullrich                http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Kati_Wilhelm                 http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Katrin_Apel                  http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Martin_Fourcade              http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete
http://dbpedia.org/resource/Michael_Greis                http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://dbpedia.org/ontology/Athlete

25 Rows. -- 137 msec.

10. How do graphs overlap?

You might be curious about how named graphs are related, and it is easy to explore this with the Ontology 2 Edition of DBpedia 2016-04. This is an example of a query you could not run on a public endpoint because it takes so much CPU power.

We discover the relationship between graphs by looking at the intersections between them. If two graphs share statements, it's likely that they represent different points of view or opinions about the field. With 75 graphs, there are 2850 possible intersections. We find, however, that just 48 intersections take place:

sparql
prefix graph: <http://downloads.dbpedia.org/2016-04/core-i18n/en/>

select ?g1 ?g2 (count(*) as ?cnt) {
   graph ?g1 {
      ?s ?p ?o .
   }

   graph ?g2 {
      ?s ?p ?o .
   }
   filter (?g1>?g2)
} group by ?g1 ?g2 order by desc(?cnt);

g1                                                                                           g2                                                                                                cnt
LONG VARCHAR                                                                                 LONG VARCHAR                                                                                      LONG VARCHAR
____________                                                                                 ____________                                                                                      ____________

http://downloads.dbpedia.org/2016-04/core-i18n/en/interlanguage_links_en.ttl.bz2             http://downloads.dbpedia.org/2016-04/core-i18n/en/interlanguage_links_chapters_en.ttl.bz2             21505897
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_uncleaned_en.ttl.bz2  http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_en.ttl.bz2                     18187437
http://downloads.dbpedia.org/2016-04/core-i18n/en/transitive_redirects_en.ttl.bz2            http://downloads.dbpedia.org/2016-04/core-i18n/en/redirects_en.ttl.bz2                                 7338753
http://downloads.dbpedia.org/2016-04/core-i18n/en/images_wkd_uris_en.ttl.bz2                 http://downloads.dbpedia.org/2016-04/core-i18n/en/images_en.ttl.bz2                                    4130922
http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_lhd_dbo_en.ttl.bz2          http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_en.ttl.bz2                            1990425
http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_sdtyped_dbo_en.ttl.bz2      http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_en.ttl.bz2                            1948409
http://downloads.dbpedia.org/2016-04/core-i18n/en/persondata_en.ttl.bz2                      http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_literals_en.ttl.bz2                     1151959
http://downloads.dbpedia.org/2016-04/core-i18n/en/persondata_wkd_uris_en.ttl.bz2             http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_literals_wkd_uris_en.ttl.bz2            1150856
http://downloads.dbpedia.org/2016-04/core-i18n/en/persondata_en.ttl.bz2                      http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_transitive_en.ttl.bz2                  858243
http://downloads.dbpedia.org/2016-04/core-i18n/en/persondata_wkd_uris_en.ttl.bz2             http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_transitive_wkd_uris_en.ttl.bz2         857368
http://downloads.dbpedia.org/2016-04/core-i18n/en/persondata_en.ttl.bz2                      http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_uncleaned_en.ttl.bz2             826410
http://downloads.dbpedia.org/2016-04/core-i18n/en/persondata_en.ttl.bz2                      http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_en.ttl.bz2                       819326
http://downloads.dbpedia.org/2016-04/core-i18n/en/persondata_wkd_uris_en.ttl.bz2             http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_wkd_uris_en.ttl.bz2              811613
http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_mappingbased_en.ttl.bz2    http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_en.ttl.bz2                            673077
http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_wkd_uris_en.ttl.bz2        http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_mappingbased_wkd_uris_en.ttl.bz2      668328
http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_transitive_en.ttl.bz2       http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_dbtax_dbo_en.ttl.bz2                   549743
http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_sdtyped_dbo_en.ttl.bz2      http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_lhd_dbo_en.ttl.bz2                     529984
http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_transitive_en.ttl.bz2       http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_lhd_dbo_en.ttl.bz2                     501833
http://downloads.dbpedia.org/2016-04/core-i18n/en/infobox_properties_mapped_en.ttl.bz2       http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                                 437586
http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_en.ttl.bz2                  http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_dbtax_dbo_en.ttl.bz2                   417015
http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_lhd_dbo_en.ttl.bz2          http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_dbtax_dbo_en.ttl.bz2                   402826
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_en.ttl.bz2            http://downloads.dbpedia.org/2016-04/core-i18n/en/homepages_en.ttl.bz2                                  310438
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_uncleaned_en.ttl.bz2  http://downloads.dbpedia.org/2016-04/core-i18n/en/homepages_en.ttl.bz2                                  310438
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_wkd_uris_en.ttl.bz2   http://downloads.dbpedia.org/2016-04/core-i18n/en/homepages_wkd_uris_en.ttl.bz2                         306991
http://downloads.dbpedia.org/2016-04/core-i18n/en/article_templates_nested_en.ttl.bz2        http://downloads.dbpedia.org/2016-04/core-i18n/en/article_templates_en.ttl.bz2                          258717
http://downloads.dbpedia.org/2016-04/core-i18n/en/infobox_properties_en.ttl.bz2              http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                                 189785
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_literals_en.ttl.bz2           http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                                 156909
http://downloads.dbpedia.org/2016-04/core-i18n/en/infobox_properties_mapped_en.ttl.bz2       http://downloads.dbpedia.org/2016-04/core-i18n/en/infobox_properties_en.ttl.bz2                          98579
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_uncleaned_en.ttl.bz2  http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                                  95498
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_en.ttl.bz2            http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                                  95119
http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_sdtyped_dbo_en.ttl.bz2      http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_dbtax_dbo_en.ttl.bz2                    81411
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_uncleaned_en.ttl.bz2  http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_disjoint_range_en.ttl.bz2         52130
http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_transitive_en.ttl.bz2       http://downloads.dbpedia.org/2016-04/core-i18n/en/instance_types_sdtyped_dbo_en.ttl.bz2                  49058
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_uncleaned_en.ttl.bz2  http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_disjoint_domain_en.ttl.bz2        15701
http://downloads.dbpedia.org/2016-04/core-i18n/en/specific_mappingbased_properties_en.ttl.bz2  http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                                11742
http://downloads.dbpedia.org/2016-04/core-i18n/en/persondata_en.ttl.bz2                      http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                                   9699
http://downloads.dbpedia.org/2016-04/core-i18n/en/persondata_en.ttl.bz2                      http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_disjoint_range_en.ttl.bz2          7084
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_disjoint_range_en.ttl.bz2  http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_disjoint_domain_en.ttl.bz2    1312
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_disjoint_range_en.ttl.bz2  http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                               329
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_en.ttl.bz2            http://downloads.dbpedia.org/2016-04/core-i18n/en/images_en.ttl.bz2                                        187
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_uncleaned_en.ttl.bz2  http://downloads.dbpedia.org/2016-04/core-i18n/en/images_en.ttl.bz2                                        187
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_wkd_uris_en.ttl.bz2   http://downloads.dbpedia.org/2016-04/core-i18n/en/images_wkd_uris_en.ttl.bz2                               186
http://downloads.dbpedia.org/2016-04/core-i18n/en/homepages_en.ttl.bz2                       http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                                    128
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_objects_disjoint_domain_en.ttl.bz2  http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                               53
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_literals_en.ttl.bz2           http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_en.ttl.bz2                                44
http://downloads.dbpedia.org/2016-04/core-i18n/en/mappingbased_literals_wkd_uris_en.ttl.bz2  http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_wkd_uris_en.ttl.bz2                       42
http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_mappingbased_en.ttl.bz2    http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                                      8
http://downloads.dbpedia.org/2016-04/core-i18n/en/geo_coordinates_en.ttl.bz2                 http://downloads.dbpedia.org/2016-04/core-i18n/en/citedFacts_en.ttl.bz2                                      4

48 Rows. -- 1719379 msec.

The query takes almost half an hour to run, but in exchange we get a map of the possible relationships between the named graphs. Note that intersection is symmetric, so we use the filter clause to (i) choose just one direction for each relation and (ii) eliminate the trivial conclusion that each graph intersects with itself.

Getting Support

There is a public mailing list for our AWS marketplace products at Google Groups.

The team at Ontology2 has extensive experience with Linked Data projects including DBpedia, Freebase, and other data sources; we've used this data for public web sites such as ny-pictures and our Legal Entity Identifier lookup. In particular, we're experienced at identifying and solving the data quality problems that people frequently experience with open data. Please contact us at inquiries@ontology2.com.