Skip to content

Commit f95420e

Browse files
committed
Ignore tags with null value. Fixes #18.
Set default for tags with NOTE value. Fixes #19.
1 parent 81bcd6c commit f95420e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/com/github/informatievlaanderen/oslo_ea_to_rdf/convert/TagHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public String getSingleValue(EAObject object, String tag, String backup, boolean
161161
private List<String> getTagValues(List<EATag> tags, String key) {
162162
return tags.stream()
163163
.filter(t -> key.equals(t.getKey()))
164-
.map(t -> USE_NOTE_VALUE.equals(t.getValue()) ? t.getNotes() : t.getValue())
164+
.map(t -> USE_NOTE_VALUE.equals(t.getValue()) ? (t.getNotes() == null ? "TODO" : t.getNotes()) : t.getValue())
165165
.collect(Collectors.toList());
166166
}
167167

src/main/java/com/github/informatievlaanderen/oslo_ea_to_rdf/ea/impl/MemoryRepositoryBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ private Map<Integer, MemoryEAAttribute> loadAttributes(Connection connection, Ma
281281
*/
282282
private void loadObjectTags(Connection connection, Map<Integer, MemoryEAElement> elements, Map<Integer, MemoryEAPackage> packages) throws SQLException {
283283
try (Statement s = connection.createStatement()) {
284-
ResultSet rs = s.executeQuery("SELECT Property, Value, Object_ID, Notes FROM t_objectproperties ORDER BY PropertyID ASC");
284+
ResultSet rs = s.executeQuery("SELECT Property, Value, Object_ID, Notes FROM t_objectproperties WHERE Value IS NOT NULL ORDER BY PropertyID ASC");
285285

286286
while (rs.next()) {
287287
String key = rs.getString("Property");
@@ -307,7 +307,7 @@ private void loadObjectTags(Connection connection, Map<Integer, MemoryEAElement>
307307
*/
308308
private void loadAttributeTags(Connection connection, Map<Integer, MemoryEAAttribute> attributes) throws SQLException {
309309
try (Statement s = connection.createStatement()) {
310-
ResultSet rs = s.executeQuery("SELECT Property, VALUE, NOTES, ElementID FROM t_attributetag ORDER BY PropertyID ASC");
310+
ResultSet rs = s.executeQuery("SELECT Property, VALUE, NOTES, ElementID FROM t_attributetag WHERE VALUE IS NOT NULL ORDER BY PropertyID ASC");
311311

312312
while (rs.next()) {
313313
String key = rs.getString("Property");
@@ -330,7 +330,7 @@ private void loadAttributeTags(Connection connection, Map<Integer, MemoryEAAttri
330330
*/
331331
private void loadConnectorTags(Connection connection, Map<Integer, MemoryEAConnector> connectors) throws SQLException {
332332
try (Statement s = connection.createStatement()) {
333-
ResultSet rs = s.executeQuery("SELECT Property, VALUE, NOTES, ElementID FROM t_connectortag ORDER BY PropertyID ASC");
333+
ResultSet rs = s.executeQuery("SELECT Property, VALUE, NOTES, ElementID FROM t_connectortag WHERE VALUE IS NOT NULL ORDER BY PropertyID ASC");
334334

335335
while (rs.next()) {
336336
String key = rs.getString("Property");

0 commit comments

Comments
 (0)