RDF

From AbiWiki

Revision as of 02:24, 12 October 2011 by Monkeyiq (Talk | contribs)
Jump to: navigation, search

Contents

What is RDF: The Resource Description Framework

RDF is a way for information to be represented in a computer such that it is usable to both humans and computers.

RDF provides fine grained and very explicit markup to allow concepts from the real world to be seen unambiguously by a computer. For example, people familar with the English language will read a reference to Tom as very likely being a citation of a particular person. In RDF, using FOAF, a computer will know that the string "Tom" is indeed associated with a person, and will quite possibly know other information about the person such as their phone number, email address, and social network.

The inclusion of RDF in the OpenDocument Format (ODF) expands the way in which people can communicate information; a single file can contain presentation, text content, and now also explicit meaning through RDF. People, Places, Events, Logistics, and more can be easily shared. Word processing software moves beyond the traditional processing of simple strings of letters to performing reasoning on information and helping you manage the things in your life.

The ODF allows RDF to be associated with parts of the document with links that give a word or phrase a unique identifier which the RDF can then link to. This way, if you have two "Tom"s in your document which are actually two people you can have different RDF for each Tom. The computer will understand that even though the document text only contains "Tom" that each of those are different people and know the respective information about each person.


RDF in Abiword: An Overview

Much of the work on RDF in abiword is recent and as such you will need the development branch of abiword to use it.

Abiword can preserve RDF through many file formats; ODF, RTF, and the native abw formats are supported. RDF is also preserved across clipboard actions, including to and from other RDF aware applications such as Calligra.

Creating RDF in an abiword document can be as simple as dragging a contact from the Evolution groupware suite into the document. Of course, you are also free to explicitly associate RDF triples with any part of the document to fulfill your needs.

There is a top level RDF menu in Abiword which allows you to edit the raw RDF triples, execute a query against all the RDF in the document, and highlight passages of text in the document which are explicitly linked to RDF triples.

To connect RDF with a part of the document text, abiword uses RDF Links. An RDF link can be associated with one or more RDF triples.

If you would like to associate some RDF with a word or phrase in the document, select that phrase and choose Insert/RDF Link from the menu. This will ask you for a name for the new link in a manner similar to creating a new bookmark. Once you have a new RDF Link, you can right click on it and choose to edit and query the RDF associated with just that link. Initially the RDF for an RDF Link will be empty.

When you choose RDF/Highlight RDF from the menu all your RDF links will be shown in a different color and underlined. This allows you to easily know where RDF is associated in your document. RDF should not be a hidden element in the document, it is there to help you and as such should be able to be quickly found if desired.

Getting RDF into and out of a document

All of the RDF for a document is available through the RDF/Edit RDF Triples... menu item. The resulting dialog will allow you to create, edit, and delete triples. You can also use the File/Import and Save As... menu items in that dialog to read an entire RDF/XML file into your document or save all the RDF in the document to an RDF/XML file.

Initial support for Drag and Drop from other applications has been added to abiword. Allowing you to drop contact and event information from other applications right into an abiword document and import that information into RDF. As this provides a very simple interface to interacting with RDF the drag and drop will likely be expanded to other data formats and allow dragging items out of abiword in the future.

Another way to get RDF into a document is to select a phrase in the document and choose Insert/RDF Link from the menu. This will ask you for an identifier for the RDF Link which you can then use to associate RDF directly with just that portion of the document. To edit the RDF for an RDF Link, right click on it and choose "Show RDF". Note that this dialog is very similar to the one which allows you to edit the RDF for the entire document, but is restricted to only the RDF which is associated with this RDF Link.

RDF can also be moved into and out of a document using copy and paste as described below.

Query Your RDF

Queries on RDF are commonly expressed in SPARQL. One might like to consider SPARQL as the RDF equivalent of SQL.

You can run a SPARQL query against all the RDF in the document or against only the RDF for an RDF Link. To query all the RDF, choose RDF/SPARQL Query from the menu. To query just the RDF for a particular RDF Link, right click on that link and choose SPARQL Query from the context menu. Note that a default query is provided in both of these cases which will return all the RDF for the document or RDF Link.

Since RDF Links are just one method of associating part of the document with RDF, there is also the RDF/Show RDF for cursor position menu item. If the cursor is on an RDF Link then Show RDF for cursor position does the same thing as selecting Show RDF from the context menu of the RDF Link. If the cursor is in an area of the document which has RDF associated not through an RDF Link then Show RDF for cursor position will generate a SPARQL query to show you just the RDF for where the cursor is located.

RDF Copy and Paste

If you copy and RDF Link and paste it into the same document then the name of the pasted RDF Link will be altered as no two RDF Links can have the same name in a document. Abiword retains the same name prefixed with an "x-" and appended with a generated document wide unique identifier. For example, if you select an RDF Link "foo" and then paste it into the document you might get an RDF Link "x-foo-2324".

If you are pasting an RDF Link from one document into another, the RDF Link name might not be in use already. If the RDF Link name is not in use then it will be preserved as it was. This allows RDF Links to be copy and pasted across documents without altering their names at all.

Note that not only will the RDF Link be copy and pasted but also the actual RDF Triples which are associated with that RDF Link.

Personal tools