Package org.restlet.ext.rdf
Class RdfRepresentation
- java.lang.Object
-
- org.restlet.representation.Variant
-
- org.restlet.representation.RepresentationInfo
-
- org.restlet.representation.Representation
-
- org.restlet.representation.CharacterRepresentation
-
- org.restlet.representation.WriterRepresentation
-
- org.restlet.ext.rdf.RdfRepresentation
-
public class RdfRepresentation extends org.restlet.representation.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 aGraph
.- Author:
- Jerome Louvel
-
-
Constructor Summary
Constructors Constructor Description RdfRepresentation()
Constructor.RdfRepresentation(org.restlet.data.MediaType mediaType)
Constructor with argument.RdfRepresentation(Graph linkSet, org.restlet.data.MediaType mediaType)
Constructor with argument.RdfRepresentation(org.restlet.representation.Representation rdfRepresentation)
Constructor that parsed a given RDF representation into a link set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GraphHandler
createBuilder(Graph graph)
Returns an instance of a graph handler used when parsing the inner RDF representation.GraphHandler
createWriter(org.restlet.data.MediaType mediaType, java.io.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(java.io.Writer writer)
void
write(GraphHandler graphHandler)
Writes the-
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
-
-
-
-
Constructor Detail
-
RdfRepresentation
public RdfRepresentation()
Constructor.
-
RdfRepresentation
public RdfRepresentation(Graph linkSet, org.restlet.data.MediaType mediaType)
Constructor with argument.- Parameters:
linkSet
- The graph of links.mediaType
- The representation's mediaType.
-
RdfRepresentation
public RdfRepresentation(org.restlet.data.MediaType mediaType)
Constructor with argument.- Parameters:
mediaType
- The representation's mediaType.
-
RdfRepresentation
public RdfRepresentation(org.restlet.representation.Representation rdfRepresentation) throws java.io.IOException
Constructor that parsed a given RDF representation into a link set.- Parameters:
rdfRepresentation
- The RDF representation to parse.- Throws:
java.io.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(org.restlet.data.MediaType mediaType, java.io.Writer writer) throws java.io.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:
java.io.IOException
-
getGraph
public Graph getGraph() throws java.io.IOException
Returns the graph of links.- Returns:
- The graph of links.
- Throws:
java.io.IOException
-
parse
public void parse(GraphHandler graphHandler) throws java.io.IOException
Parses the inner RDF representation. The given graph handler is invoked each time a link is detected.- Parameters:
graphHandler
- The graph handler.- Throws:
java.io.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 java.io.IOException
Writes the- Parameters:
graphHandler
-- Throws:
java.io.IOException
-
write
public void write(java.io.Writer writer) throws java.io.IOException
- Specified by:
write
in classorg.restlet.representation.Representation
- Throws:
java.io.IOException
-
-