Package org.restlet.ext.rdf.internal.xml
Class RdfXmlWriter
- java.lang.Object
-
- org.restlet.ext.rdf.GraphHandler
-
- org.restlet.ext.rdf.internal.xml.RdfXmlWriter
-
public class RdfXmlWriter extends GraphHandler
Handler of RDF content according to the RDF XML syntax.
-
-
Field Summary
Fields Modifier and Type Field Description private ReferencelastSourceThe last source reference written, to try to factor statements.private java.lang.StringRDF_SYNTAXURI of the RDF SYNTAX namespace.private XmlWriterwriterXML writer.
-
Constructor Summary
Constructors Constructor Description RdfXmlWriter(java.io.Writer writer)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidendGraph()Callback method used after the graph is parsed or written.private java.lang.StringgetNamespace(Reference reference)Returns the namespace of the given reference.private java.lang.StringgetPrefix(Reference ref)Returns the prefix of the qualified name representing the given reference.voidlink(Reference source, Reference typeRef, Reference target)Callback method used when a link is parsed or written.voidlink(Reference source, Reference typeRef, Literal target)Callback method used when a link is parsed or written.voidlink(Graph source, Reference typeRef, Reference target)Callback method used when a link is parsed or written.voidlink(Graph source, Reference typeRef, Literal target)Callback method used when a link is parsed or written.voidstartGraph()Callback method used before the graph is parsed or written.voidstartPrefixMapping(java.lang.String prefix, Reference reference)Callback method used at the start of a Namespace mapping.private voidwriteNode(Reference reference, boolean subject)Writes a subject or object node.-
Methods inherited from class org.restlet.ext.rdf.GraphHandler
endPrefixMapping
-
-
-
-
Method Detail
-
endGraph
public void endGraph() throws java.io.IOExceptionDescription copied from class:GraphHandlerCallback method used after the graph is parsed or written. Does nothing by default.- Overrides:
endGraphin classGraphHandler- Throws:
java.io.IOException
-
getNamespace
private java.lang.String getNamespace(Reference reference)
Returns the namespace of the given reference.- Parameters:
reference- the given reference.- Returns:
- The namespace of the given reference.
-
getPrefix
private java.lang.String getPrefix(Reference ref)
Returns the prefix of the qualified name representing the given reference.- Parameters:
ref- the given reference.- Returns:
- The prefix of the qualified name representing the given reference. Context .getCurrentLogger() .warning( "Cannot write the end of the graph" + e.getMessage());
-
link
public void link(Graph source, Reference typeRef, Literal target)
Description copied from class:GraphHandlerCallback method used when a link is parsed or written.- Specified by:
linkin classGraphHandler- Parameters:
source- The source or subject of the link.typeRef- The type reference of the link.target- The target or object of the link.
-
link
public void link(Graph source, Reference typeRef, Reference target)
Description copied from class:GraphHandlerCallback method used when a link is parsed or written.- Specified by:
linkin classGraphHandler- Parameters:
source- The source or subject of the link.typeRef- The type reference of the link.target- The target or object of the link.
-
link
public void link(Reference source, Reference typeRef, Literal target)
Description copied from class:GraphHandlerCallback method used when a link is parsed or written.- Specified by:
linkin classGraphHandler- Parameters:
source- The source or subject of the link.typeRef- The type reference of the link.target- The target or object of the link.
-
link
public void link(Reference source, Reference typeRef, Reference target)
Description copied from class:GraphHandlerCallback method used when a link is parsed or written.- Specified by:
linkin classGraphHandler- Parameters:
source- The source or subject of the link.typeRef- The type reference of the link.target- The target or object of the link.
-
startGraph
public void startGraph() throws java.io.IOExceptionDescription copied from class:GraphHandlerCallback method used before the graph is parsed or written. Does nothing by default.- Overrides:
startGraphin classGraphHandler- Throws:
java.io.IOException
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, Reference reference)Description copied from class:GraphHandlerCallback method used at the start of a Namespace mapping. Does nothing by default.- Overrides:
startPrefixMappingin classGraphHandler- Parameters:
prefix- The Namespace prefix being declared.reference- The Namespace URI mapped to the prefix.
-
writeNode
private void writeNode(Reference reference, boolean subject) throws org.xml.sax.SAXException
Writes a subject or object node.- Parameters:
ref- The reference of the subject or object node.subject- True if the node is the subject of a predicate- Throws:
org.xml.sax.SAXException
-
-