OCLC Developer Network

DBPedia / Schema.org Linked Data Demo

What it does

This bookmarklet extracts Schema.org markup about a person's vitrual interntional authority file (VIAF) from a webpage and uses the information recorded in VIAF to query DBPedia for additional information about this person. 

 

How it works

The bookmarklet is written in Javascript and uses the JQuery library as a support tool for easier interaction with the document object model. It uses a JQuery selector to extract the VIAF information contained on the website and then passes it on to an AJAX request to retrieve information from VIAF in an RDF format. Both VIAF and DBPedia do not support cross domain scripting and as a result a simple PHP proxy page needs to be placed as a man in the middle to facilitate interaction between the javascript and the data. The code for the PHP proxy is as follows (please note that this is demonstration code and should never be used in a production environment):

header("Access-Control-Allow-Origin: *");

if(!empty($_GET['url'])):
	echo file_get_contents($_GET['url']);
endif;

Once content is retrived from the VIAF, a regular expression is used to extract the DBPedia URL. A second AJAX query is used to retrieve the entry for a person on DBPedia in a JSON format. Using the JSON object, information can be extracted and displayed about a person. This particular demo extracts a summary snippet about the person that DBPedia has collected from Wikipedia.

 

Installing the code

The bookmarklet code (Javascript and server side helpers) is available for download from the Developer Network Subversion repository. You can also test the bookmarklet by dragging the link labelled "Query DBPedia" below to your bookmarks bar.

Query DBPedia

Follow the OCLC Developer Network:

The OCLC Developer Network supports the use of OCLC Web Services—a set of tools and APIs that expose data and services for WorldCat and our member libraries and partner institutions or companies. learn more »

© 2010 OCLC Domestic and international trademarks and/or service marks of OCLC Online Computer Library Center, Inc. and its affiliates


Powered by Drupal, an open source content management system