Skip to content
Snippets Groups Projects
Commit 388ff9b0 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

export of annotations added

parent 4fbcf273
No related branches found
No related tags found
1 merge request!186Resolve "upload of sbml"
......@@ -7,14 +7,13 @@ import java.util.Map;
import javax.xml.stream.XMLStreamException;
import org.apache.log4j.Logger;
import org.sbml.jsbml.ASTNode;
import org.sbml.jsbml.Model;
import org.sbml.jsbml.Species;
import org.sbml.jsbml.ext.layout.AbstractReferenceGlyph;
import org.sbml.jsbml.ext.layout.Layout;
import lcsb.mapviewer.common.XmlParser;
import lcsb.mapviewer.common.exception.InvalidStateException;
import lcsb.mapviewer.converter.annotation.XmlAnnotationParser;
import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.model.map.InconsistentModelException;
......@@ -64,6 +63,13 @@ public abstract class SbmlBioEntityExporter<T extends BioEntity, S extends org.s
String mapKey = element.getClass().getSimpleName() + "\n" + element.getElementId() + "\n" + compartmentName;
if (sbmlElementByElementNameAndCompartmentName.get(mapKey) == null) {
S sbmlElement = createSbmlElement(element);
XmlAnnotationParser parser = new XmlAnnotationParser();
String rdf = parser.dataSetToXmlString(element.getMiriamData());
try {
sbmlElement.setAnnotation(rdf);
} catch (XMLStreamException e1) {
throw new InconsistentModelException(e1);
}
sbmlElement.setName(element.getName());
try {
sbmlElement.setNotes(element.getNotes());
......
......@@ -42,6 +42,21 @@ public class GenericSbmlToXmlParserTest {
data.add(new Object[] { fPath });
}
});
Files.walk(Paths.get("testFiles/small")).forEach(fPath -> {
if (Files.isRegularFile(fPath) && fPath.toString().endsWith(".xml")) {
data.add(new Object[] { fPath });
}
});
Files.walk(Paths.get("testFiles/small/reaction")).forEach(fPath -> {
if (Files.isRegularFile(fPath) && fPath.toString().endsWith(".xml")) {
data.add(new Object[] { fPath });
}
});
Files.walk(Paths.get("testFiles/small/modifier")).forEach(fPath -> {
if (Files.isRegularFile(fPath) && fPath.toString().endsWith(".xml")) {
data.add(new Object[] { fPath });
}
});
return data;
}
......
package lcsb.mapviewer.converter.annotation;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -155,7 +156,7 @@ public class XmlAnnotationParser extends XmlParser {
* - a set of MiriamData to be converted.
* @return xml string representation of the input data
*/
public String dataSetToXmlString(Set<MiriamData> data) {
public String dataSetToXmlString(Collection<MiriamData> data) {
StringBuilder result = new StringBuilder("");
result.append(
"<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" " + "xmlns:dc=\"http://purl.org/dc/elements/1.1/\" "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment