|
Hi.. I have today itself jumped into DBPedia and am following the example give in the book "Semantic web Programming by John Hebeler" I came across a Query that does not give me any result in the DBPedia SPARQL end Point @ http://dbpedia.org/sparql The code that I have tried to run is as follows:
This returns the URI's of all locations named after George Washington. I get no result but just a table header labeled location. Can someone provide me the correct query? I suppose the URI's have been changed a lot as DBPedia evolved due to which I am unable to get the result. Kindly help and do tell me some tutorial if possible to learn how to query resources at DBPedia??
This question is marked "community wiki".
|
|
Hmm... after a root-around, the query you're looking for is:
For learning SPARQL, you should check out SPARQL by Example by Cambridge Semantics. It contains some DBPedia examples.
link
This answer is marked "community wiki".
Woooooooww.... Loved the response time of yours... Thanks a lot!! :) can you pls let me know that how do we select the correct data Sets as in the URI's to query?? should we study the structure of them or there is some kind of documentation?? One more thing what was wrong in the query I wrote?? as in mentioned in the book? 1
:). With respect to the first question, knowing what endpoint/dataset to query against is very much based on experience... similarly for how the query is structured (unfortunately, there's no easy answer). With respect to the second question, the query in the book (simply put) does not follow the modelling of the data which it is querying over... my guess is that the query in the book never worked. :/ 1
hehehehe :) I got it!!! and it seems that the book is a good resource but a bit outdated. Thanks anyways :) |
|
The query as written in the book is what ought to be possible. It assumes that there are nodes representing people, and nodes representing places, and a "namedFor" predicate that connects them. But in fact, dbpedia doesn't have this. It has nodes representing places, and a "namedFor" predicate, but the predicate connects to untyped text strings instead of people. Signified's answer will get you only some of the data. For a little more, try this:
To see why I did that, try this:
Ponder these for a couple minutes and you'll realize that a) you have no idea how many other permutations of George Washington's name might have been used, b) you have no way of knowing whether those "George Washington" strings all represent the first president, or nine different guys named George Washington, or some combination of those. You might then conclude that this is idiotic, and misses the point of the Semantic Web pretty much entirely. And then you might notice that the state of Washington isn't even on this list. And then you might start to suspect, correctly, that it's generally a waste of time querying dbpedia for anything where you actually care about the answers.
link
This answer is marked "community wiki".
1
LOL! This is probably generally true. It takes work to get verified good data out of DBPedia. But its still a valuable resource. Agree with scott on this. @glenn, you're being a tad bit harsh on DBpedia... definitely for applications with critical soundness and completeness requirements, one may want to think twice about using DBpedia unsupervised. That's different from saying that it's a waste of time if you care about the answers. :P @glenn - DBpedia is far from perfect. Like its source material. One might suggest that the missing information could be added to Wikipedia (the source of most DBpedia content), and/or that some refinement might be made to the DBpedia extractors (which pull the data from Wikipedia)... Also, remember that SPARQL and RDF universes operate under the "Open World" assumption -- that is, anything unstated is unknown. The state of Washington not being included in your result set does not mean that it was not named for President George Washington -- it means that DBpedia (Wikipedia) doesn't know. If that is the case where can I find data that can be used to the utmost perfection. Coz the DBPedia has some data that gets updated every now and then... The book I referred was written 2years ago and according to me two years are more than enough for a change to come. SO can you suggest me some place where I have to toil less for data coz I am a beginner and dont want to waste my time working on a query that will never run!!? :) |
|
For more fun (and faster response time), you can try using one of the built-in functions (bifs) of the Virtuoso server powering the DBpedia.org SPARQL endpoint --
|

