[[PageOutline]]
== Talia Basics ==
This tutorial is meant to get you started in creating your own digital library with Talia. It will show you the main building blocks of the application, and how to modify them.
The first parts of this manual introduce some of the basic concepts of the software, while the later parts are a hands-on tutorial.
== Getting Started ==
* Before getting started with this tutorial, you should install Talia as explained in the TaliaInstallation guide. Be sure to also install the administration backend.
* Then import the demo data set as explained in the ImportingData instructions.
Now you should be almost ready to go. Install the mongrel gem (if you haven't already) and fire up your local development server:
{{{
#!sh
gem install mongrel
...
jruby script/server
}}}
If the server is running on your local machine, you can now point your browser at http://localhost:3000/sources/ and you should be greeted with a screen like this:
[[Image(vanilla_front.png, nolink)]]
Not quite bad, but there's much room for improvement.
=== Layout of the application ===
Talia is built on top of the [http://rubyonrails.org/ Ruby on Rails] framework. Each Talia application is a Rails application, and has the same basic layout. You may also use a lot of the existing Rails plugins to add to your Talia application.
This guide assumes that you have a working knowledge of Rails - if not, it may be time to check out the [http://guides.rails.info/getting_started.html Getting Started Guide] for Rails.
At this point, we will just have a quick look at the directory structure of our new application.
{{{
#!text
- talia_application
+- app <- Main application files
+- controllers
+- helpers
+- models
+- views
+- config
+- ontologies
+- public
+- script
+- vendor
+- plugins
}}}
== Talia Concepts ==
Before we get to the hands-on part, let us first have a look at some of the basic concepts of Talia.
=== Talia Sources ===
The default page shows you all the "Source" in the system. In Talia, a "Source" is the basic item of information.
It can be anything you've put into the digital library. It may be a record that refers to an existing physical object, like a book, a movie or a statue. It may be a digital representation of some object in the real world, like a photography or transcription. Or it may be a digital item that was created by you or your users.
=== Template system ===
Installing plugins is nice, but chances are that you will have to adapt the interface of your library quite a bit. To change the appearance of your application, you will have to modify the page templates that come with Talia. These template files are mostly HTML, with some Ruby code sprinkled in.
If you are a web designer or otherwise familiar with HTML, you shouldn't have big problems editing the template files.
''Hint:'' If you've installed the Hobo-based backend interface, you may also use the DRYML markup language, which is even more like HTML. But that is outside the scope of this tutorial. Here will will use the default system called ERB (embedded ruby).
=== Rails Template files ===
The templates for the HTML pages are kept in the "views" directory of any Rails application, including your Talia application. If you open the `views/sources` folder, you will see a number of template files that are used for the pages that you see on the `!http://yoursite.com/sources/*` URLs. All files are called `*.html.erb` which means that they are ERB templates that create HTML pages.
You'll also see a "semantic_templates" folder which is a speciality of Talia and at which we'll look in a moment.
But for now, have a look at the `index.html.erb` file - which is the one that creates the main list of sources that we saw above:
{{{
#!xml
<%= if(@pagination) ; will_paginate @sources ; end %>
}}}
As you can see this template only creates the "inner" portion of the page - the rest comes from the "layout" template that is shared between multiple pages. Again, check those Ruby on Rails tutorials to find out how this works.
Most of the template is basic HTML, and the code parts aren't too bad, either. But what do they mean?
{{{
#!xml
<%= link_to 'something', ... %>
}}}
This kind of tag (with <%= ) means that something should be inserted into the HTML at this point. For example, the fragment above calls the "link_to" helper function; it will take the parameters written after it and create a link in the web page at this point. Rails and Talia have hundreds of those little helper functions for all kinds of uses - check the Rails tutorials and documentation.
{{{
#!xml
<% for source in @sources %>
Some code - Source <%= source.title %>
<% end %>
}}}
This code fragment is a bit different. The <% for %> tag doesn't create HTML directly. Instead it repeats the block inside, each time for each element of the collection "@sources". So the fragment above would output an h1 tag with the title of each of the sources.
If you like, try modifying some parts of this template, and see the effects that it has.
=== The semantic data store ===
"Talia uses a semantic datastore that stores all the data in the [http://en.wikipedia.org/wiki/Resource_Description_Framework RDF Format]." Sounds cool - but what does it mean?
Actually, it's a kind of database, but more flexible. In traditional database (a "relational database"), all the data is stored in large tables. Each table has a fixed number of columns "fields" and any number of rows "records". For example, you may have a table called "books", that has columns for the title, author and the sales figure for that book.
This is easy to understand, but has some limitations. Most importantly, if you have another "property" of a book, let's say the publisher, then you'll have to modify the table and add another column to it. And if you work with less-organized data, it may be a really pain finding a "schema" that fits all your data elements.
In the world of semantic data stores, things work a bit differently. Instead of a fixed table, you have a collection of "triples", as they are called in RDF language. Each triple is a little "sentence" with three elements:
''''
The three parts of the triple are called
''