org.restlet.ext.rdf
Class RdfRepresentation

java.lang.Object
  extended by org.restlet.representation.Variant
      extended by org.restlet.representation.RepresentationInfo
          extended by org.restlet.representation.Representation
              extended by org.restlet.representation.CharacterRepresentation
                  extended by org.restlet.representation.WriterRepresentation
                      extended by org.restlet.ext.rdf.RdfRepresentation

public class RdfRepresentation
extends WriterRepresentation

Generic RDF representation. Provides support for the Resource Description Framework (RDF) Semantic Web standard. It supports major RDF serialization formats (n3, Turtle, N-Triples and RDF/XML) and is able to both serialize and deserialize a Graph.

Author:
Jerome Louvel

Field Summary
 
Fields inherited from class org.restlet.representation.Representation
UNKNOWN_SIZE
 
Constructor Summary
RdfRepresentation()
          Constructor.
RdfRepresentation(Graph linkSet, MediaType mediaType)
          Constructor with argument.
RdfRepresentation(MediaType mediaType)
          Constructor with argument.
RdfRepresentation(Representation rdfRepresentation)
          Constructor that parsed a given RDF representation into a link set.
 
Method Summary
 GraphHandler createBuilder(Graph graph)
          Returns an instance of a graph handler used when parsing the inner RDF representation.
 GraphHandler createWriter(MediaType mediaType, Writer writer)
          Returns an instance of a graph handler used when writing the inner set of links.
 Graph getGraph()
          Returns the graph of links.
 void parse(GraphHandler graphHandler)
          Parses the inner RDF representation.
 void setGraph(Graph linkSet)
          Sets the graph of links.
 void write(GraphHandler graphHandler)
          Writes the
 void write(Writer writer)
           
 
Methods inherited from class org.restlet.representation.WriterRepresentation
getReader
 
Methods inherited from class org.restlet.representation.CharacterRepresentation
getChannel, getStream, write, write
 
Methods inherited from class org.restlet.representation.Representation
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient
 
Methods inherited from class org.restlet.representation.RepresentationInfo
getModificationDate, getTag, setModificationDate, setTag
 
Methods inherited from class org.restlet.representation.Variant
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RdfRepresentation

public RdfRepresentation()
Constructor.


RdfRepresentation

public RdfRepresentation(Graph linkSet,
                         MediaType mediaType)
Constructor with argument.

Parameters:
linkSet - The graph of links.
mediaType - The representation's mediaType.

RdfRepresentation

public RdfRepresentation(MediaType mediaType)
Constructor with argument.

Parameters:
mediaType - The representation's mediaType.

RdfRepresentation

public RdfRepresentation(Representation rdfRepresentation)
                  throws IOException
Constructor that parsed a given RDF representation into a link set.

Parameters:
rdfRepresentation - The RDF representation to parse.
Throws:
IOException
Method Detail

createBuilder

public GraphHandler createBuilder(Graph graph)
Returns an instance of a graph handler used when parsing the inner RDF representation.

Parameters:
graph - The graph to build.
Returns:
An instance of a graph handler used when parsing the inner RDF representation.

createWriter

public GraphHandler createWriter(MediaType mediaType,
                                 Writer writer)
                          throws IOException
Returns an instance of a graph handler used when writing the inner set of links.

Parameters:
mediaType - The given media type of the parsed RDF representation.
writer - The character writer to write to.
Returns:
An instance of a graph handler used when writing the inner set of links.
Throws:
IOException

getGraph

public Graph getGraph()
               throws IOException
Returns the graph of links.

Returns:
The graph of links.
Throws:
IOException

parse

public void parse(GraphHandler graphHandler)
           throws IOException
Parses the inner RDF representation. The given graph handler is invoked each time a link is detected.

Parameters:
graphHandler - The graph handler.
Throws:
IOException

setGraph

public void setGraph(Graph linkSet)
Sets the graph of links.

Parameters:
linkSet - The graph of links.

write

public void write(GraphHandler graphHandler)
           throws IOException
Writes the

Parameters:
graphHandler -
Throws:
IOException

write

public void write(Writer writer)
           throws IOException
Specified by:
write in class Representation
Throws:
IOException


Copyright © 2005-2013 Restlet.