private Set<String> listExtensionTypes(StructureDefinition ex) { ElementDefinition vd = null; for (ElementDefinition ed : ex.getSnapshot().getElement()) { if (ed.getPath().startsWith("Extension.value")) { vd = ed; break; } } Set<String> res = new HashSet<String>(); if (vd != null && !"0".equals(vd.getMax())) { for (TypeRefComponent tr : vd.getType()) { res.add(tr.getCode()); } } return res; }
tgt.addAlias(t.getValue()); tgt.setMin(src.getMin()); tgt.setMax(src.getMax()); if (src.hasBase()) tgt.setBase(convertElementDefinitionBaseComponent(src.getBase()));
tgt.setMin(src.getMin()); if (src.hasMax()) tgt.setMax(src.getMax()); if (src.hasBase()) tgt.setBase(convertElementDefinitionBaseComponent(src.getBase()));
} else if (criteriaElement.hasMin() && criteriaElement.getMin()>0) { expression = expression + " and " + discriminator + ".exists()"; } else if (criteriaElement.hasMax() && criteriaElement.getMax().equals("0")) { expression = expression + " and " + discriminator + ".exists().not()"; } else {
res.setMin(usage.getMin()); if (usage.hasMax()) res.setMax(usage.getMax());
public boolean isList() { return !"1".equals(definition.getMax()); }
tgt.addAlias(t.getValue()); tgt.setMin(src.getMin()); tgt.setMax(src.getMax()); if (src.hasBase()) tgt.setBase(convertElementDefinitionBaseComponent(src.getBase()));
location + "': minimum required = " + Integer.toString(ed.getMin()) + ", but only found " + Integer.toString(count)); if (ed.hasMax() && !ed.getMax().equals("*")) { if (problematicPaths.contains(ed.getPath())) hint(errors, IssueType.NOTSUPPORTED, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), location + ": Unable to check max allowed (" + ed.getMax() + ") due to lack of slicing validation"); else rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), location + ": max allowed = " + ed.getMax() + ", but found " + Integer.toString(count));
line.addString(ed.getLabel()); line.addValue(ed.getMin()); line.addValue(ed.getMax()); line.addString(ed.getMustSupport() ? "Y" : ""); line.addString(ed.getIsModifier() ? "Y" : "");
private String getCardinality(ElementDefinition ed, List<ElementDefinition> list) { int min = ed.getMin(); int max = !ed.hasMax() || ed.getMax().equals("*") ? Integer.MAX_VALUE : Integer.parseInt(ed.getMax()); while (ed != null && ed.getPath().contains(".")) { ed = findParent(ed, list); if (ed.getMax().equals("0")) max = 0; else if (!ed.getMax().equals("1") && !ed.hasSlicing()) max = Integer.MAX_VALUE; if (ed.getMin() == 0) min = 0; } return Integer.toString(min)+".."+(max == Integer.MAX_VALUE ? "*" : Integer.toString(max)); }
tgt.setMin(src.getMin()); if (src.hasMax()) tgt.setMax(src.getMax()); if (src.hasBase()) tgt.setBase(convertElementDefinitionBaseComponent(src.getBase()));
private boolean isSlicedToOneOnly(ElementDefinition e) { return (e.hasSlicing() && e.hasMaxElement() && e.getMax().equals("1")); }
private Set<String> listExtensionTypes(StructureDefinition ex) { ElementDefinition vd = null; for (ElementDefinition ed : ex.getSnapshot().getElement()) { if (ed.getPath().startsWith("Extension.value")) { vd = ed; break; } } Set<String> res = new HashSet<String>(); if (vd != null && !"0".equals(vd.getMax())) { for (TypeRefComponent tr : vd.getType()) { res.add(tr.getCode()); } } return res; }
private SpanEntry buildSpanningTable(String name, String cardinality, StructureDefinition profile, Set<String> processed, boolean onlyConstraints, String constraintPrefix) throws IOException { SpanEntry res = buildSpanEntryFromProfile(name, cardinality, profile); boolean wantProcess = !processed.contains(profile.getUrl()); processed.add(profile.getUrl()); if (wantProcess && profile.getDerivation() == TypeDerivationRule.CONSTRAINT) { for (ElementDefinition ed : profile.getSnapshot().getElement()) { if (!"0".equals(ed.getMax()) && ed.getType().size() > 0) { String card = getCardinality(ed, profile.getSnapshot().getElement()); if (!card.endsWith(".0")) { List<String> refProfiles = listReferenceProfiles(ed); if (refProfiles.size() > 0) { String uri = refProfiles.get(0); if (uri != null) { StructureDefinition sd = context.fetchResource(StructureDefinition.class, uri); if (sd != null && (!onlyConstraints || (sd.getDerivation() == TypeDerivationRule.CONSTRAINT && (constraintPrefix == null || sd.getUrl().startsWith(constraintPrefix))))) { res.getChildren().add(buildSpanningTable(nameForElement(ed), card, sd, processed, onlyConstraints, constraintPrefix)); } } } } } } } return res; }
boolean doMax = child.hasMax() && !child.getMax().equals("*") && (based == null || (!child.getMax().equals(based.getMax()))); Slicer slicer = slicing == null ? new Slicer(true) : generateSlicer(child, slicing, structure); if (slicer.check) { r.assrt("count(f:"+name+slicer.criteria+") >= "+Integer.toString(child.getMin()), name+slicer.name+": minimum cardinality of '"+name+"' is "+Integer.toString(child.getMin())); if (doMax) r.assrt("count(f:"+name+slicer.criteria+") <= "+child.getMax(), name+slicer.name+": maximum cardinality of '"+name+"' is "+child.getMax());
@Override protected void listChildren(List<org.hl7.fhir.dstu3.model.Property> childProps) { if (children != null) { for (Element c : children) { childProps.add(new org.hl7.fhir.dstu3.model.Property(c.getName(), c.fhirType(), c.getProperty().getDefinition().getDefinition(), c.getProperty().getDefinition().getMin(), maxToInt(c.getProperty().getDefinition().getMax()), c)); } } }
if (hasDef && !"0".equals(element.getMax())) genTypes(gen, row, element, profileBaseFileName, profile, corePath, imagePath); else
System.out.println("Differential: "); for (ElementDefinition ed : derived.getDifferential().getElement()) System.out.println(" "+ed.getPath()+" : "+typeSummary(ed)+"["+ed.getMin()+".."+ed.getMax()+"]"+sliceSummary(ed)+" id = "+ed.getId()); System.out.println("Snapshot: "); for (ElementDefinition ed : derived.getSnapshot().getElement()) System.out.println(" "+ed.getPath()+" : "+typeSummary(ed)+"["+ed.getMin()+".."+ed.getMax()+"]"+sliceSummary(ed)+" id = "+ed.getId()); throw new DefinitionException("Snapshot for "+derived.getUrl()+" does not contain differential element with id: " + e.getId());
if (element.getDefinition().getMin() == 0) optional = true; if (element.getDefinition().getMax().equals("*")) repeating = true; VariablesForProfiling result = vars.copy(optional, repeating);
private void updateFromBase(ElementDefinition derived, ElementDefinition base) { if (base.hasBase()) { if (!derived.hasBase()) derived.setBase(new ElementDefinitionBaseComponent()); derived.getBase().setPath(base.getBase().getPath()); derived.getBase().setMin(base.getBase().getMin()); derived.getBase().setMax(base.getBase().getMax()); } else { if (!derived.hasBase()) derived.setBase(new ElementDefinitionBaseComponent()); derived.getBase().setPath(base.getPath()); derived.getBase().setMin(base.getMin()); derived.getBase().setMax(base.getMax()); } }