Knowledge & Media
Data 2 Documents Assignment


For this assignment you will set up a web document that uses Linked Data to do general Content Management and to retrieve interesting content from the Web of Data.

You will copy parts from an example web document and alter them to create a web document about Dutch Art, using Linked Data from DBpedia and the Rijksmuseum, using both dereferencing and SPARQL queries.

To do this, you will make use of Data 2 Documents (d2d), an RDF vocabulary for constructing ‘documents’ out of ‘data’.

At the end you will fill in a questionnaire and write a personal reflection.


You will get access to a personal subdomain to set up your web document. To start, you first have to create an account. By creating an account you will be handed out the specific subdomain. Please make an account via this link: 

Your subdomain will be in the line of: 

In which you have substitute ## with a two digit number, e.g. ‘01’, that is specifically assigned to you. Throughout the rest of these instructions, we will use the ## in examples; please replace them when copy/pasting URIs.

You can use the above URI to open and view your d2d document. At any time you can check your resulting output document by reloading/refreshing that URI. If you just created the account, there will be nothing there yet.

In order to access your directory, copy files and edit them, you can access an online file browser. Using this file browser you can download/upload files if you prefer to use your own IDE/Editor, but you can also edit them directly online by choosing the ‘Edit’ option from the file context menu (right click on a file), which saves you the hassle of uploading. To enter the online file browser, got to:   

In the file browser, you will see two ‘root’ directories. One is the root directory of your personal subdomain; the other is the root directory of the example d2d document you are going to copy and then edit. The root directories use the subdomain name. If we will refer to the path of a file, we will start if from the root folder using /.  You can also view the example document by opening its subdomain: 

You can use the files as examples and as a basis for your own tasks, just as you would normally google for examples. You can view the files in the examples by choosing ‘Edit’ from the context menu (but you can not save the example files). You can also copy files online from a folder in one of the examples to a folder within your own subdomain.

When editing a file online, you can resize the editor window at the outer bottom-right corner.

About Data 2 Documents

Data 2 Documents (D2D) is a vocabulary for constructing ‘documents’ out of ‘data’. It does so by breaking down web documents into a recursive hierarchy of small identifiable pieces of content that as such become a resource in the web of data. Hence, it helps bridge the gap between the ‘Web of Documents’ and the ‘Web of Data’. The vocabulary has a strong relation with semantic elements in HTML5 and allows for a declarative form of content management purely expressed in RDF. Furthermore, it facilitates easy publication of existing Linked Data in web documents and a novel way of sharing complex content between web documents, e.g. as in syndication.

Data 2 Documents is currently being devised at VU University Amsterdam. Hence, with this assignment you are participating in actual research.

The main ‘building blocks’, so to say, of Data 2 Documents are Articles, Article Definitions and Article Rendering Definitions.

Articles contain the factual content to be placed in the web document. These can be specially made for the document, or be already existing resources in the web of data. Articles are in principle Resources in the Web of Data.

Article Definitions determine which properties of a Linked Data resource, that is acting as article, are selected for use in the document. It does so by indicating which predicates (or possibly a longer property path) to use, seen from the main resource.

Article Rendering Definitions define how the fields of an article will be rendered to form part of the document. It does so by indicating which HTML template file to use for a certain article definition. The rendering can also be determined by properties within the definition and without a separate template file.

Though we will generally store one article, article definition or article rendering definition per file for ease of use, the articles, article definitions and article rendering definitions are Linked Data Resources and are not the same thing as the files they are described in.

A d2d:Document basically consists of a few Linked Data triples (data statements) that define which HTML template needs to be used for the document, what the root article is and which Article Rendering Definition needs to be used for the root article. The root article can have one or multiple nested articles, which in turn also can contain nested articles. We will say that an articles is Placed within another article, and that its Placement also indicates which Article Rendering Definition to use.


Overview of tasks:

  1. Create a new d2d:Document
  2. Add the introductory article to the document
  3. Change the title of the introductory article
  4. Add a FOAF profile to the document
  5. Create and add a new ‘comment’ article
  6. Add the comment article of two other participants to the document
  7. Correct the listing of Dutch Painters
  8. Add creation dates to the listing of artwork
  9. Bonus: Add a different category of people


Should you encounter problems, please consider the following steps:



You will need to fill them in in the questionnaire. Just rounded minutes.

Task 1 - Create a new d2d document

Before we start, let’s look at a few directories. In your root folder, there is a directory:


In that d2d directory, there are three more directories:




In these folders we will store Articles, Article Definitions and Article Rendering Definitions.

Finally, there is a folder called templates which contains HTML templates. For this assignment there is one template in the folder called ‘resume’.

To create a new d2d:Document, we will have to create or place a file containing RDF triples that describe that document. In the root folder, a new d2d:Document can be created by placing an ‘index.rdf’ file that contains the needed d2d:Document resource description.

You can copy the index.rdf file from the root folder of the example to your own root folder. The root folder is the uppermost folder which you will get by clicking on the subdomain name.

If you check the output document on, you will see that a document is now loaded.

Congratulations! You have just created your first d2d document!

However, that document looks just like the example document, though we only copied the index.rdf file and not all the other content such as articles and their definitions. How come? Well, this is due to the fact that in d2d, placed content is split up in separate ‘articles’ which are placed and referenced by their own URI. Hence, though we only copied the index.rdf file, a complete document is shown because the actual articles that are placed in the document are referenced by URI. That means your new document is now using articles from another site at another domain by using Linked Data principles such as dereferencing URIs. Hence, by this simple step alone you have basically demonstrated that using d2d, you can do content management across sites, organisations and domains the same way as within them.

If you open the index.rdf file for editing, you can see that there is a property d2d:hasArticle that points to an article ‘HomePageArticle’. This is the root article for the document, as explained earlier. Please find that article within the example site and copy it to the same location within your own site (Hence, in the folder: /d2d/a/).

Alter the URI in the index.rdf so that it points to your local (copied) version. This means changing the subdomain.

Task 2 - Add the introductory article to the document

The introductory article of the document is missing. You can find it in the directory /d2d/a/ of the example document. Please copy the file Welcome.rdf to your own /d2d/a/ folder and add it to the document:

Open the HomePageArticle.rdf file, which you copied in the previous task. Place the introductory article by copying the section that places the article ‘AboutUs’; place the copied lines above the placement of ‘AboutUs’ so that ‘Welcome’ will be the first article, and change the URI to end with Welcome (the name of the Welcome.rdf file, without ‘.rdf’, which can be omitted).

Please note to also change the subdomain name to your personal one!

Task 3 - Change the title of the introductory article

Within the Welcome article you just placed, change the ‘header’ field to:  Welcome to our site on Dutch Art

Task 4 - Add a FOAF profile to the document

FOAF is a Linked Data vocabulary for sharing personal info, much like you would an a business card.

Copy The About Us article to your own subdomain in the appropriate folder, and change its placement in HomePageArticle to point to your personal (copied) version.

Within the article About Us, you can see that there is one ‘nested’ article placed with a reference to a ‘foaf.rdf’ file, that is used as an article in the document.

Copy the section that places this foaf reference as an article, and use it to place a second person’s foaf profile as article. For this, use Aidan Hogan’s FOAF profile: 

Task 5 - Create and add a new ‘comment’ article

Within the article named Feedback, you can see that there is one nested article that places a comment.

Copy the rdf file containing that comment to your own folder, rename it, edit the content to your own comment on dutch art (may be any text, don’t spend too much time forming an opinion) and your own (or made up) name.

Place your new comment article on the document by placing it as new nested article in the Feedback article, before or after the already placed comment.

Submit the URI of your new comment article using this form (the .rdf at the end can be omitted): 

Task 6 - Add the comment articles of other students

Using this spreadsheet: 

Copy at least two URIs of the comments of other students and place them as additional comments. Check if they work; if not, pick another one. If there are not enough URIs in the list yet, you can continue and finish this task later.

Task 7 - Correct the listing of Dutch Painters

The article Dutch Painters wrongly lists Prime Ministers of The Netherlands. Make a personal copy of it, let the HomePageArticle refer to your own copied version, and change the article so that it lists Dutch Portrait Painters. You can use the URI: 

Task 8 - Add creation dates to the listing of artwork

This task might be a bit more challenging, hence do not despair if you encounter problems.

You are going to add the creation date to the paintings in the listing of Rembrandt’s work.

The article RembrandtVanRijn uses a SPARQL query to select pictures of Rembrandt’s work from the collection of the Rijksmuseum. The query already selects a field ‘created’, however it is currently not used by the article definition or in a rendering definition. You just have to tell the definitions to use it.

Copy the Article Definition RSRArtWork to the same location within your own share. Alter it to include a new field ‘created’, by looking at how the other fields are defined.

Copy the Article Rendering Definition RSRArtWorkRendering to the same location within your own share. Alter the properties d2d:renders and d2d:hasTemplate to point to the versions within your own subdomain.

Also make sure that the placement of the RembrandtVanRijn article, within HomePageArticle, refers to your personal copy, and that within the RembrandtVanRijn article, the nested article placement refers to your copied version of RSRArtWorkRendering.

Finally, edit the HTML template file at: /templates/resume/index.xhtml

Search for the tag:

<d2d:Template d2d:for="">

Note that you have to change the address in the d2d:for property so that this template will correspond to your copy of the rendering definition.

Within this template tag is the sub-template that renders the painting-articles.

Add a bit of HTML in order to render the new ‘created’ field. Along with the HTML tags, you can use d2d templating tags or tag combinations to determine where the field we be rendered. There are several options for choosing a field tag structure; some are listed below. Review them, also in comparison with the other fields, and pick one:

Simple version, gets replaced by the actual content:

<d2d:Field />

In principle, placing the simple version is enough. However you can also use the Extended version, to allow for conditional HTML:


{optional HTML markup, only gets placed if the field is placed}

<d2d:Content />

{optional HTML markup, only gets placed if the field is placed}


Or the full version: Allows for conditional HTML and sample content:


{optional HTML markup, only gets placed if the field is placed}


{sample content; gets replaced. Can contain nested Templates}


{optional HTML markup, only gets placed if the field is placed}


The d2d:Content tag can also be used as a self-closing version without sample content

Field/Content tags get replaced in the order they appear in the template. Alternatively, you can specify an index to indicate a different ordering, e.g:

<d2d:Field />

<d2d:Field d2d:index=”4” />

<d2d:Field />

<d2d:Field />

results in a field ordering of 1, 4, 2, 3 with respect to the order of the field specifications in the article definition.

Task 9 - Bonus: Add a different category of people

Can you add a listing of a different category of people to the document?

Tip 1: Within the current setup of the document, you need to create two new articles.

Tip 2: Using the link from task 7 and by browsing Wikipedia, you can search for a suitable category of people.


You’re almost done. Please fill in the questionnaire using the following link: