Shawn Simister

Developer Relations, Knowledge



  • Freebase
  • Schema.org
  • Knowledge Graph

The Knowledge Graph

The Freebase Knowledge Graph

www.freebase.com


  • Open, crowd-sourced, knowledge graph.
  • 1B+ facts, 40M+ topics, 2k+ types.
  • Free APIs
  • Creative Commons Attribution License.
  • RDF Data dumps.
  • A source for Google’s Knowledge Graph.

Autosuggest



Semantic Tagging



Entity Collections



Geosearch Collections



Topical Weblinks



Autosuggest

Turning strings into things

Freebase Search Widget

Download source code from GitHub

Freebase Search API

Keyword search query

https://www.googleapis.com/freebase/v1/search
?query=daft
&filter=(all type:/music/musical_group)

Freebase Search API

Keyword search response

{
  "status": "200 OK",
  "result": [
    {
      "mid": "/m/016j7m",
      "id": "/en/daft_punk",
      "name": "Daft Punk",
      "notable": {
        "name": "Musical Group",
        "id": "/music/musical_group"
      },
      "lang": "en",
      "score": 40.160641
    },...
  ],
  "cursor": 20,
  "cost": 16,
  "hits": 78268
}

Adding entity autosuggest to your app

Using the Freebase Search Widget

Simple jQuery widget that can be added to any HTML form.

$(function() {
  $("#myinput").suggest({filter:'(all type:/music/musical_group)'});
});

Semantic Tagging

Adding meaning to content

jQuery Tag-it

Download source code from GitHub

Adding semantic tagging to your app

Using jQuery Tag-it

Simple jQuery widget that can be added to any HTML form.

$("#myTags").tagit({ autocomplete: {
  source: function( request, response ) {
    $.ajax({
      url: "https://www.googleapis.com/freebase/v1/search?callback=?",
      dataType: "jsonp",
      data: { query: request.term,
              exact: false,
              limit: 6,
              prefixed: true
      }, success: function( data ) { ... }
})}}});

Entity Collections

Exploring related topics.

Entity Collection Demo

Download source code from GitHub

Freebase Search API

Structured search query

https://www.googleapis.com/freebase/v1/search?
filter=(all type:/film/actor contributed_to:/m/0gtt5fb)

Actors starrring in the movie The Great Gatsby (/m/0gtt5fb)


Learn more:

Search API Cookbook

Search Metaschema

Freebase Search API

Structured search response

{
  "status": "200 OK",
  "result": [
    {
      "mid": "/m/0dvmd",
      "id": "/en/leonardo_dicaprio",
      "name": "Leonardo DiCaprio",
      "notable": {
        "name": "Actor",
        "id": "/m/02hrh1q"
      },
      "lang": "en",
      "score": 25.49761
    }...
  ],
  "cost": 9,
  "hits": 20
}

Showing entity collections in your app

Using the Freebase Search API

Simple API call that can display related entities.

$("#myinput").change(function() {
  var search_service = 'https://www.googleapis.com/freebase/v1/search';
  var params = {
    'filter': $('#myinput').val(),
    'output': '(description)',
    'limit': 7
  };
  $.getJSON(search_service + '?callback=?', params, function(response) {
      for (var i=0; i<response['result'].length; i++) { ... }
  });
});

Geosearch Collections

Exploring local topics.

Geosearch Collection Demo

Download source code from GitHub

Freebase Search API

Geosearch query

https://www.googleapis.com/freebase/v1/search?filter=
(all type:/travel/tourist_attraction (within radius:5000ft lat:48.8656 lon:2.3211))

Tourist attractions within 5000 feet of (48.8656, 2.3211) - Paris

Freebase Search API

Geosearch response

{
  "status": "200 OK",
  "result": [
    {
      "mid": "/m/02j81",
      "id": "/en/eiffel_tower",
      "name": "Eiffel Tower",
      "notable": {
        "name": "Building",
        "id": "/architecture/building"
      },
      "lang": "en",
      "score": 23.409916
    }...
  ],
  "cost": 5,
  "hits": 10
}

Showing geosearch results in your app

With the Google Maps API

Simple jQuery widget that can be added to any HTML form.

$.getJSON('https://www.googleapis.com/freebase/v1/search?callback=?', {
  'filter': '(all (within radius:5000ft lat:48.8656 lon:2.3211))',
  'output': '(description geocode)'
}, function(response) {
    for (var i=0; i<response['result'].length; i++) {
      var result = response['result'][i];
      var geolocation = result['output']['geocode']['/location/location/geolocation'][0];
      var marker = new google.maps.Marker({
          position: new google.maps.LatLng(geolocation['latitude'],
                                           geolocation['longitude']),
          map: map,
          title: result['name']
})}});

Topical links

Link out to the rest of the web.

Topical Links Demo

Download source code from GitHub

Freebase Topic API

Weblink query

https://www.googleapis.com/freebase/v1/topic/m/0n839?
filter=/common/topic/social_media_presence

Social links for Richard Branson (/m/0n839)


https://www.googleapis.com/freebase/v1/topic/m/0n839?
filter=/common/topic/topic_equivalent_webpage

Topical links for Richard Branson (/m/0n839)

Freebase Topic API

Weblink response

{
  "id": "/m/047v2gm",
  "property": {
    "/common/topic/social_media_presence": {
      "valuetype": "uri",
      "values": [
        {
          "text": "http://plus.google.com/111294603513237625983",
          "lang": "",
          "value": "http://plus.google.com/111294603513237625983",
          "creator": "/user/googlebot",
          "timestamp": "2013-04-22T21:21:20.000Z"
        }
      ],
      "count": 1
    }
  }
}

Adding topical links your app

Using the Freebase Topic API

$("#myinput").suggest().bind("fb-select", function(e, data) {
    var topic_service = 'https://www.googleapis.com/freebase/v1/topic';
    var params = {'filter': '/common/topic'};
    $.getJSON(topic_service + data.id + '?callback=?', params, function(topic) {
      var weblinks = data.property['/common/topic/social_media_presence']['values'];
      for (var i=0; i<weblinks.length; i++) { ... }
    });
});

Autosuggest



Semantic Tagging



Entity Collections



Geosearch Collections



Topical Weblinks



Getting Started



Office Hours

Tomorrow 9-11am

Ask me anything about Freebase and the Knowledge Graph.




Code Lab

Tomorrow 2-4pm in Room 3

Learn how to use the Freebase Search API to find video on YouTube.