annotate src/main/java/org/mpi/openmind/repository/utils/OM4StreamWriter.java @ 100:734c0d8c7369

add relations-tag with source relations for each entity to XML dump format 4.8.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Wed, 31 Oct 2018 15:44:12 +0100
parents 8005f7011975
children 1149eb948036
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
jurzua
parents:
diff changeset
1 package org.mpi.openmind.repository.utils;
jurzua
parents:
diff changeset
2
jurzua
parents:
diff changeset
3 import java.io.FileOutputStream;
jurzua
parents:
diff changeset
4 import java.io.IOException;
jurzua
parents:
diff changeset
5 import java.io.OutputStreamWriter;
jurzua
parents:
diff changeset
6 import java.text.DecimalFormat;
jurzua
parents:
diff changeset
7 import java.util.ArrayList;
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
8 import java.util.HashMap;
1
jurzua
parents:
diff changeset
9 import java.util.List;
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
10 import java.util.Map;
1
jurzua
parents:
diff changeset
11
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
12 import javax.xml.stream.XMLOutputFactory;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
13 import javax.xml.stream.XMLStreamException;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
14 import javax.xml.stream.XMLStreamWriter;
1
jurzua
parents:
diff changeset
15
jurzua
parents:
diff changeset
16 import org.apache.commons.lang.StringUtils;
jurzua
parents:
diff changeset
17 import org.apache.log4j.Logger;
jurzua
parents:
diff changeset
18 import org.mpi.openmind.repository.bo.Attribute;
jurzua
parents:
diff changeset
19 import org.mpi.openmind.repository.bo.Entity;
jurzua
parents:
diff changeset
20 import org.mpi.openmind.repository.bo.Node;
jurzua
parents:
diff changeset
21 import org.mpi.openmind.repository.bo.Relation;
jurzua
parents:
diff changeset
22 import org.mpi.openmind.repository.services.PersistenceService;
jurzua
parents:
diff changeset
23
31
7d8ebe8ac8a2 create reader and check script for XML dumps.
casties
parents: 29
diff changeset
24 /**
7d8ebe8ac8a2 create reader and check script for XML dumps.
casties
parents: 29
diff changeset
25 * Export all entities and relations and definitions to XML.
7d8ebe8ac8a2 create reader and check script for XML dumps.
casties
parents: 29
diff changeset
26 *
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
27 * Saves (content) entities and relations (i.e. assertions) and definitions
31
7d8ebe8ac8a2 create reader and check script for XML dumps.
casties
parents: 29
diff changeset
28 * (i.e. definition entities and relations) in separate files.
7d8ebe8ac8a2 create reader and check script for XML dumps.
casties
parents: 29
diff changeset
29 *
7d8ebe8ac8a2 create reader and check script for XML dumps.
casties
parents: 29
diff changeset
30 * @author jurzua, casties
7d8ebe8ac8a2 create reader and check script for XML dumps.
casties
parents: 29
diff changeset
31 *
7d8ebe8ac8a2 create reader and check script for XML dumps.
casties
parents: 29
diff changeset
32 */
1
jurzua
parents:
diff changeset
33 public class OM4StreamWriter {
jurzua
parents:
diff changeset
34
100
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
35 protected static final String FORMAT_VERSION = "4.8";
87
8005f7011975 update version number in xml.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
36
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
37 private static Logger logger = Logger.getLogger(OM4StreamWriter.class);
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
38
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
39 private static final int itemsPerPage = 500;
77
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
40
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
41 /** Include normalized own-values. */
78
b32b176a8aad make normalizations configurable (static).
casties
parents: 77
diff changeset
42 public static boolean includeNormalizations = true;
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
43
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
44 /** key for entity count in attribute counts map */
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
45 private static final String ENT_KEY = "<entity-count>";
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
46
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
47 /**
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
48 * Return the object's string representation or "null" if its null.
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
49 *
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
50 * @param s
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
51 * @return
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
52 */
31
7d8ebe8ac8a2 create reader and check script for XML dumps.
casties
parents: 29
diff changeset
53 private static String defaultString(Object s) {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
54 if (s == null) {
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
55 return "null";
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
56 } else {
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
57 return s.toString();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
58 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
59 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
60
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
61
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
62 /**
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
63 * Saves all content Entities with their Attributes and Relations in a XML file with the given fileName.
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
64 *
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
65 * @param fileName
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
66 * @param ps
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
67 */
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
68 public static void backupEntities(String fileName, PersistenceService ps) {
78
b32b176a8aad make normalizations configurable (static).
casties
parents: 77
diff changeset
69 writeEntsAndRels(fileName, ps, Node.TYPE_ABOX, includeNormalizations);
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
70 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
71
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
72 /**
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
73 * Saves all definitions in a XML file with the given fileName.
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
74 *
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
75 * @param fileName
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
76 * @param ps
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
77 */
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
78 public static void backupDefinitions(String fileName, PersistenceService ps) {
78
b32b176a8aad make normalizations configurable (static).
casties
parents: 77
diff changeset
79 writeEntsAndRels(fileName, ps, Node.TYPE_TBOX, false);
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
80 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
81
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
82 /**
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
83 * Writes all entities of the given type and their relations to the XML file at fileName.
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
84 *
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
85 * Type is either TYPE_TBOX or TYPE_ABOX.
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
86 *
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
87 * @param fileName
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
88 * @param ps
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
89 * @param type
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
90 */
78
b32b176a8aad make normalizations configurable (static).
casties
parents: 77
diff changeset
91 private static void writeEntsAndRels(String fileName, PersistenceService ps, String type, boolean includeNorm) {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
92 OutputStreamWriter out;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
93 try {
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
94 // statistics collection Maps
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
95 Map<String, Map<String, Long>> entStats = new HashMap<String, Map<String, Long>>();
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
96 Map<String, Map<String, Long>> relStats = new HashMap<String, Map<String, Long>>();
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
97
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
98 // setup xml writer
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
99 FileOutputStream fileOut = new FileOutputStream(fileName);
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
100 out = new OutputStreamWriter(fileOut, "UTF-8");
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
101 XMLOutputFactory factory = XMLOutputFactory.newInstance();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
102 XMLStreamWriter writer = factory.createXMLStreamWriter(out);
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
103
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
104 int entitiesCount = 0;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
105
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
106 writer.writeStartDocument("UTF-8", "1.0");
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
107
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
108 if (type.equals(Node.TYPE_ABOX)) {
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
109 writer.writeStartElement(XMLUtil.OPENMIND_DATA);
87
8005f7011975 update version number in xml.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
110 writer.writeAttribute("version", FORMAT_VERSION);
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
111 // get number of content Entities
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
112 entitiesCount = ps.getEntityCount(null).intValue();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
113 } else {
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
114 writer.writeStartElement(XMLUtil.META_DATA);
87
8005f7011975 update version number in xml.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 86
diff changeset
115 writer.writeAttribute("version", FORMAT_VERSION);
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
116 // get number of definition Entities
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
117 entitiesCount = ps.getEntityCount(Node.TYPE_TBOX).intValue();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
118 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
119
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
120 int numberOfPages = entitiesCount / itemsPerPage;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
121 // debug: int numberOfPages = 1;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
122 int counter = 0;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
123 long start = System.currentTimeMillis();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
124 DecimalFormat df = new DecimalFormat("#.##");
1
jurzua
parents:
diff changeset
125
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
126 // list of Relations (filled from Entities)
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
127 List<Relation> relList = new ArrayList<Relation>();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
128
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
129 /*
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
130 * write entities
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
131 */
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
132 writer.writeStartElement((type.equals(Node.TYPE_TBOX)) ? XMLUtil.DEFINITIONS : XMLUtil.ENTITIES);
82
90f9a1c45b15 small change to xml format.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
133 writer.writeAttribute("count", Integer.toString(entitiesCount));
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
134 // iterate database by pages
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
135 for (int currentPage = 0; currentPage <= numberOfPages; currentPage++) {
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
136 int startRecord = currentPage * itemsPerPage;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
137 List<Entity> entities;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
138
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
139 if (type.equals(Node.TYPE_ABOX)) {
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
140 // get page of content Entities
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
141 entities = ps.getEntityPage(null, startRecord, itemsPerPage);
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
142 } else {
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
143 // get page of definition Entities
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
144 entities = ps.getEntityPage(Node.TYPE_TBOX, startRecord, itemsPerPage);
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
145 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
146
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
147 // iterate entities
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
148 for (Entity ent : entities) {
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
149 // write entity to XML
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
150 writeEntity(ent, writer, ps, includeNorm, entStats);
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
151 // add (source)relations to list
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
152 List<Relation> rels = ent.getSourceRelations();
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
153 relList.addAll(rels);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
154 // update stats for relations
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
155 Map<String, Long> entRelStats = entStats.get(ent.getObjectClass());
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
156 for (Relation rel: rels) {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
157 // update source relations
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
158 updateRelStats(rel, true, entRelStats);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
159 }
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
160 for (Relation rel: ent.getTargetRelations()) {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
161 // update target relations
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
162 updateRelStats(rel, false, entRelStats);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
163 }
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
164 // count entities
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
165 counter++;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
166 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
167
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
168 long runtime = System.currentTimeMillis() - start;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
169 double percent = ((double) counter / (double) entitiesCount) * 100.0;
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
170 logger.debug("(" + df.format(percent) + "%) \t[" + counter + "/" + entitiesCount + "]\t");
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
171 logger.debug("Speed[ents/s]: " + df.format((double) counter / ((double) runtime / 1000)));
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
172 writer.flush();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
173 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
174 writer.writeEndElement();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
175
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
176 /*
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
177 * write relations (from list)
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
178 */
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
179 writer.writeStartElement(XMLUtil.RELATIONS);
82
90f9a1c45b15 small change to xml format.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 79
diff changeset
180 writer.writeAttribute("count", Integer.toString(relList.size()));
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
181 for (Relation rel : relList) {
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
182 writeRelation(rel, writer, includeNorm, relStats);
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
183 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
184 writer.writeEndElement();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
185
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
186 /*
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
187 * write statistics
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
188 */
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
189 // entity stats
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
190 writeStats(XMLUtil.ENTITY_STATS, XMLUtil.ENTITY, entStats, writer);
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
191 // relation stats
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
192 writeStats(XMLUtil.RELATION_STATS, XMLUtil.RELATION, relStats, writer);
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
193
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
194 // end file.
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
195 writer.writeEndElement();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
196
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
197 writer.flush();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
198 writer.close();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
199
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
200 logger.info("END Stream Writer");
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
201 } catch (IOException e) {
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
202 logger.error(e);
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
203 } catch (XMLStreamException e) {
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
204 logger.error(e);
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
205 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
206 }
1
jurzua
parents:
diff changeset
207
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
208 /**
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
209 * Write OpenMind relation to XML.
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
210 *
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
211 * @param rel
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
212 * @param writer
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
213 * @param relStats
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
214 * @throws XMLStreamException
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
215 */
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
216 private static void writeRelation(Relation rel, XMLStreamWriter writer, boolean includeNorm,
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
217 Map<String, Map<String, Long>> relStats) throws XMLStreamException {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
218 writer.writeStartElement(XMLUtil.RELATION);
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
219
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
220 // update stats
100
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
221 Map<String, Long> attStats = null;
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
222 if (relStats != null) {
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
223 attStats = updateNodeStats(rel, relStats);
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
224 }
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
225
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
226 /*
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
227 * write XML-attributes
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
228 */
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
229 writer.writeAttribute(XMLUtil.OBJECT_CLASS, defaultString(rel.getObjectClass()));
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
230 writer.writeAttribute(XMLUtil.ID, defaultString(rel.getId()));
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
231 writer.writeAttribute(XMLUtil.ROW_ID, defaultString(rel.getRowId()));
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
232 if (StringUtils.isNotEmpty(rel.getContentType())) {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
233 writer.writeAttribute(XMLUtil.CONTENT_TYPE, rel.getContentType());
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
234 }
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
235 writer.writeAttribute(XMLUtil.RELATION_SOURCE_ID, defaultString(rel.getSourceId()));
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
236 writer.writeAttribute(XMLUtil.RELATION_SOURCE, defaultString(rel.getSourceObjectClass()));
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
237 writer.writeAttribute(XMLUtil.RELATION_TARGET_ID, defaultString(rel.getTargetId()));
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
238 writer.writeAttribute(XMLUtil.RELATION_TARGET, defaultString(rel.getTargetObjectClass()));
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
239 writer.writeAttribute(XMLUtil.VERSION, defaultString(rel.getVersion()));
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
240 writer.writeAttribute(XMLUtil.MODIFICATION_TIME, defaultString(rel.getModificationTime()));
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
241 if (rel.getUser() != null) {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
242 writer.writeAttribute(XMLUtil.USER, rel.getUser());
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
243 }
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
244 if (rel.getIsPublic()) {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
245 writer.writeAttribute(XMLUtil.PUBLIC, "true");
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
246 }
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
247
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
248 /*
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
249 * write OpenMind attributes of this relation as XML tags
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
250 */
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
251 if (rel.getAttributes().size() > 0) {
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
252 writer.writeStartElement(XMLUtil.ATTRIBUTES);
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
253 for (Attribute att : rel.getAttributes()) {
100
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
254 if (attStats != null) {
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
255 // update stats
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
256 updateAttStats(att, attStats);
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
257 }
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
258 // write xml
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
259 writeAttribute(att, writer, includeNorm);
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
260 }
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
261 writer.writeEndElement();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
262 }
1
jurzua
parents:
diff changeset
263
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
264 /*
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
265 * write own value as content
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
266 */
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
267 if (StringUtils.isNotEmpty(rel.getOwnValue())) {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
268 writer.writeCharacters(rel.getOwnValue());
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
269 }
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
270
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
271 writer.writeEndElement();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
272 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
273
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
274 /**
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
275 * Write OpenMind entity to XML.
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
276 *
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
277 * @param entity
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
278 * @param writer
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
279 * @param ps
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
280 * @param entStats
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
281 * @throws XMLStreamException
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
282 */
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
283 private static void writeEntity(Entity entity, XMLStreamWriter writer, PersistenceService ps, boolean includeNorm,
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
284 Map<String, Map<String, Long>> entStats)
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
285 throws XMLStreamException {
1
jurzua
parents:
diff changeset
286
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
287 writer.writeStartElement((entity.getType().equals(Node.TYPE_TBOX)) ? XMLUtil.DEFINITION : XMLUtil.ENTITY);
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
288
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
289 if (entity.isLightweight()) {
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
290 // make sure we have all attributes and relations
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
291 entity = ps.getEntityContent(entity);
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
292 }
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
293
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
294 // update stats
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
295 Map<String, Long> attStats = updateNodeStats(entity, entStats);
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
296
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
297 /*
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
298 * write XML attributes
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
299 */
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
300 writer.writeAttribute(XMLUtil.OBJECT_CLASS, defaultString(entity.getObjectClass()));
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
301 writer.writeAttribute(XMLUtil.ID, defaultString(entity.getId()));
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
302 writer.writeAttribute(XMLUtil.ROW_ID, defaultString(entity.getRowId()));
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
303 if (StringUtils.isNotEmpty(entity.getContentType())) {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
304 writer.writeAttribute(XMLUtil.CONTENT_TYPE, entity.getContentType());
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
305 }
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
306 writer.writeAttribute(XMLUtil.VERSION, defaultString(entity.getVersion()));
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
307 writer.writeAttribute(XMLUtil.MODIFICATION_TIME, defaultString(entity.getModificationTime()));
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
308 if (entity.getUser() != null) {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
309 writer.writeAttribute(XMLUtil.USER, entity.getUser());
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
310 }
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
311 if (entity.getIsPublic()) {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
312 writer.writeAttribute(XMLUtil.PUBLIC, "true");
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
313 }
1
jurzua
parents:
diff changeset
314
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
315 /*
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
316 * write OpenMind attributes of this entity as XML tags
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
317 */
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
318 if (entity.getAttributes().size() > 0) {
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
319 writer.writeStartElement(XMLUtil.ATTRIBUTES);
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
320 for (Attribute att : entity.getAttributes()) {
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
321 // update stats
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
322 updateAttStats(att, attStats);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
323 // write xml
78
b32b176a8aad make normalizations configurable (static).
casties
parents: 77
diff changeset
324 writeAttribute(att, writer, includeNorm);
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
325 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
326 writer.writeEndElement();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
327 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
328
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
329 /*
100
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
330 * write outgoing relations of this entity as XML tags
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
331 */
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
332 if (entity.getSourceRelations().size() > 0) {
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
333 writer.writeStartElement(XMLUtil.RELATIONS);
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
334 for (Relation rel : entity.getSourceRelations()) {
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
335 // write xml (without stats)
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
336 writeRelation(rel, writer, includeNorm, null);
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
337 }
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
338 writer.writeEndElement();
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
339 }
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
340
734c0d8c7369 add relations-tag with source relations for each entity to XML dump format 4.8.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 87
diff changeset
341 /*
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
342 * write own value
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
343 */
77
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
344 String ov = entity.getOwnValue();
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
345 if (StringUtils.isNotEmpty(ov)) {
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
346 writer.writeCharacters(ov);
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
347 String nov = entity.getNormalizedOwnValue();
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
348 if (includeNorm && StringUtils.isNotEmpty(nov) && !ov.equals(nov)) {
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
349 // write normalized value
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
350 writer.writeStartElement(XMLUtil.NORMALIZED);
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
351 writer.writeCharacters(nov);
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
352 writer.writeEndElement();
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
353 }
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
354 }
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
355
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
356 writer.writeEndElement();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
357 }
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
358
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
359
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
360 private static void writeAttribute(Attribute att, XMLStreamWriter writer, boolean includeNorm) throws XMLStreamException {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
361 writer.writeStartElement(XMLUtil.ATTRIBUTE);
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
362
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
363 /*
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
364 * write XML attributes
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
365 */
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
366 writer.writeAttribute(XMLUtil.ATTRIBUTE_NAME, defaultString(att.getName()));
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
367 writer.writeAttribute(XMLUtil.ID, defaultString(att.getId()));
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
368 writer.writeAttribute(XMLUtil.ROW_ID, defaultString(att.getRowId()));
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
369 writer.writeAttribute(XMLUtil.CONTENT_TYPE, defaultString(att.getContentType()));
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
370 writer.writeAttribute(XMLUtil.VERSION, defaultString(att.getVersion()));
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
371 writer.writeAttribute(XMLUtil.MODIFICATION_TIME, defaultString(att.getModificationTime()));
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
372 if (att.getUser() != null) {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
373 writer.writeAttribute(XMLUtil.USER, att.getUser());
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
374 }
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
375 if (att.getIsPublic()) {
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
376 writer.writeAttribute(XMLUtil.PUBLIC, "true");
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
377 }
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
378
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
379 /*
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
380 * write value as content
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
381 */
77
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
382 String ov = att.getValue();
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
383 if (StringUtils.isNotEmpty(ov)) {
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
384 writer.writeCharacters(ov);
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
385 String nov = att.getNormalizedOwnValue();
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
386 if (includeNorm && StringUtils.isNotEmpty(nov) && !ov.equals(nov)) {
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
387 // write normalized value
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
388 writer.writeStartElement(XMLUtil.NORMALIZED);
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
389 writer.writeCharacters(nov);
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
390 writer.writeEndElement();
a59984fd3c3f add normalized own-values to xml dump.
casties
parents: 75
diff changeset
391 }
75
e0be7c0030f5 cleanup and better comments.
casties
parents: 31
diff changeset
392 }
1
jurzua
parents:
diff changeset
393
29
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
394 writer.writeEndElement();
5786aa6caeb3 new XML export and test script.
casties
parents: 1
diff changeset
395 }
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
396
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
397
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
398 private static void writeStats(String statsTag, String entryTag, Map<String, Map<String, Long>> nodeStats,
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
399 XMLStreamWriter writer) throws XMLStreamException {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
400 // write stats tag
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
401 writer.writeStartElement(statsTag);
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
402
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
403 for (String nodeType : nodeStats.keySet()) {
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
404 Map<String, Long> attStats = nodeStats.get(nodeType);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
405 Long nodeCnt = attStats.get(ENT_KEY);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
406 // write tag for entity/attribute
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
407 writer.writeStartElement(entryTag);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
408 writer.writeAttribute(XMLUtil.OBJECT_CLASS, (nodeType == null) ? "null" : nodeType);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
409 writer.writeAttribute(XMLUtil.COUNT, nodeCnt.toString());
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
410
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
411 // write attributes
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
412 for (String attName : attStats.keySet()) {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
413 // skip ENT_KEY
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
414 if (attName.equals(ENT_KEY))
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
415 continue;
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
416 if (attName.contains("[")) {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
417 // write relation tag
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
418 writer.writeStartElement(XMLUtil.RELATION);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
419 } else {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
420 // write attribute tag
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
421 writer.writeStartElement(XMLUtil.ATTRIBUTE);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
422 }
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
423 writer.writeAttribute(XMLUtil.ATTRIBUTE_NAME, attName);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
424 Long attCnt = attStats.get(attName);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
425 writer.writeAttribute(XMLUtil.COUNT, attCnt.toString());
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
426 writer.writeEndElement();
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
427 }
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
428 // end of entity/attribute tag
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
429 writer.writeEndElement();
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
430 }
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
431 // end of stats tag
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
432 writer.writeEndElement();
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
433 }
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
434
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
435 /**
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
436 * @param objectClass
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
437 * @param entStats
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
438 * @return
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
439 */
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
440 protected static Map<String, Long> updateNodeStats(Node ent, Map<String, Map<String, Long>> entStats) {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
441 String objectClass = ent.getObjectClass();
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
442 Map<String, Long> attStats = entStats.get(objectClass);
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
443 if (attStats == null) {
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
444 // create new attribute stats entry
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
445 attStats = new HashMap<String, Long>();
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
446 // add key to count entities
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
447 attStats.put(ENT_KEY, 1l);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
448 // add to map
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
449 entStats.put(objectClass, attStats);
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
450 } else {
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
451 // increment entity count
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
452 Long entCnt = attStats.get(ENT_KEY);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
453 attStats.put(ENT_KEY, entCnt + 1);
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
454 }
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
455 return attStats;
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
456 }
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
457
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
458 /**
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
459 * @param att
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
460 * @param attStats
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
461 */
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
462 protected static void updateAttStats(Attribute att, Map<String, Long> attStats) {
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
463 String attName = att.getName();
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
464 Long cnt = attStats.get(attName);
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
465 if (cnt == null) {
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
466 attStats.put(attName, 1l);
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
467 } else {
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
468 attStats.put(attName, cnt + 1);
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
469 }
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
470 }
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
471
86
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
472 /**
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
473 * Update relation statistics.
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
474 *
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
475 * Relation stats are saved like attribute stats but with "[entity-type]" before
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
476 * or after the relation name.
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
477 *
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
478 * @param rel
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
479 * @param relStats
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
480 */
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
481 protected static void updateRelStats(Relation rel, boolean isSrcRel, Map<String, Long> relStats) {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
482 String relName = rel.getObjectClass();
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
483 if (isSrcRel) {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
484 relName = relName + "[" + rel.getTargetObjectClass() + "]";
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
485 } else {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
486 relName = "[" + rel.getSourceObjectClass() + "]" + relName;
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
487 }
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
488 Long cnt = relStats.get(relName);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
489 if (cnt == null) {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
490 relStats.put(relName, 1l);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
491 } else {
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
492 relStats.put(relName, cnt + 1);
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
493 }
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
494 }
d4b456623d43 Updated XML export. Saves relation source-type and target-type. Expanded statistics with per-entity-type relation counts.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents: 82
diff changeset
495
79
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
496
b0aebac0780a put statistics about number of entities, relations and attributes in xml dump.
casties
parents: 78
diff changeset
497
1
jurzua
parents:
diff changeset
498 }