private void processImport(Sheet sheet, int row) throws Exception { PrimitiveType prim = new PrimitiveType(); prim.setCode(sheet.getColumn(row, "Data Type")); prim.setDefinition(sheet.getColumn(row, "Definition")); prim.setComment(sheet.getColumn(row, "Comments")); prim.setSchemaType(sheet.getColumn(row, "Schema")); prim.setRegEx(sheet.getColumn(row, "RegEx")); TypeRef td = new TypeRef(); td.setName(prim.getCode()); definitions.getKnownTypes().add(td); definitions.getPrimitives().put(prim.getCode(), prim); }
private void gen(PrimitiveType t) { Section section = section(t.getCode()); section.triple("fhir:" + t.getCode(), "rdfs:subClassOf", "fhir:Primitive"); section.comment("fhir:" + t.getCode(), t.getDefinition()); nilInstance.predicate("a", "fhir:" + t.getCode()); section.triple("fhir:" + t.getCode() + ".value", "rdfs:subPropertyOf", "fhir:Primitive.value"); section.triple("fhir:" + t.getCode() + ".value", "rdfs:domain", "fhir:" + t.getCode()); if (t.getSchemaType().endsWith("+")) { section.triple( "fhir:" + t.getCode() + ".value", "rdfs:range", "xs:" + t.getSchemaType().substring(0, t.getSchemaType().length() - 1)); section.triple( "fhir:" + t.getCode() + ".value", "owl:withRestriction", complex().predicate("xs:pattern", literal(t.getRegex()))); } else if (t.getSchemaType().contains(",")) { section.triple( "fhir:" + t.getCode() + ".value", "rdfs:range", complex() .predicate("a", "owl:Class") .predicate("owl:unionOf", "(" + t.getSchemaType().replace(",", "") + ")"), "xs:union of " + t.getSchemaType()); } else section.triple("fhir:" + t.getCode() + ".value", "rdfs:range", "xs:" + t.getSchemaType()); }