Skip to content

Commit

Permalink
SaltXML starts to count at 0
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaskrause committed Aug 15, 2024
1 parent 59fd49b commit 3c9f1a8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/exporter/saltxml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ where
layer: Option<String>,
) -> Result<()> {
// Remember the position of this node in the XML file
let node_position = self.node_positions.len() + 1;
let node_position = self.node_positions.len();
self.node_positions.insert(n.clone(), node_position);

let mut attributes: Vec<(String, String)> = Vec::new();
Expand Down Expand Up @@ -359,8 +359,6 @@ where
output_features: &[Annotation],
layer: Option<String>,
) -> Result<()> {
self.number_of_edges += 1;

let mut attributes = Vec::new();
attributes.push((parse_attr_name("xsi:type")?, salt_type.to_string()));

Expand Down Expand Up @@ -419,6 +417,8 @@ where
self.xml.write_event(Event::End(edges_tag.to_end()))?;
}

self.number_of_edges += 1;

Ok(())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ expression: result
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SNAME" value="doc2"/>
<labels xsi:type="saltCore:SMetaAnnotation" namespace="test" name="description" value="T::Another demo corpus"/>
</nodes>
<edges xsi:type="sCorpusStructure:SCorpusDocumentRelation" source="//@nodes.1" target="//@nodes.2" layer="//@layers.1"/>
<edges xsi:type="sCorpusStructure:SCorpusDocumentRelation" source="//@nodes.1" target="//@nodes.3" layer="//@layers.1"/>
<layers xsi:type="saltCore:SLayer" edges="//@edges.1 //@edges.2">
<edges xsi:type="sCorpusStructure:SCorpusDocumentRelation" source="//@nodes.0" target="//@nodes.1" layer="//@layers.1"/>
<edges xsi:type="sCorpusStructure:SCorpusDocumentRelation" source="//@nodes.0" target="//@nodes.2" layer="//@layers.1"/>
<layers xsi:type="saltCore:SLayer" edges="//@edges.0 //@edges.1">
<labels xsi:type="saltCore:SElementId" namespace="salt" name="id" value="T::l1"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SNAME" value="T::annis"/>
</layers>
<layers xsi:type="saltCore:SLayer" nodes="//@nodes.2 //@nodes.3">
<layers xsi:type="saltCore:SLayer" nodes="//@nodes.1 //@nodes.2">
<labels xsi:type="saltCore:SElementId" namespace="salt" name="id" value="T::l2"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SNAME" value="T::test-layer"/>
</layers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ expression: result
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SNAME" value="span1"/>
<labels xsi:type="saltCore:SAnnotation" namespace="default_ns" name="phrase" value="T::this example"/>
</nodes>
<edges xsi:type="sDocumentStructure:SOrderRelation" source="//@nodes.0" target="//@nodes.1" layer="//@layers.1"/>
<edges xsi:type="sDocumentStructure:SOrderRelation" source="//@nodes.1" target="//@nodes.2" layer="//@layers.1"/>
<edges xsi:type="sDocumentStructure:SOrderRelation" source="//@nodes.2" target="//@nodes.3" layer="//@layers.1"/>
<edges xsi:type="sDocumentStructure:SOrderRelation" source="//@nodes.3" target="//@nodes.4" layer="//@layers.1"/>
Expand All @@ -63,63 +64,62 @@ expression: result
<edges xsi:type="sDocumentStructure:SOrderRelation" source="//@nodes.7" target="//@nodes.8" layer="//@layers.1"/>
<edges xsi:type="sDocumentStructure:SOrderRelation" source="//@nodes.8" target="//@nodes.9" layer="//@layers.1"/>
<edges xsi:type="sDocumentStructure:SOrderRelation" source="//@nodes.9" target="//@nodes.10" layer="//@layers.1"/>
<edges xsi:type="sDocumentStructure:SOrderRelation" source="//@nodes.10" target="//@nodes.11" layer="//@layers.1"/>
<edges xsi:type="sDocumentStructure:SSpanningRelation" source="//@nodes.12" target="//@nodes.2"/>
<edges xsi:type="sDocumentStructure:SSpanningRelation" source="//@nodes.12" target="//@nodes.3"/>
<edges xsi:type="sDocumentStructure:SSpanningRelation" source="//@nodes.11" target="//@nodes.1"/>
<edges xsi:type="sDocumentStructure:SSpanningRelation" source="//@nodes.11" target="//@nodes.2"/>
<nodes xsi:type="sDocumentStructure:STextualDS">
<labels xsi:type="saltCore:SElementId" namespace="salt" name="id" value="T::salt:/root/doc1#sText1"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SNAME" value="sText1"/>
<labels xsi:type="saltCore:SFeature" namespace="saltCommon" name="SDATA" value="T::Is this example more complicated than it appears to be?"/>
</nodes>
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.1" target="//@nodes.13">
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.0" target="//@nodes.12">
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SSTART" value="T::0"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SEND" value="T::2"/>
</edges>
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.2" target="//@nodes.13">
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.1" target="//@nodes.12">
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SSTART" value="T::3"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SEND" value="T::7"/>
</edges>
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.3" target="//@nodes.13">
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.2" target="//@nodes.12">
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SSTART" value="T::8"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SEND" value="T::15"/>
</edges>
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.4" target="//@nodes.13">
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.3" target="//@nodes.12">
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SSTART" value="T::16"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SEND" value="T::20"/>
</edges>
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.5" target="//@nodes.13">
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.4" target="//@nodes.12">
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SSTART" value="T::21"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SEND" value="T::32"/>
</edges>
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.6" target="//@nodes.13">
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.5" target="//@nodes.12">
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SSTART" value="T::33"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SEND" value="T::37"/>
</edges>
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.7" target="//@nodes.13">
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.6" target="//@nodes.12">
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SSTART" value="T::38"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SEND" value="T::40"/>
</edges>
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.8" target="//@nodes.13">
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.7" target="//@nodes.12">
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SSTART" value="T::41"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SEND" value="T::48"/>
</edges>
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.9" target="//@nodes.13">
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.8" target="//@nodes.12">
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SSTART" value="T::49"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SEND" value="T::51"/>
</edges>
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.10" target="//@nodes.13">
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.9" target="//@nodes.12">
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SSTART" value="T::52"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SEND" value="T::54"/>
</edges>
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.11" target="//@nodes.13">
<edges xsi:type="sDocumentStructure:STextualRelation" source="//@nodes.10" target="//@nodes.12">
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SSTART" value="T::54"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SEND" value="T::55"/>
</edges>
<layers xsi:type="saltCore:SLayer" edges="//@edges.1 //@edges.2 //@edges.3 //@edges.4 //@edges.5 //@edges.6 //@edges.7 //@edges.8 //@edges.9 //@edges.10">
<layers xsi:type="saltCore:SLayer" edges="//@edges.0 //@edges.1 //@edges.2 //@edges.3 //@edges.4 //@edges.5 //@edges.6 //@edges.7 //@edges.8 //@edges.9">
<labels xsi:type="saltCore:SElementId" namespace="salt" name="id" value="T::l1"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SNAME" value="T::annis"/>
</layers>
<layers xsi:type="saltCore:SLayer" nodes="//@nodes.12">
<layers xsi:type="saltCore:SLayer" nodes="//@nodes.11">
<labels xsi:type="saltCore:SElementId" namespace="salt" name="id" value="T::l2"/>
<labels xsi:type="saltCore:SFeature" namespace="salt" name="SNAME" value="T::test-layer"/>
</layers>
Expand Down

0 comments on commit 3c9f1a8

Please sign in to comment.