Project

General

Profile

D2R server

Intro

D2R Server is a tool for publishing relational databases on the Semantic Web. It enables RDF and HTML browsers to navigate the content of the database, and allows applications to query the database using the SPARQL query language. More info here.

IPSYP's D2R server is running at http://192.168.10.109:8080/.

Configuration

D2R needs mapping definitions between relational schema and RDF schema used for publishing linked data. An example of mapping definitions follow:
  • Consider the table jos_members(me_id, me_department, me_dpt_head, me_firstname, me_firstname_en, me_lastname, me_lastname_en, me_category, me_position, me_position_en, me_is_alumni, me_email, me_phone, me_extphone, me_webpage, me_photo, me_bio, me_bio_en, me_sex). With bold are the attributes that we are going to publish as linked data.
  • Next we define a mapping map:Members to handle table jos_member.
    map:Members a d2rq:ClassMap;
        d2rq:dataStorage map:database;
        d2rq:uriPattern "members/@@jos_members.me_id@@";
        d2rq:class foaf:Person;
        d2rq:classDefinitionLabel "members";
            .
    
    With d2rq:uriPattern we define how the URI for each map:Member entity is constructed. Example: http://192.168.10.109:8080/resource/members/10. Note that @@jos_members.me_id@@ gets the value from jos_members.me_id. map:Members is defined to be a foaf:Person class in order to be able to use foaf vocabulary.
  • Next we define properties for the class to which jos_member has been mapped, and we define how to construct triples of those properties by iterating over a set of values from the database.
    map:FirstName a d2rq:PropertyBridge;
        d2rq:belongsToClassMap map:Members;
        d2rq:property foaf:firstName;
        d2rq:propertyDefinitionLabel "firstName";
        d2rq:column "jos_members.me_firstname_en";
            .
    
    With d2rq:property foaf:firstName we define the firstName property for map:Members entities, and with d2rq:column "jos_members.me_firstname_en" we declare that we want to create one triple for each value from column me_firstname_en of table jos_members: (URI, foaf:firstName, column_value). See also the email property definitions:
    map:Email a d2rq:PropertyBridge;
        d2rq:belongsToClassMap map:Members;
        d2rq:property foaf:mbox;
        d2rq:propertyDefinitionLabel "email";
        #d2rq:column "jos_members.me_email";
        d2rq:pattern "@@jos_members.me_email@@@imis.athena-innovation.gr" 
            .
    
    Note that instead of d2rq:column, here we use d2rq:pattern since we want to "build" the property value from a column value @@jos_members.me_email@@ and the string "@imis.athena-innovation.gr".
  • Next we show how to create a property and define how to construct triples of that property by iterating over a set of values from multiple tables of the database.
    map:Department a d2rq:PropertyBridge;
        d2rq:belongsToClassMap map:Members;
        d2rq:property imis:isMember;
        d2rq:propertyDefinitionLabel "department";
        #d2rq:column "jos_members.me_department";
        d2rq:column "jos_departments.de_name_en";
        d2rq:join " jos_members.me_department =  jos_departments.de_id"    
        .
    
    Note that imis:isMember property gets de_name_en values from jos_departments, based on a join between jos_members and jos_departments tables.
  • Next we show how we add owl:sameAs properties (again using a join between two tables).
    map:MemberSameAsStatement a d2rq:PropertyBridge;
        d2rq:belongsToClassMap map:Members;
        d2rq:property owl:sameAs;
        d2rq:propertyDefinitionLabel "SameAs";
        #d2rq:uriPattern "@@members_DBLP_URIs.me_DBLP_URI@@";
        #d2rq:condition "members_DBLP_URIs.me_id = jos_members.me_id";   
        d2rq:uriColumn "members_DBLP_URIs.me_DBLP_URI";    
        d2rq:join "jos_members.me_id = members_DBLP_URIs.me_id"; 
            .
    

To run D2R:

./d2r-server -p 8080 ../demo/mapping.n3

D2R is very flexible in exporting views of RDBMS as linked data.

It also automatically sets up SPARQL endpoint at http://WEB_APP_ADDRESS/sparql (e.g., http://192.168.10.109:8080/sparql for IPSYP's D2R).

URI Constructors are very helpful (e.g., uri:Pattern)

The better way to handle owl:sameAs is to create separate tables (one for each entity type we want to link with external LOD sources) in the database having URIs from global LOD hubs (e.g., DBPedia, DBLP). This can be done, e.g., using the SILK co-reference tool, or writing custom-based agents to query the SPARQL endpoints of the global hubs in order to get the URIs and insert them in the database tables. Then, define the owl:sameAs properties as in the last bullet.

Publications

  1. D2RQL: Treating Non-RDF Databases as Virtual RDF Graphs
    Christian Bizer, Andy Seaborne
    Poster In ISWC '04
  2. D2R Server – Publishing Relational Databases on the Semantic Web Poster
    Christian Bizer, Richard Cyganiaks
    Poster In ISWC '06
    Abstract. D2R Server is a tool for publishing the content of relational databases on the Semantic Web. Database content is mapped to RDF by a declarative mapping which specifies how resources are identified and how property values are generated from database content. Based on this mapping, D2R Server allowsWeb agents to retrieve RDF and XHTML representations of resources and to query non-RDF databases using the SPARQL query language over the SPARQL protocol. The generated representations are richly interlinked on RDF and XHTML level in order to enable browsers and crawlers to navigate database content
  3. D2R Server: A Semantic Web Front-end to Existing Relational Databases Poster
    Christian Bizer, Richard Cyganiak
    Poster In BXMLT '06
    Abstract. RDF and the SPARQL query language and protocol provide a standardized way of exposing and linking data sources on the Web. Just as HTML front-ends to existing databases were a key factor in driving widespread adoption of the World Wide Web, RDF front-ends to these data sources will be important in bootstrapping the Semantic Web. We present D2R Server, a system that takes SPARQL queries from the Web and rewrites them to SQL queries via a D2RQ mapping. This on-the-fly translation allows Web access to the content of large databases without the need for replicating them into RDF.

Links

IPSYP's D2R server