Package net.ontopia.topicmaps.utils.rdf
Class RDFTopicMapWriter
- java.lang.Object
-
- net.ontopia.topicmaps.utils.rdf.RDFTopicMapWriter
-
- All Implemented Interfaces:
TopicMapWriterIF
public class RDFTopicMapWriter extends Object implements TopicMapWriterIF
PUBLIC: A topic map writer that can convert topic maps to RDF. The conversion may result in an RDF event stream, an RDF model, or RDF serialized into the RDF/XML format.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description protected Predicate
filter
protected org.apache.jena.rdfxml.xmlinput.StatementHandler
handler
protected org.apache.jena.rdf.model.Model
model
protected Map
namepreds
protected Map
preferred_roles
protected boolean
preserve_reification
protected boolean
preserve_scope
static String
PROPERTY_FILTER
static String
PROPERTY_PRESERVE_REIFICATION
static String
PROPERTY_PRESERVE_SCOPE
protected Writer
writer
-
Constructor Summary
Constructors Constructor Description RDFTopicMapWriter(OutputStream stream)
PUBLIC: Creates a writer that writes the RDF representation to the given OutputStream serialized to RDF/XML and using the UTF-8 character encoding.RDFTopicMapWriter(OutputStream stream, String encoding)
PUBLIC: Creates a writer that writes the RDF representation to the given OutputStream serialized to RDF/XML and using the given character encoding.RDFTopicMapWriter(Writer writer)
PUBLIC: Creates a writer that writes the RDF representation to the given OutputStream serialized to RDF/XML.RDFTopicMapWriter(org.apache.jena.rdf.model.Model model)
PUBLIC: Creates a writer that builds an RDF representation of the topic map in the given Jena RDF model.RDFTopicMapWriter(org.apache.jena.rdfxml.xmlinput.StatementHandler handler)
PUBLIC: Creates a writer that writes the RDF representation to the given StatementHandler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getPreserveReification()
PUBLIC: Returns true if the writer will use RDF reification to preserve reification in the topic map.boolean
getPreserveScope()
PUBLIC: Returns true if the writer will use RDF reification to preserve the scopes in the topic map.void
setAdditionalProperties(Map<String,Object> properties)
Sets additional properties for the RDFTopicMapWriter.void
setFilter(Predicate filter)
PUBLIC: Sets the filter that decides which topic map constructs are accepted and exported.void
setPreserveReification(boolean preserve_reification)
PUBLIC: Controls whether the writer will use RDF reification to preserve reification in the topic map.void
setPreserveScope(boolean preserve_scope)
PUBLIC: Controls whether the writer will use RDF reification to preserve the scopes in the topic map.protected void
setup(TopicMapIF topicmap)
protected void
write(AssociationIF assoc)
protected void
write(TopicIF topic)
void
write(TopicMapIF topicmap)
PUBLIC: Writes the given topic map to an implicit implementation dependent destination.
-
-
-
Field Detail
-
PROPERTY_PRESERVE_REIFICATION
public static final String PROPERTY_PRESERVE_REIFICATION
- See Also:
- Constant Field Values
-
PROPERTY_PRESERVE_SCOPE
public static final String PROPERTY_PRESERVE_SCOPE
- See Also:
- Constant Field Values
-
PROPERTY_FILTER
public static final String PROPERTY_FILTER
- See Also:
- Constant Field Values
-
handler
protected org.apache.jena.rdfxml.xmlinput.StatementHandler handler
-
model
protected org.apache.jena.rdf.model.Model model
-
writer
protected Writer writer
-
namepreds
protected Map namepreds
-
preferred_roles
protected Map preferred_roles
-
preserve_scope
protected boolean preserve_scope
-
preserve_reification
protected boolean preserve_reification
-
filter
protected Predicate filter
-
-
Constructor Detail
-
RDFTopicMapWriter
public RDFTopicMapWriter(org.apache.jena.rdfxml.xmlinput.StatementHandler handler)
PUBLIC: Creates a writer that writes the RDF representation to the given StatementHandler.
-
RDFTopicMapWriter
public RDFTopicMapWriter(OutputStream stream) throws IOException
PUBLIC: Creates a writer that writes the RDF representation to the given OutputStream serialized to RDF/XML and using the UTF-8 character encoding.- Throws:
IOException
-
RDFTopicMapWriter
public RDFTopicMapWriter(OutputStream stream, String encoding) throws IOException
PUBLIC: Creates a writer that writes the RDF representation to the given OutputStream serialized to RDF/XML and using the given character encoding.- Throws:
IOException
- Since:
- 5.1.3
-
RDFTopicMapWriter
public RDFTopicMapWriter(Writer writer)
PUBLIC: Creates a writer that writes the RDF representation to the given OutputStream serialized to RDF/XML.
-
RDFTopicMapWriter
public RDFTopicMapWriter(org.apache.jena.rdf.model.Model model)
PUBLIC: Creates a writer that builds an RDF representation of the topic map in the given Jena RDF model.
-
-
Method Detail
-
setPreserveScope
public void setPreserveScope(boolean preserve_scope)
PUBLIC: Controls whether the writer will use RDF reification to preserve the scopes in the topic map.
-
getPreserveScope
public boolean getPreserveScope()
PUBLIC: Returns true if the writer will use RDF reification to preserve the scopes in the topic map.
-
setPreserveReification
public void setPreserveReification(boolean preserve_reification)
PUBLIC: Controls whether the writer will use RDF reification to preserve reification in the topic map.
-
getPreserveReification
public boolean getPreserveReification()
PUBLIC: Returns true if the writer will use RDF reification to preserve reification in the topic map.
-
setFilter
public void setFilter(Predicate filter)
PUBLIC: Sets the filter that decides which topic map constructs are accepted and exported. Uses 'filter' to identify individual topic constructs as allowed or disallowed. TM constructs that depend on the disallowed topics are also disallowed.- Parameters:
filter
- Places constraints on individual topicmap constructs.
-
write
public void write(TopicMapIF topicmap)
Description copied from interface:TopicMapWriterIF
PUBLIC: Writes the given topic map to an implicit implementation dependent destination. The write method will close any resources opened internally. This means that the write method can only be called once if the stream/writer was opened internally.- Specified by:
write
in interfaceTopicMapWriterIF
- Parameters:
topicmap
- The topic map to be exported/written; an object implementing TopicMapIF
-
write
protected void write(TopicIF topic)
-
write
protected void write(AssociationIF assoc)
-
setup
protected void setup(TopicMapIF topicmap)
-
setAdditionalProperties
public void setAdditionalProperties(Map<String,Object> properties)
Sets additional properties for the RDFTopicMapWriter. Accepted properties:- 'preserveReification' (Boolean), corresponds to
setPreserveReification(boolean)
- 'preserveScope' (Boolean), corresponds to
setPreserveScope(boolean)
- 'filter' (DeciderIF), corresponds to
#setFilter(net.ontopia.utils.DeciderIF)
- Specified by:
setAdditionalProperties
in interfaceTopicMapWriterIF
- Parameters:
properties
-
- 'preserveReification' (Boolean), corresponds to
-
-