Stanford Library Logo

-- Introduction to Library Technologies/ RDF and Linked-Data

RDF and Linked-Data

The Semantic Web is an international effort to bring machine-readable data to the web called linked data and was initially proposed by Sir Tim Berners-Lee in a 2001 article. RDF (Resource Description Framework) is a W3C specification that describes the model used to construct a directed graph that can be searched and manipulated using SPARQL query language.

RDF graphs made up a series of statements, called RDF triples. In a RDF triple, the first element is called a subject and represents a resource with the second element, the predicate, describing an aspect that connects to the third element, an object made up a value, blank node, or IRI. One or more these triple statements make up a RDF graph.

Diagram of a Jane Austen RDF Graph

International Resource Identifiers (IRIs)

Linked Data is is based on the idea behind the common URL, the uniform resource locator, used everyday when using the web. Internationalized Resource Identifier or IRI extend the concept of URL to use IRI as a global identifier and unlike a URL, an IRI can contain unicode characters from other non-European languages. An IRI serves as the critical linking data structure between local and global information sources. NOTE an IRI need not exist to be useful, only that it is uniquely and globally identifiable like an URL.


Subject Role

Predicate Role

Object Role

SPARQL & Serialization Formats

The value of RDF Linked Data comes when it is paired with a Triplestore that supports the RDF query language, SPARQL (short for SPARQL Protocol and RDF Query Language), allows for sophisticated retrieval of data within the triplestore as well as an means to manipulate the data by adding, editing, or deleting triples contained in the triplestore.

With RDF predicates restricted to IRIs, multiple RDF vocabularies can be used in the same graph with potential different semantic statements being asserted about the same subject. SPARQL easily handles multiple vocabularies like Schema.org and BIBFRAME.

Finally, RDF graphs support different serialization methods for both input and export of data. The RDF XML serialization was the first method followed by N-Triples, Turtle, and JSON-LD.

Example SPARQL - Number of Triples in Graph

      SELECT (COUNT(*) as ?count)
      WHERE { ?s ?p ?o . }
    

Example SPARQL - Entities and Titles for all BIBFRAME Works

PREFIX bf: <http://id.log.gov/onotologies/bibframe/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?iri ?title

WHERE { ?iri rdf:type bf:Work ;
      	     bf:title ?title_node .
      	?title_node rdf:value ?title
}
>>> http://www.worldcat.org/oclc/32050898,
    "Pride and Prejudice"
    

Example Graph in XML Format

      <?xml version="1.0" encoding="UTF-8"?>
      <rdf:RDF
         xmlns:bf="http://id.log.gov/onotologies/bibframe/"
         xmlns:owl="http://www.w3.org/2002/07/owl#"
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      >
        <rdf:Description rdf:about="http://www.worldcat.org/oclc/32050898">
          <rdf:type rdf:resource="http://id.log.gov/onotologies/bibframe/Work"/>
          <bf:title rdf:nodeID="N3d82a73836c547d8be606b01797b8fb8"/>
          <rdf:type rdf:resource="http://id.log.gov/onotologies/bibframe/Text"/>
          <bf:contribution rdf:nodeID="Nfbc8691a15774bf581a429e4f99822a7"/>
        </rdf:Description>
        <rdf:Description rdf:about="https://en.wikipedia.org/wiki/Jane_Austen">
          <rdfs:label xml:lang="en">Jane Austen</rdfs:label>
          <owl:sameAs rdf:resource="http://viaf.org/viaf/102333412"/>
          <rdf:type rdf:resource="http://schema.org/Person"/>
        </rdf:Description>
        <rdf:Description rdf:nodeID="Nfbc8691a15774bf581a429e4f99822a7">
          <bf:role rdf:resource="http://id.loc.gov/vocabulary/relators/aut"/>
          <rdf:value rdf:resource="https://en.wikipedia.org/wiki/Jane_Austen"/>
          <rdf:type rdf:resource="http://id.log.gov/onotologies/bibframe/Contribution"/>
        </rdf:Description>
        <rdf:Description rdf:nodeID="N3d82a73836c547d8be606b01797b8fb8">
          <rdf:type rdf:resource="http://id.log.gov/onotologies/bibframe/Title"/>
          <rdf:value xml:lang="en">Pride and Prejudice</rdf:value>
        </rdf:Description>
      </rdf:RDF>
    

Example in Turtle Format

      @prefix bf: <http://id.log.gov/onotologies/bibframe/> .
      @prefix owl: <http://www.w3.org/2002/07/owl#> .
      @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
      @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
      @prefix relators: <http://id.loc.gov/vocabulary/relators/> .
      @prefix schema: <http://schema.org/> .
      @prefix xml: <http://www.w3.org/XML/1998/namespace> .
      @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

      <http://www.worldcat.org/oclc/32050898> a bf:Text,
              bf:Work ;
          bf:contribution [ a bf:Contribution ;
                  bf:role relators:aut ;
                  rdf:value <https://en.wikipedia.org/wiki/Jane_Austen> ] ;
          bf:title [ a bf:Title ;
                  rdf:value "Pride and Prejudice"@en ] .

      <https://en.wikipedia.org/wiki/Jane_Austen> a schema:Person ;
          rdfs:label "Jane Austen"@en ;
          owl:sameAs <http://viaf.org/viaf/102333412> .
    

Example in JSON-LD Format

      [
        {
          "@id": "https://en.wikipedia.org/wiki/Jane_Austen",
          "@type": [
            "http://schema.org/Person"
          ],
          "http://www.w3.org/2000/01/rdf-schema#label": [
            {
              "@language": "en",
              "@value": "Jane Austen"
            }
          ],
          "http://www.w3.org/2002/07/owl#sameAs": [
            {
              "@id": "http://viaf.org/viaf/102333412"
            }
          ]
        },
        {
          "@id": "http://www.worldcat.org/oclc/32050898",
          "@type": [
            "http://id.log.gov/onotologies/bibframe/Work",
            "http://id.log.gov/onotologies/bibframe/Text"
          ],
          "http://id.log.gov/onotologies/bibframe/contribution": [
            {
              "@id": "_:Nfbc8691a15774bf581a429e4f99822a7"
            }
          ],
          "http://id.log.gov/onotologies/bibframe/title": [
            {
              "@id": "_:N3d82a73836c547d8be606b01797b8fb8"
            }
          ]
        },
        {
          "@id": "_:N3d82a73836c547d8be606b01797b8fb8",
          "@type": [
            "http://id.log.gov/onotologies/bibframe/Title"
          ],
          "http://www.w3.org/1999/02/22-rdf-syntax-ns#value": [
            {
              "@language": "en",
              "@value": "Pride and Prejudice"
            }
          ]
        },
        {
          "@id": "_:Nfbc8691a15774bf581a429e4f99822a7",
          "@type": [
            "http://id.log.gov/onotologies/bibframe/Contribution"
          ],
          "http://id.log.gov/onotologies/bibframe/role": [
            {
              "@id": "http://id.loc.gov/vocabulary/relators/aut"
            }
          ],
          "http://www.w3.org/1999/02/22-rdf-syntax-ns#value": [
            {
              "@id": "https://en.wikipedia.org/wiki/Jane_Austen"
            }
          ]
        }
      ]
    

BIBFRAME Vocabulary

A RDF vocabulary initiated by the Library of Congress in 2011, BIBFRAME, short for Bibliographic Framework, is in it's second version and is the bases for Linked Data for Libraries Production and other related projects.

BIBFRAME is made up three primary classes, Work, Instance, and Item and a number of secondary, supporting classes.

BIBFRAME Work

Definition: The highest level of abstraction, a Work, in the BIBFRAME context, reflects the conceptual essence of the cataloged resource: authors, languages, and what it is about (subjects). source

BIBFRAME Instance

Definition: A Work may have one or more individual, material embodiments, for example, a particular published form. These are Instances of the Work. An Instance reflects information such as its publisher, place and date of publication, and format. source

BIBFRAME Item

Definition: An item is an actual copy (physical or electronic) of an Instance. It reflects information such as its location (physical or virtual), shelf mark, and barcode. source

BIBFRAME 2.0 Model
© 2018 Jeremy Nelson, Stanford University. Licensed under CC 4.0