IMSEVimse 1.0
Draft

se.kth.cid.metadata.rdf
Class RDFLangStringHandler

java.lang.Object
  |
  +--se.kth.cid.metadata.rdf.RDFLangStringHandler

public class RDFLangStringHandler
extends Object

LOM-LangString extraction utilities (from a RDF-Model).

A LangString contains an oroginal string in a specified language and a set of translations.

This class allows you to

  1. Extract a single single string in one language with the function @link #extractLangStringTranslation
  2. Extract a LangString with the function @link #extractPossibleLangString or @link #extractKnownLangString
  3. Extract a set of LangStrings with the function @link #extractLangStrings

Version:
$Revision: $
Author:
Matthias Palmer

Method Summary
static String excavateValue(org.w3c.rdf.model.RDFNode node, org.w3c.rdf.model.Model model, int counter)
          This function excavates the value of a resource via a traversion of possible several resources linked together via the rdf:value property until a literal is found.
It can be thought of as a part of the dumbdown algorithm as defined by Dublin Core.
static MetaData.LangStringType extractKnownLangString(org.w3c.rdf.model.Resource langstring, org.w3c.rdf.model.Model model)
          Extracs original string with possibly one or several translations.
static MetaData.LangStringType[] extractLangStrings(org.w3c.rdf.model.Model langstrings, org.w3c.rdf.model.Model model)
           
static MetaData.LangString extractLangStringTranslation(org.w3c.rdf.model.Model translationModel, org.w3c.rdf.model.Model model)
           
static MetaData.LangStringType extractPossibleLangString(org.w3c.rdf.model.RDFNode node, org.w3c.rdf.model.Model model)
          Extracts a LangString if there is any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

extractLangStrings

public static MetaData.LangStringType[] extractLangStrings(org.w3c.rdf.model.Model langstrings,
                                                           org.w3c.rdf.model.Model model)
                                                    throws org.w3c.rdf.model.ModelException

extractPossibleLangString

public static MetaData.LangStringType extractPossibleLangString(org.w3c.rdf.model.RDFNode node,
                                                                org.w3c.rdf.model.Model model)
                                                         throws org.w3c.rdf.model.ModelException
Extracts a LangString if there is any. The alternatives are:
  1. It's a LangString resource, extract via @link #extractKnownLangString.
  2. It's another resource, a value is excavated via the @link #dumbDownTranslation algorithm.
  3. It's a literal, A LangString is constructed with only one translation with language set to null.
See Also:
#dumbDownTranslation, extractKnownLangString(org.w3c.rdf.model.Resource, org.w3c.rdf.model.Model)

extractKnownLangString

public static MetaData.LangStringType extractKnownLangString(org.w3c.rdf.model.Resource langstring,
                                                             org.w3c.rdf.model.Model model)
                                                      throws org.w3c.rdf.model.ModelException
Extracs original string with possibly one or several translations. A LangString consists of an array of translations where each translation is a string and a language.
The original String appears first in the array of translations.
Returns:
MetaData.LangStringType i.e just an class wrapped around an array of translations what LOM defines as a langstring or null if no string where found.
See Also:
extractLangStringTranslation(org.w3c.rdf.model.Model, org.w3c.rdf.model.Model)

extractLangStringTranslation

public static MetaData.LangString extractLangStringTranslation(org.w3c.rdf.model.Model translationModel,
                                                               org.w3c.rdf.model.Model model)
                                                        throws org.w3c.rdf.model.ModelException

excavateValue

public static String excavateValue(org.w3c.rdf.model.RDFNode node,
                                   org.w3c.rdf.model.Model model,
                                   int counter)
                            throws org.w3c.rdf.model.ModelException
This function excavates the value of a resource via a traversion of possible several resources linked together via the rdf:value property until a literal is found.
It can be thought of as a part of the dumbdown algorithm as defined by Dublin Core.
Parameters:
node - the starting point, can be a literal (done) or a resource search value for.
model - the model to search statements in.
count - the maximum number of traversions to be done before the algorithm aborts (avoids loops)
Returns:
String null if no value was found.

IMSEVimse 1.0
Draft

Centre for user-oriented IT -design