Salt  3.4.2
A powerful, tagset-independent and theory-neutral meta model and API for storing, manipulating, and representing nearly all types of linguistic data .
org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer Class Reference

Inherits org.corpus_tools.salt.util.internal.persistence.SaltXML10Dictionary.

Public Member Functions

 SaltXML10Writer (File path)
 
 SaltXML10Writer (URI path)
 
void setPrettyPrint (boolean isPrettyPrint)
 Determines whether the outputted SaltXML should be pretty printed. More...
 
File getPath ()
 
void writeObjects (XMLStreamWriter xml, Object... objects)
 Write a number of root objects (objects without a container) to XML. More...
 
void writeSaltProject (SaltProject project)
 Writes a Salt project to the file given by getPath(). More...
 
void writeSaltProject (XMLStreamWriter xml, SaltProject project)
 Writes a salt project to the xml stream. More...
 
void writeCorpusGraph (XMLStreamWriter xml, SCorpusGraph graph, boolean embedded)
 Writes a corpus graph to the xml stream. More...
 
void writeDocumentGraph (SDocumentGraph graph)
 Writes a document graph to the file given by getPath(). More...
 
void writeDocumentGraph (XMLStreamWriter xml, SDocumentGraph graph)
 Writes a document graph to the xml stream. More...
 
void writeLabel (XMLStreamWriter xml, Label label) throws XMLStreamException
 Writes the passed label object to the passed XMLStreamWriter. More...
 
String marshallValue (Object value)
 Serializes an object as String. More...
 
void writeNode (XMLStreamWriter xml, Node node, Map<? extends Layer, Integer > layerPositions) throws XMLStreamException
 Writes the passed node object to the passed XMLStreamWriter. More...
 
void writeRelation (XMLStreamWriter xml, Relation relation, Map<? extends Node, Integer > nodePositions, Map<? extends Layer, Integer > layerPositions) throws XMLStreamException
 Writes the passed relation object to the passed XMLStreamWriter. More...
 
void writeLayer (XMLStreamWriter xml, Layer layer, Map< SNode, Integer > nodePositions, Map< SRelation< SNode, SNode >, Integer > relPositions) throws XMLStreamException
 Writes the passed relation object to the passed XMLStreamWriter. More...
 
void writeXMIRootElement (XMLStreamWriter xml) throws XMLStreamException
 Writes an Salt XMI header to the XMLStreamWriter. More...
 

Additional Inherited Members

- Static Public Attributes inherited from org.corpus_tools.salt.util.internal.persistence.SaltXML10Dictionary
static final String NS_SALTCORE = "saltCore"
 constant to address the xml-namespace prefix'saltCore'.
 
static final String NS_VALUE_SALTCORE = "saltCore"
 constant to address the xml-namespace 'saltCore'.
 
static final String NS_SALTCOMMON = "saltCommon"
 constant to address the xml-namespace prefix'saltCommon'.
 
static final String NS_VALUE_SALTCOMMON = "saltCommon"
 constant to address the xml-namespace 'saltCommon'.
 
static final String NS_SDOCUMENTSTRUCTURE = "sDocumentStructure"
 constant to address the xml-namespace prefix'sDocumentStructure'.
 
static final String NS_VALUE_SDOCUMENTSTRUCTURE = "sDocumentStructure"
 constant to address the xml-namespace 'sDocumentStructure'.
 
static final String NS_SCORPUSSTRUCTURE = "sCorpusStructure"
 constant to address the xml-namespace prefix'sCorpusStructure'.
 
static final String NS_VALUE_SCORPUSSTRUCTURE = "sCorpusStructure"
 constant to address the xml-namespace 'sCorpusStructure'.
 
static final String NS_XMI = "xmi"
 constant to address the xml-namespace prefix'xmi'.
 
static final String NS_VALUE_XMI = "http://www.omg.org/XMI"
 constant to address the xml-namespace 'http://www.omg.org/XMI'.
 
static final String NS_XSI = "xsi"
 constant to address the xml-namespace prefix'xsi'.
 
static final String NS_VALUE_XSI = "http://www.w3.org/2001/XMLSchema-instance"
 constant to address the xml-namespace 'http://www.w3.org/2001/XMLSchema-instance'.
 
static final String TAG_EDGES = "edges"
 constant to address the xml-element 'edges'.
 
static final String TAG_NODES = "nodes"
 constant to address the xml-element 'nodes'.
 
static final String TAG_SDOCUMENTSTRUCTURE_SDOCUMENTGRAPH = "SDocumentGraph"
 constant to address the xml-element 'sDocumentStructure:SDocumentGraph'.
 
static final String TAG_LAYERS = "layers"
 constant to address the xml-element 'layers'.
 
static final String TAG_LABELS = "labels"
 constant to address the xml-element 'labels'.
 
static final String TAG_SDOCUMENT = "sDocument"
 constant to address the xml-element 'sDocument'.
 
static final String TAG_SALT_PROJECT = "SaltProject"
 constant to address the xml-element 'SaltProject'.
 
static final String ATT_EDGES = "edges"
 constant to address the xml-attribute 'edges'.
 
static final String ATT_SOURCE = "source"
 constant to address the xml-attribute 'source'.
 
static final String ATT_NODES = "nodes"
 constant to address the xml-attribute 'nodes'.
 
static final String ATT_LAYERS = "layers"
 constant to address the xml-attribute 'layers'.
 
static final String ATT_NAME = "name"
 constant to address the xml-attribute 'name'.
 
static final String ATT_TARGET = "target"
 constant to address the xml-attribute 'target'.
 
static final String ATT_VALUE = "value"
 constant to address the xml-attribute 'value'.
 
static final String ATT_XSI_TYPE = "type"
 constant to address the xml-attribute 'xsi:type'.
 
static final String ATT_HREF = "href"
 constant to address the xml-attribute 'href'.
 
static final String ATT_NAMESPACE = "namespace"
 constant to address the xml-attribute 'namespace'.
 
static final String ATT_XMI_VERSION = "version"
 constant to address the xml-attribute 'xmi:version'.
 
static final String ATT_TYPE = "xsi:type"
 
static final String ATT_VALUE_STRING = "valueString"
 
static final String TYPE_SFEATURE = "saltCore:SFeature"
 
static final String TYPE_SELEMENTID = "saltCore:SElementId"
 
static final String TYPE_SANNOTATION = "saltCore:SAnnotation"
 
static final String TYPE_SMETAANNOTATION = "saltCore:SMetaAnnotation"
 
static final String TYPE_SPROCESSINGANNOTATION = "saltCore:SProcessingAnnotation"
 
static final String TAG_SDOCUMENT_GRAPH = "sDocumentStructure:SDocumentGraph"
 
static final String TAG_SALT_PROJECT_FULL = "saltCommon:SaltProject"
 
static final String TAG_SCORPUS_GRAPH = "sCorpusGraphs"
 
static final String ATT_SNAME = "sName"
 
static final String TYPE_SCORPUS = "sCorpusStructure:SCorpus"
 
static final String TYPE_SDOCUMENT = "sCorpusStructure:SDocument"
 
static final String TYPE_SCORPUS_DOCUMENT_RELATION = "sCorpusStructure:SCorpusDocumentRelation"
 
static final String TYPE_SCORPUS_RELATION = "sCorpusStructure:SCorpusRelation"
 
static final String TYPE_STIMELINE = "sDocumentStructure:STimeline"
 
static final String TYPE_SAUDIODS = "sDocumentStructure:SAudioDS"
 
static final String TYPE_STEXTUALDS = "sDocumentStructure:STextualDS"
 
static final String TYPE_STOKEN = "sDocumentStructure:SToken"
 
static final String TYPE_SSPAN = "sDocumentStructure:SSpan"
 
static final String TYPE_SSTRUCTURE = "sDocumentStructure:SStructure"
 
static final String TYPE_STEXTUAL_RELATION = "sDocumentStructure:STextualRelation"
 
static final String TYPE_SAUDIO_RELATION = "sDocumentStructure:SAudioRelation"
 
static final String TYPE_STIMELINE_RELATION = "sDocumentStructure:STimelineRelation"
 
static final String TYPE_SSPANNING_RELATION = "sDocumentStructure:SSpanningRelation"
 
static final String TYPE_SORDER_RELATION = "sDocumentStructure:SOrderRelation"
 
static final String TYPE_SDOMINANCE_RELATION = "sDocumentStructure:SDominanceRelation"
 
static final String TYPE_SPOINTING_RELATION = "sDocumentStructure:SPointingRelation"
 
static final String TYPE_SPOS = "saltSemantics:SPOSAnnotation"
 
static final String TYPE_SLEMMA = "saltSemantics:SLemmaAnnotation"
 
static final String TYPE_SCAT = "saltSemantics:SCatAnnotation"
 
static final String TYPE_SSENTENCE = "saltSemantics:SentenceAnnotation"
 
static final String TYPE_SWORD = "saltSemantics:SWordAnnotation"
 
static final String TYPE_STYPE = "saltSemantics:STypeAnnotation"
 

Member Function Documentation

◆ marshallValue()

String org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.marshallValue ( Object  value)

Serializes an object as String.

If the passed object is

  • String - it is prefixed with "T::"
  • Boolean - it is prefixed with "B::"
  • Integer - it is prefixed with "N::"
  • Integer - it is prefixed with "L::"
  • Float - it is prefixed with "F::"
  • URI - it is prefixed with "U::"
Parameters
value
Returns

◆ setPrettyPrint()

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.setPrettyPrint ( boolean  isPrettyPrint)

Determines whether the outputted SaltXML should be pretty printed.

Parameters
isPrettyPrinttrue when output needs to be pretty printed

◆ writeCorpusGraph()

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.writeCorpusGraph ( XMLStreamWriter  xml,
SCorpusGraph  graph,
boolean  embedded 
)

Writes a corpus graph to the xml stream.

Parameters
graphthe corpus graph to be written
embeddeddetermines whether this corpus graph is part of a saltProject
xmlxml stream to write corpus graph to, if the passed one is null, a new one will be created

◆ writeDocumentGraph() [1/2]

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.writeDocumentGraph ( SDocumentGraph  graph)

Writes a document graph to the file given by getPath().

Parameters
graph

◆ writeDocumentGraph() [2/2]

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.writeDocumentGraph ( XMLStreamWriter  xml,
SDocumentGraph  graph 
)

Writes a document graph to the xml stream.

Parameters
xmlA pre-configured XMLStreamWriter
graph

◆ writeLabel()

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.writeLabel ( XMLStreamWriter  xml,
Label  label 
) throws XMLStreamException

Writes the passed label object to the passed XMLStreamWriter.

Parameters
labelto be persist
xmlstream to write data to
Exceptions
XMLStreamException

◆ writeLayer()

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.writeLayer ( XMLStreamWriter  xml,
Layer  layer,
Map< SNode, Integer >  nodePositions,
Map< SRelation< SNode, SNode >, Integer >  relPositions 
) throws XMLStreamException

Writes the passed relation object to the passed XMLStreamWriter.

Parameters
layer
xmlstream to write data to
nodePositionsa map containing all positions of a single node in the list of nodes
relPositionsa map containing all positions of a single relation in the list of relations
Exceptions
XMLStreamException

◆ writeNode()

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.writeNode ( XMLStreamWriter  xml,
Node  node,
Map<? extends Layer, Integer >  layerPositions 
) throws XMLStreamException

Writes the passed node object to the passed XMLStreamWriter.

Parameters
nodeto be persist
xmlstream to write data to
layerPositions
Exceptions
XMLStreamException

◆ writeObjects()

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.writeObjects ( XMLStreamWriter  xml,
Object...  objects 
)

Write a number of root objects (objects without a container) to XML.

Parameters
xml
objectsList of objects of type SaltProject, SDocumentGraph or SCorpusGraph

◆ writeRelation()

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.writeRelation ( XMLStreamWriter  xml,
Relation  relation,
Map<? extends Node, Integer >  nodePositions,
Map<? extends Layer, Integer >  layerPositions 
) throws XMLStreamException

Writes the passed relation object to the passed XMLStreamWriter.

Parameters
relationto be persist
xmlstream to write data to
nodePositionsa map containing all positions of nodes in the list of nodes
layerPositions
Exceptions
XMLStreamException

◆ writeSaltProject() [1/2]

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.writeSaltProject ( SaltProject  project)

Writes a Salt project to the file given by getPath().

Parameters
projectthe Salt project to be written

◆ writeSaltProject() [2/2]

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.writeSaltProject ( XMLStreamWriter  xml,
SaltProject  project 
)

Writes a salt project to the xml stream.

Parameters
xmlA pre-configured XMLStreamWriter
project

◆ writeXMIRootElement()

void org.corpus_tools.salt.util.internal.persistence.SaltXML10Writer.writeXMIRootElement ( XMLStreamWriter  xml) throws XMLStreamException

Writes an Salt XMI header to the XMLStreamWriter.

Salt XMI has a certain header structure (including the namespaces). This helper function writes this header to an existing XMLStreamWriter.

Parameters
xml
Exceptions
XMLStreamException