|
8 | 8 | import java.util.stream.Collectors; |
9 | 9 | import java.util.stream.Stream; |
10 | 10 |
|
| 11 | +import static model.conceptual.Vertex.GraphElemType.*; |
| 12 | + |
11 | 13 | /** |
12 | 14 | * Class that is responsible for the conversion of a visual graph into a .ttl string. |
13 | 15 | */ |
@@ -68,20 +70,20 @@ private static String getFixes() { |
68 | 70 | fixString.append(".\n"); |
69 | 71 | } |
70 | 72 |
|
71 | | - // reminding the user that instance literals will be replaced by their corresponding instance level data when |
| 73 | + // reminding the user that instance elements will be replaced by their corresponding instance level data when |
72 | 74 | // converted to instance-level .ttl. |
73 | | - if (classes.stream().anyMatch(c -> c.getElementType() == Vertex.GraphElemType.INSTANCE_LITERAL)){ |
74 | | - fixString.append("# The following Literals are placeholders for instance-level data that will be populate" + |
75 | | - "d during instance-level .ttl creation: \n# "); |
| 75 | + if (classes.stream().anyMatch(c -> c.getElementType() == INSTANCE_LITERAL)){ |
| 76 | + fixString.append("# The following Elements are placeholders for instance-level data that will be populate" + |
| 77 | + "d during instance-level .ttl creation: \n# "); |
76 | 78 | classes.stream() |
77 | | - .filter(c -> c.getElementType() == Vertex.GraphElemType.INSTANCE_LITERAL) |
| 79 | + .filter(c -> c.getElementType() == INSTANCE_LITERAL || c.getElementType() == INSTANCE_CLASS) |
78 | 80 | .forEach(c -> fixString.append(c.getName()).append(", ")); |
79 | 81 | fixString.delete(fixString.length() - 2, fixString.length()); |
80 | 82 | fixString.append(".\n"); |
81 | 83 | } |
82 | 84 |
|
83 | 85 | Stream<String> ttlClassPrefixesStream = classes.stream() |
84 | | - .filter(c -> c.getElementType() == Vertex.GraphElemType.GLOBAL_CLASS && !c.isIri()) |
| 86 | + .filter(c -> c.getElementType() == GLOBAL_CLASS && !c.isIri()) |
85 | 87 | .map(c -> c.getName().split(":")[0]); |
86 | 88 | Stream<String> ttlPropPrefixesStream = properties.stream() |
87 | 89 | .filter(p -> !p.isIri()) |
@@ -265,7 +267,7 @@ private static String convertGClasses() { |
265 | 267 | for (Vertex graphClass : classes) { |
266 | 268 | isBlanknode = config.get(1) && graphClass.isBlank(); |
267 | 269 |
|
268 | | - if (graphClass.getElementType() == Vertex.GraphElemType.GLOBAL_CLASS && !isBlanknode) |
| 270 | + if (graphClass.getElementType() == GLOBAL_CLASS && !isBlanknode) |
269 | 271 | classStrs.append(convertTriple(graphClass)); |
270 | 272 | } |
271 | 273 |
|
@@ -407,7 +409,7 @@ private static String convertObject(Vertex object) { |
407 | 409 | dedentTab(); |
408 | 410 | objectStr += tabs + "]"; |
409 | 411 | } else objectStr = "[" + predicateObjectList + "]"; |
410 | | - } else if (object.getElementType() == Vertex.GraphElemType.INSTANCE_LITERAL) { |
| 412 | + } else if (object.getElementType() == INSTANCE_LITERAL) { |
411 | 413 | String dataType = object.getDataType(); |
412 | 414 | objectStr = "\"" + objectStr + "\"" + |
413 | 415 | (dataType != null && dataType.length() != 0 ? "^^" + object.getDataType() : ""); |
|
0 commit comments