Data Modeling (RDF)#

Resource Description Framework (RDF) is a framework for describing a resource, but describing the resource in a way that allows you to integrate with (i.e., “link to”) related data across the Web.

RDF resource is a document/file whose contents consists of statements that have the following form (also known as a triple):

<subject> <predicate> <object>

where:

  • subject is the thing being described and is a URL.

  • predicate is the descriptive property (e.g., name, height, size, etc.) of the thing and is a URL.

  • object is the property value and is either a URL or a literal.

The predicate describes the relationship between the subject and the object. That is,

flowchart LR subgraph something id1((subject)) end subgraph this value id2((object)) end id1 --predicate/has some property with --> id2

Use of URLs#

In RDF, the use of URLs allows for disambiguation of the terms:

  • URLs provide global uniqueness.

  • URLs can be looked up which can provide additional context (such as descriptions and additional information) and thereby may help reduce ambiguity.

For example, consider a Java class with a field named "title". The string literal "title" may refer to a job title, an honorific (e.g., “Dr.”, etc.), a title of a book, etc. Determining which title definition applies depends on the context. The use of URLs can help address this ambiguity. For example:

  • http://schema.org/title refers to a job title, and

  • http://purl.org/dc/terms/title refers to a title of some resource (like a book, a course, etc.)

For more information, see Vocabulary.

Turtle#

When expressing RDF triples in Turtle (Terse RDF Triple Language) format :

  • URLs are enclosed in angle brackets.

  • Triple statements end with a period (.).

For example, the following statements are examples of Turtle:

<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense> <https://schema.org/provider> "Example Restaurant" .
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/purchaseDate>  "2023-03-07T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/provider>      "Example Restaurant" ;
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/description>   "Team Lunch";
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/category>      "Travel and Entertainment" ;
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/priceCurrency> "USD" ;
<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>     <https://schema.org/totalPrice>    "120"^^<http://www.w3.org/2001/XMLSchema#decimal> .

In Turtle, for statements with the same subject, you can avoid repeating the subject by combining the statements with a semicolon (;):

<https://storage.example.com/myRootContainer/expenses/20230306/teamLunchExpense>
        <https://schema.org/purchaseDate>  "2023-03-07T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
        <https://schema.org/provider>      "Example Restaurant" ;
        <https://schema.org/description>   "Team Lunch";
        <https://schema.org/category>      "Travel and Entertainment" ;
        <https://schema.org/priceCurrency> "USD" ;
        <https://schema.org/totalPrice>    "120"^^<http://www.w3.org/2001/XMLSchema#decimal> .

For object values (can be a literal or a URL), you can append ^^<URL of the data type> to the literal value to avoid ambiguity. For example, the following object value explicitly indicates that the value is a decimal and not a string or an integer literal.

"120"^^<http://www.w3.org/2001/XMLSchema#decimal> .

Additional Information#

For more information on RDF and Turtle, see: