Arthur
Arthur

Reputation: 108

Which .nt file from the DBpedia dataset contains the triples about DBpedia classes?

I am working on a DBpedia dataset and using Apache Jena to execute SPARQL over a local Jena TDB dataset. I have downloaded only some of the files from DBpedia Downloads so that I could keep the size of my dataset to a minimum, but I get no results when I execute a SPARQL query of the kind:

Select distinct * WHERE {
<http://dbpedia.org/ontology/Person> ?x ?y
} LIMIT 5

However, if I run the same query on the Virtuoso client, I get valid results.

Which .nt file contains the URI triple of the form:

http://dbpedia.org/ontology/Person
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.w3.org/2002/07/owl#Class

Meaning, which .nt file in Downloads, needs to be added in my local Jena TDB dataset?

P.S. I already have Ontology Infobox Types in my dataset which contains triples of the form $object rdf:type $class .

Upvotes: 3

Views: 1682

Answers (2)

Joshua Taylor
Joshua Taylor

Reputation: 85863

One thing you can do to figure out where triple are coming from is to use a GRAPH, as in

SELECT DISTINCT * WHERE {
GRAPH ?g { <http://dbpedia.org/ontology/Person> ?x ?y }
}
LIMIT 20

which, using the Virtuoso client, finds the same triples as the query without them, but will show you which graph triples were obtained from, e.g.,

http://dbpedia.org                   rdf:type owl:Class
http://dbpedia.org/resource/classes# rdf:type owl:Class

Now, I imagine that http://dbpedia.com is a default graph that contains the triples from all the others, so the interesting one here is probably http://dbpedia.org/resource/classes#. Based on Ben Companjen's answer, I tried using the Ontology dataset, and when I run the following query (like yours, but without the LIMIT 5)

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT DISTINCT * WHERE {
    <http://dbpedia.org/ontology/Person> ?p ?o
}  

I get the result that <http://dbpedia.org/ontology/Person> a owl:Class (it's the next to last row). If the LIMIT 5 is present in the original query, you may not be seeing that particular result.

$ /usr/local/lib/apache-jena-2.10.0/bin/arq \
    --data ~/Downloads/dbpedia_3.8.owl \
    --query dbpedia.sparql 
-------------------------------------------------------------
| p                   | o                                   |
=============================================================
| rdfs:label          | "person"@en                         |
| rdfs:label          | "persona"@es                        |
| rdfs:label          | "Person"@de                         |
| rdfs:label          | "pessoa"@pt                         |
| rdfs:label          | "personne"@fr                       |
| owl:equivalentClass | <http://schema.org/Person>          |
| rdfs:label          | "Πληροφορίες προσώπου"@el           |
| rdfs:label          | "Oseba"@sl                          |
| owl:equivalentClass | <http://xmlns.com/foaf/0.1/Person>  |
| rdf:type            | owl:Class                           |
| rdfs:subClassOf     | <http://dbpedia.org/ontology/Agent> |
-------------------------------------------------------------

Upvotes: 2

Ben Companjen
Ben Companjen

Reputation: 1443

You need the DBpedia ontology. That defines the classes and properties in the http://dbpedia.org/ontology/ namespace.

Upvotes: 1

Related Questions