com.hp.hpl.jena.daml.common
Interface DatatypeTranslator


public interface DatatypeTranslator

Interface that defines the service of serialising and deserialising a Java object representing a datatype to its XML Schema representation.

Version:
CVS info: $Id: DatatypeTranslator.java,v 1.1 2001/09/24 17:02:43 ijd Exp $
Author:
Ian Dickinson, HP Labs (email)

Method Summary
 java.lang.Object deserialize(RDFNode node)
          Given an RDF node (resource or literal), return the Java value that the node value encodes.
 RDFNode serialize(java.lang.Object value, DAMLModel model)
          Given a value and a model, answer an rdf node that encapsulates the value.
 

Method Detail

deserialize

public java.lang.Object deserialize(RDFNode node)
Given an RDF node (resource or literal), return the Java value that the node value encodes. E.g. if a node has a value of '125' and a type of xsd:integer return the corresponding integer. Note that due to Java's limitations of there being no general return type that includes the scalars, scalar values will be returned as the corresponding object type (e.g. Integer instead of int).
Parameters:
node - The RDF node that represents the encoded value
Returns:
the corresponding Java object.

serialize

public RDFNode serialize(java.lang.Object value,
                         DAMLModel model)
Given a value and a model, answer an rdf node that encapsulates the value. This may include arbitrary side-effects on the model, such as adding a type statement for the resource.
Parameters:
value - The Java value to be serialised
model - The RDF model to which the value will be serialised
Returns:
the RDF node representing value.


Copyright © 2001 Hewlett-Packard. All Rights Reserved.