About RDF

Last modified by superadmin on 2018-01-12 20:18

About RDF

Resource description framework (RDF) is defined by W3C specification, and its data model is being used (among many other things) to describe content in the Web. RDF data model is represented as an (unordered) set of ordered triples. Each triple consists of subject, predicate and object (these typically correspond to mini-sentences describing knowledge about something). Subjects and predicates are identified by URLs, but object can be either URL or a literal. 

RDF can be represented in various ways - W3C specification is based on the XML serialization, it is also generated by tools like Protege To check the correctness of XML-serialized RDF data, one can use RDF Validator. Since XML is a tree-like structure, but RDF is a directed graph, there may be many ways how to serialize the same graph as XML. Besides the XML format, other RDF-data serializations, e.g. N3 are popular, because they are human readable. 

RDF in XWiki

There is some built-in support for RDF data in XWiki software. One can look at Main.Tags to see all the tags that are being used to tag XWiki documents. Besides each tag there is an icon http://www.ante.lv/xwiki/skins/albatross/icons/black%2Drss%2Dmini.png. It displays the RSS feed for that tag. RSS is metadata about Web resources, which can be represented as RDF (it is called RSS 1.0 or RDF Site Summary). To see this RDF in action, you can click on any of these icons, load RSS file into your browser and then look at its source (you can also copy-paste it to an RDF Validator to be sure that it is indeed syntactically correct). 

RSS is generated by XWiki using a simple magic - if a page URL has a parameter "xpage=rdf", then the contents between the opening "rdf:RDF" and closing tags is taken and everything else (i.e. the XWiki page boilerplate markup, including menus, etc.) is thrown away. Compare the result returned by these two URLs: 

You can create your own RSS feeds (and, in fact, any RDF data) by a similar technique - all you need is to copy the Velocity code TagsRss elsewhere and to modify it accordingly. If you need some RDF data of a different structure, then you will need to include another script rather than the one generating RSS 

#includeInContext("XWiki.WebRssCode")

. To generate RDF data, which reflects the metadata on your site, it necessary to understand Velocity and, likely, also Hibernate query language

Example: Assume that we want to display RSS, which lists all children documents of a given parent document. One can write the following Velocity script, which executes query: ...

Tags:
Created by Kalvis Apsītis on 2007-11-09 16:58
Translated into en by Kalvis Apsītis on 2008-02-02 15:37
    
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 6.4 - Documentation