Here are some quick ways to query “World Knowledge” information using SemantiNet’s API, in a very basic way.
- http://api.headup.com/v1?q=dbpedia:New_Zealand/label – get the name of New Zealand.
- http://api.headup.com/v1?q=dbpedia:New_Zealand/dbpedia-owl:capital/label – get the name of New Zealand’s capital.
- http://api.headup.com/v1?q=dbpedia:New_Zealand/dbpedia-owl:capital/latlong – get the coordinates of New Zealand’s capital.
Let’s break it down a bit:
- dbpedia:New_Zealand – brings the node in the graph that represents New Zealand. How did we know to put an “_”? DBPedia matches Wikipedia’s URLs, and New Zealand’s Wikipedia entry resides under http://en.wikipedia.org/wiki/New_Zealand. We used Google to find how New Zealand appears in Wikipedia.
- We added a “label” to it, in order to get a nice representation of it.
- dbpedia-owl:capital – gets New_Zealan’s capital.
- latlong – get the coordinates of the capital.
Of course that we can run similar ones:
- http://api.headup.com/v1?q=dbpedia:Greenwich/latlong
- http://api.headup.com/v1?q=dbpedia:Eiffel_Tower/latlong
- http://api.headup.com/v1?q=dbpedia:Brazil/abstract
- http://api.headup.com/v1?q=dbpedia:Brazil/dbpedia-owl:areaMetro
- http://api.headup.com/v1?q=dbpedia:Brazil/dbpedia-owl:thumbnail
Notice that Linked-Data (including Wikipedia) contain over 1 Billion(!) facts, so these simple queries actually give access to quite a bunch of data.
Want to play around? Give it a spin: http://www.headup.com/playground.php
Or, check out the documentation in the wiki: http://wiki.headup.com/index.php?title=Knowledge_Graph_API
Leave a comment