1

I have a couple of years of programming experience in Java (Android) and this is my first time with the use of API's to retrieve JSON data. So to get basic facts on a queried topic I thought of using Freebase API however this is now going to be deprecated and Google is moving it to Wikidata. However the query API is still in beta and I simply cannot understand the query API documentation or how to retrieve the facts. So is there an alternative to Wikidata and Freebase?

These are my final questions:

  • Can someone please explain to me how I would go about using the Wikidata query API? AND retrieve the facts in a readable format?
  • Or can someone suggest me a better alternative to Freebase other than Wikidata?
Termininja
  • 6,620
  • 12
  • 48
  • 49
KISHORE_ZE
  • 1,466
  • 3
  • 16
  • 26

1 Answers1

2

The data you want to access is stored in a Subject Property(also Predicate) Object (SPO) format. That means you have a subject and an object that is associated with a property for example <Albert_Einstein> <wasBornIn> <Germany>.

Usually you can access those SPO-databases over an endpoint using SPARQL. SPARQL is a SQL like language which allows you to formulate queries to access the data. Fortunatly for you Wikidata also has a sparql endpoint you can use: https://query.wikidata.org/

Here is a simple example which will load all subjects that are referenced, using a rdf-schema label, to the String "Titanic" and limit the results to 100 entries.

select distinct ?a where {?a <http://www.w3.org/2000/01/rdf-schema#label> "Titanic"@en } LIMIT 100 

To query Wikidata in Java you can use Jena which will allow you to use SPARQL-queries and the endpoint to access the data.

As far as I know you can also access Wikidata using http but there a few benefits using SPARQL. There are two other big databases I know of that you can use and both of them have a SPARQL endpoint. So it's quite easy to change the endpoint to access the other two databases. It's also possible that one database contains a reference to another database which you can follow to gather more data.

Since you also asked for alternatives the two databases I mentiond are DBpedia (SPARQL-Endpoint) and Yago (SPARQL-endpoint). Both use Wikipedia to extract facts and therefor they are huge. Yago also uses WordNet to build a nice taxonomy you can use to classify your data. DBpedia on the other hand has a lot of references to other sites you can use.

Evox33
  • 98
  • 1
  • 8
  • Thanks for the answer. Since I have so experience in this SPQARL based endpoint system. If I opted to go did say the Google knowledge graph Api. How would I use it. In the Google documentation it shows example of java using Google http client which is not Normally importable. So using the basic async task. Could u pls show me an example of just retrieving the JSON data? Thanks. Sorry for my incompetence in this matter but as I mentioned earlier this is my first time in with Apis – KISHORE_ZE Mar 26 '16 at 07:20
  • Also I have already requested the Api key. – KISHORE_ZE Mar 26 '16 at 07:25