Mercurial > hg > openmind
changeset 119:4eac7c57e593
add entities' incoming relations to xml export.
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 23 Oct 2019 13:25:51 +0200 |
parents | d275e1b99bce |
children | 3b0ce5e3302d |
files | src/main/java/org/mpi/openmind/repository/utils/OM4StreamWriter.java src/main/java/org/mpi/openmind/repository/utils/XMLUtil.java |
diffstat | 2 files changed, 21 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/mpi/openmind/repository/utils/OM4StreamWriter.java Mon Sep 02 18:01:06 2019 +0200 +++ b/src/main/java/org/mpi/openmind/repository/utils/OM4StreamWriter.java Wed Oct 23 13:25:51 2019 +0200 @@ -39,7 +39,7 @@ */ public class OM4StreamWriter { - protected static final String FORMAT_VERSION = "4.10"; + protected static final String FORMAT_VERSION = "4.11"; private static Logger logger = Logger.getLogger(OM4StreamWriter.class); @@ -162,11 +162,11 @@ // write entity to XML writeEntity(ent, writer, ps, includeNorm, entStats); // add (source)relations to list - List<Relation> rels = ent.getSourceRelations(); - relList.addAll(rels); + List<Relation> srcRels = ent.getSourceRelations(); + relList.addAll(srcRels); // update stats for relations Map<String, Long> entRelStats = entStats.get(ent.getObjectClass()); - for (Relation rel: rels) { + for (Relation rel: srcRels) { // update source relations updateRelStats(rel, true, entRelStats); } @@ -349,9 +349,23 @@ /* * write outgoing relations of this entity as XML tags */ - if (entity.getSourceRelations().size() > 0) { + List<Relation> srcRels = entity.getSourceRelations(); + if (srcRels.size() > 0) { writer.writeStartElement(XMLUtil.RELATIONS); - for (Relation rel : entity.getSourceRelations()) { + for (Relation rel : srcRels) { + // write xml (without stats) + writeRelation(rel, writer, includeNorm, null); + } + writer.writeEndElement(); + } + + /* + * write incoming relations of this entity as XML tags + */ + List<Relation> tarRels = entity.getTargetRelations(); + if (tarRels.size() > 0) { + writer.writeStartElement(XMLUtil.INVRELATIONS); + for (Relation rel : tarRels) { // write xml (without stats) writeRelation(rel, writer, includeNorm, null); }
--- a/src/main/java/org/mpi/openmind/repository/utils/XMLUtil.java Mon Sep 02 18:01:06 2019 +0200 +++ b/src/main/java/org/mpi/openmind/repository/utils/XMLUtil.java Wed Oct 23 13:25:51 2019 +0200 @@ -82,6 +82,7 @@ public static String OWN_VALUE = "own-value"; public static String LABEL_NAME = "name"; public static String RELATIONS = "relations"; + public static String INVRELATIONS = "invrelations"; public static String RELATION = "relation"; public static String RELATION_LABEL = "label"; public static String RELATION_SOURCE = "source-class";