Use leading underscore for properties with objects with modifier extensions.

This commit is contained in:
Jim Balhoff 2023-02-01 19:49:24 -05:00
parent 12bf57886f
commit d596a6c343
1 changed files with 10 additions and 4 deletions

View File

@ -333,9 +333,8 @@ public class TurtleParser extends ParserBase {
} }
String subjId = genSubjectId(e); String subjId = genSubjectId(e);
boolean hasModifierExtension = e.getChildren().stream().anyMatch(p -> p.getName().equals("modifierExtension"));
Subject subject; Subject subject;
if (hasModifierExtension) if (hasModifierExtension(e))
subject = section.triple(subjId, "a", "fhir:_" + e.getType()); subject = section.triple(subjId, "a", "fhir:_" + e.getType());
else else
subject = section.triple(subjId, "a", "fhir:" + e.getType()); subject = section.triple(subjId, "a", "fhir:" + e.getType());
@ -348,6 +347,10 @@ public class TurtleParser extends ParserBase {
} }
private boolean hasModifierExtension(Element e) {
return e.getChildren().stream().anyMatch(p -> p.getName().equals("modifierExtension"));
}
protected String getURIType(String uri) { protected String getURIType(String uri) {
if(uri.startsWith("<" + FHIR_URI_BASE)) if(uri.startsWith("<" + FHIR_URI_BASE))
if(uri.substring(FHIR_URI_BASE.length() + 1).contains("/")) if(uri.substring(FHIR_URI_BASE.length() + 1).contains("/"))
@ -480,6 +483,9 @@ public class TurtleParser extends ParserBase {
if (en.endsWith("[x]")) if (en.endsWith("[x]"))
en = en.substring(0, en.length()-3); en = en.substring(0, en.length()-3);
if (hasModifierExtension(element))
return "_" + en;
else
return en; return en;
} }