X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.district.imports%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fimports%2FDistrictImportUtils.java;fp=org.simantics.district.imports%2Fsrc%2Forg%2Fsimantics%2Fdistrict%2Fimports%2FDistrictImportUtils.java;h=67e07b0cbd792ec3cfdc9a978ee8f14950382745;hb=55be0da74875c6e9e9b96bc86a6773b87889036e;hp=d9dac92c5586c5924fbf6fe7e1fc2796aa85d3ef;hpb=fe3c9ce9564fbe30606f922c813ef7ffb78d387c;p=simantics%2Fdistrict.git diff --git a/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java b/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java index d9dac92c..67e07b0c 100644 --- a/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java +++ b/org.simantics.district.imports/src/org/simantics/district/imports/DistrictImportUtils.java @@ -387,6 +387,13 @@ public class DistrictImportUtils { int detailedGeometryIndex = model.getDetailedGeometryIndex(); int regionIndex = model.getRegionIndex(); int pipeTypeIndex = model.getPipeTypeIndex(); + int pipeCodeIndex = model.getPipeCodeIndex(); + int installationYearIndex = model.getInstallationYearIndex(); + int wallThicknessIndex = model.getWallThicknessIndex(); + int insulationConductivityIndex = model.getInsulationConductivityIndex(); + int pipeSizeDNIndex = model.getPipeSizeDNIndex(); + int roughnessIndex = model.getRoughnessIndex(); + int structureIndex = model.getStructureIndex(); int mappingColumn = model.getComponentMappingIndex(); int idColumn = model.getIdIndex(); @@ -482,6 +489,13 @@ public class DistrictImportUtils { writeStringValue(graph, row, regionIndex, edge, DN.HasRegion); writeStringValue(graph, row, pipeTypeIndex, edge, DN.Edge_HasType); writeDoubleArrayFromString(graph, row, detailedGeometryIndex, edge, DN.Edge_HasGeometry, actualTransform); + writeStringValue(graph, row, pipeCodeIndex, edge, DN.Edge_HasPipeCode); + writeIntegerValue(graph, row, installationYearIndex, edge, DN.Edge_HasInstallationYear); + writeValue(graph, row, wallThicknessIndex, edge, DN.Edge_HasWallThickness); + writeValue(graph, row, insulationConductivityIndex, edge, DN.Edge_HasInsulationConductivity); + writeIntegerValue(graph, row, pipeSizeDNIndex, edge, DN.Edge_HasPipeSizeDN); + writeValue(graph, row, roughnessIndex, edge, DN.Edge_HasRoughness); + writeStringValue(graph, row, structureIndex, edge, DN.Edge_HasStructure); } } return true; @@ -521,6 +535,23 @@ public class DistrictImportUtils { } } + private static void writeIntegerValue(WriteGraph graph, CSVRecord row, int index, Resource subject, Resource relation) throws DatabaseException { + if (index != -1) { + String stringValue = row.get(index); + if (!stringValue.isEmpty()) { + try { + if (stringValue.startsWith("\"") && stringValue.endsWith("\"")) { + stringValue = stringValue.substring(1, stringValue.length() - 1); + } + graph.claimLiteral(subject, relation, Integer.parseInt(stringValue), Bindings.INTEGER); + } catch (NumberFormatException e) { + LOGGER.error("Could not parse {} {} {} {}", row, index, subject, relation, e); + //throw new DatabaseException(e); + } + } + } + } + private static void writeStringValue(WriteGraph graph, CSVRecord row, int index, Resource subject, Resource relation) throws DatabaseException { if (index != -1) { String stringValue = row.get(index);