Before 12 days the below sparql query was working properly but when Dbpedia update the interface of the website in 2021 the same query could not retrieve any result. Actually there is no wikipagewikilink that was exist to connect movies and other resources.
the query that I used is
PREFIX dbont: <http://dbpedia.org/ontology/>
SELECT distinct ?p ?o
WHERE { <http://dbpedia.org/resource/The_Terminator> ?p ?o. ?o <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> dbont:Film.}
The result that I got before was all movies that are linked with terminator Film by WikiPageWikiLink predicate.
but now there are no such results.
Are there any changes occurred on DBpedia server?
Is this property(WikiPageWikiLink) removed ?
Is there any other way to get the movies that are directly linked to specific movie?
Thank you.
After contacting Dbpedia on Slack chat they said that there was a dataset missing in the last update. They solved the issue now and the same query that I Posted it works now. Many thanks to Patric for his follow up with databus team to solve this issue.
Related
When I go to http://localhost:8890/sparql/, there are two fields: Default Data Set Name (Graph IRI) and query. How can I list what all graphs (that go in the former field) are available in my DB? The field is not mandatory and I can just run a query against all namespaces. But I would like to know how to list the graphs available.
The only non-empty graph I was able to run was http://localhost:8890/sparql
For example, in a relational database environment, I believe this kind of info could be retrieved from system tables.
As noted in comments, this query will get you a list of all Named Graphs (which, as also noted, are not the same as "namespaces") in the targeted store --
SELECT DISTINCT ?g
WHERE { GRAPH ?g {?s ?p ?o} }
ORDER BY ?g
You can see live results (limited here to 100 graph names) on the DBpedia endpoint (a very short list, as you would expect) and on URIBurner (a much longer and more varied list).
I know this is an old question, but I was facing the same problem and thought someone else might benefit from the solution I found.
I was trying to execute this query to list all graphs and it was taking about 5 minutes to return a result:
SELECT DISTINCT ?g
WHERE {
GRAPH ?g {?s ?p ?o}
}
Instead, you should try the following query suggested in this documentation from Virtuoso:
SELECT DISTINCT ?g
WHERE {
GRAPH ?g {?s a ?o}
}
This query finished in less than 1 second and returned the list of graphs in the store. Of course, this query would only return graphs which have at least one triple with the predicate rdf:type, but it's still a big improvement on the one suggested by TallTed.
How can I get information about sports in Germany from DBpedia using SPARQL? What SPARQL query can get that information? I used this SPARQL query, but I get no results!
SELECT * WHERE {
?c a dbpedia.org/ontology/Country .
?c rdfs:label dbpedia:Germany .
}
Fixing the Query
The query you posted is malformed. Attempting to run it on the public DBpedia SPARQL endpoint produces an error. The reference dbpedia.org/ontology/Country should be dbpedia-owl:Country, and rdfs:labels are usually strings, so "Germany"#en should replace dbpedia:Germany. The corrected query, however, just returns a single result, http://dbpedia.org/resource/Germany.
SELECT * WHERE {
?c a dbpedia-owl:Country .
?c rdfs:label "Germany"#en .
}
SPARQL results
Asking about sport in Germany
Without more information about what kind of data you're trying to obtain, the simplest answer for querying about sport in Germany is that you should ask DBpedia to describe sport in Germany for you, almost literally. The following query is legal SPARQL that you can paste into the public DBpedia endpoint.
describe dbpedia:Sport_in_Germany
SPARQL results
There is a Wikipedia article Sport in Germany, and DBpedia's naming convention is such that there is a corresponding DBpedia resource, dbpedia:Sport_in_Germany, which the previous query describes.
I have a burning question concerning DBpedia. Namely, I was wondering how I could search for all the properties in DBpedia per page. The URI http://nl.dbpedia.org/property/einde concerns the property "einde". I would like to get all existing property/ pages. This does not seem too hard, but I don't know anything about SPARQL, so that's why I want to ask for some help. Perhaps there is some kind of dump of it, but I honestly don't know.
Rather than asking for pages whose URLs begin with, e.g., http://nl.dbpedia.org/property/, we can express the query by asking “for which values of ?x is there a triple ?x rdf:type rdf:Property in DBpedia?” This is a pretty simple SPARQL query to write. Because I expected that there would be lots of properties in DBPedia, I first wrote a query to count how many there are, and afterward wrote a query to actually list them.
There are 48292 things in DBpedia declared to be of rdf:type rdf:Property, as reported by this SPARQL query, run against one of DBpedia's SPARQL endpoints:
select COUNT( ?property ) where {
?property a rdf:Property
}
SPARQL Results
You can get the list by selecting ?property instead of COUNT( ?property ):
select ?property where {
?property a rdf:Property
}
SPARQL Results
I second Joshua Taylor's answer, however if you want to limit the properties to the Dutch DBpedia, you need to change the default-graph-uri query parameter to nl.dbpedia.org and set the SPARQL endpoint to nl.dbpedia.org/sparql, as in the following query. You will get a result-set of just above 8000 elements.
SELECT DISTINCT ?pred WHERE {
?pred a rdf:Property
}
ORDER BY ?pred
run query
These are the Dutch translations of the properties that have been mapped from Wikipedia so far. The full English list is also available. According to mappings.dbpedia.org, there are ~1700 properties with missing Dutch translations.
I want to get data (movie title, director name, actor name and the wikipedia link) of all movies present on dbpedia.
I tried this query on http://dbpedia.org/snorql/.
SELECT ?film_title ?star_name ?nameDirector ?link WHERE {
{
SELECT DISTINCT ?movies ?film_title
WHERE {
?movies rdf:type <http://dbpedia.org/ontology/Film>;
rdfs:label ?film_title.
}
}.
?movies dbpedia-owl:starring ?star;
foaf:isPrimaryTopicOf ?link;
dbpedia-owl:director ?director.
?director foaf:name ?nameDirector.
?star foaf:name ?star_name.
FILTER LANGMATCHES( LANG(?film_title), 'en')
} LIMIT 100
Responses seems correct, but the response time are slow, so I'm wondering if I can improve my query for get a faster response.
There are a couple of things you could change in your query that might make it faster.
Firstly what is the point of your SELECT DISTINCT subquery? Is that merely trying to eliminate duplicate film titles? Removing this may make things faster if you can live with a few duplicates.
Secondly the FILTER clauses requires the database to scan over all the possible matches and evaluate the expression on each possible match to determine whether to keep it or throw it away. Again if you can live with getting some duplicate data and don't mind non-English language tags removing the FILTER may make the query run faster.
Consider the following script:
PREFIX category: <http://dbpedia.org/resource/Category:>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dbpedia: <http://dbpedia.org/ontology/>
SELECT DISTINCT *
WHERE {
?s dcterms:subject category:Living_people .
?s foaf:name ?name
}
LIMIT 10000
When running it, I get something like this in result:
Sir Alexander Chapman Ferguson
Sir Alex Ferguson
Though they are different entries, they are definitely the same entities. So I would like to reduce the output when addressing the SPARQL endpoint, i.e. I would like to avoid editing output data because it may be challenging in this case. Could you help me with that? What should be fixed in my query?
As you see when you run your query, both the rows that you mention refer to the same resource: <http://dbpedia.org/resource/Alex_Ferguson>. The fact that you get multiple rows in your query result is simply because there are multiple names for this person.
So if you just need to ensure that you don't get duplicates in your application, simply make sure that your application treats each unique value for "s" in your query result as a separate person.
On the other hand, if your problem is the fact that you get multiple names for a person, you could perhaps use some other properties. For example, dbpedia:fullname only has a single entry, likewise the properties dbpedia:surname and dbpedia:givenName.