From ec3b54b29e778bb08fc258b564bdf373123712a7 Mon Sep 17 00:00:00 2001 From: stenkarl Date: Tue, 1 Oct 2024 07:03:13 -0500 Subject: [PATCH] final migration of connectathon starter data to composer (#41) --- pom.xml | 4 +- .../Sept2024ConnectathonStarterData.java | 375 +++++++----------- 2 files changed, 143 insertions(+), 236 deletions(-) diff --git a/pom.xml b/pom.xml index f8d384a..fc0f51a 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ 4.3.0 2.14.2 2.0.13 - 1.2.0 + 1.3.0 @@ -107,7 +107,7 @@ org.slf4j slf4j-simple ${slf4j.version} - + diff --git a/src/main/java/dev/ikm/tinkar/sandbox/Sept2024ConnectathonStarterData.java b/src/main/java/dev/ikm/tinkar/sandbox/Sept2024ConnectathonStarterData.java index 93ee9a7..8556a35 100644 --- a/src/main/java/dev/ikm/tinkar/sandbox/Sept2024ConnectathonStarterData.java +++ b/src/main/java/dev/ikm/tinkar/sandbox/Sept2024ConnectathonStarterData.java @@ -1,33 +1,27 @@ package dev.ikm.tinkar.sandbox; -import dev.ikm.tinkar.common.id.PublicId; -import dev.ikm.tinkar.common.id.PublicIds; +import dev.ikm.tinkar.common.service.CachingService; +import dev.ikm.tinkar.common.service.PrimitiveData; +import dev.ikm.tinkar.common.service.ServiceKeys; +import dev.ikm.tinkar.common.service.ServiceProperties; import dev.ikm.tinkar.common.util.uuid.UuidUtil; +import dev.ikm.tinkar.composer.Attachable; import dev.ikm.tinkar.composer.Composer; import dev.ikm.tinkar.composer.Session; import dev.ikm.tinkar.composer.assembler.ConceptAssembler; import dev.ikm.tinkar.composer.assembler.PatternAssembler; +import dev.ikm.tinkar.composer.assembler.SemanticAssembler; import dev.ikm.tinkar.composer.template.FullyQualifiedName; import dev.ikm.tinkar.composer.template.Identifier; import dev.ikm.tinkar.composer.template.StatedAxiom; import dev.ikm.tinkar.composer.template.Synonym; import dev.ikm.tinkar.composer.template.USDialect; -import dev.ikm.tinkar.entity.EntityService; -import dev.ikm.tinkar.entity.RecordListBuilder; -import dev.ikm.tinkar.entity.SemanticEntity; -import dev.ikm.tinkar.entity.SemanticEntityVersion; -import dev.ikm.tinkar.entity.SemanticRecord; -import dev.ikm.tinkar.entity.SemanticRecordBuilder; -import dev.ikm.tinkar.entity.SemanticVersionRecord; -import dev.ikm.tinkar.entity.SemanticVersionRecordBuilder; import dev.ikm.tinkar.entity.export.ExportEntitiesController; -import dev.ikm.tinkar.starterdata.StarterData; import dev.ikm.tinkar.starterdata.UUIDUtility; import dev.ikm.tinkar.terms.EntityProxy; import dev.ikm.tinkar.terms.EntityProxy.Concept; import dev.ikm.tinkar.terms.State; import dev.ikm.tinkar.terms.TinkarTerm; -import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.list.MutableList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,109 +36,38 @@ public class Sept2024ConnectathonStarterData { private static final Logger log = LoggerFactory.getLogger(Sept2024ConnectathonStarterData.class); - private static final String EXAMPLE_UUCM = "lb/in^2"; private final File exportFile; - private final StarterData starterData; private final UUIDUtility uuidUtility = new UUIDUtility(); - - private final Composer composer = new Composer("Sept 2024 Connectathon Starter Data"); private final Session session; public Sept2024ConnectathonStarterData(File exportDataStore, File exportFile) { this.exportFile = exportFile; - starterData = new StarterData(exportDataStore, uuidUtility) - .init() - .authoringSTAMP( - TinkarTerm.ACTIVE_STATE, - System.currentTimeMillis(), - TinkarTerm.USER, - TinkarTerm.PRIMORDIAL_MODULE, - TinkarTerm.PRIMORDIAL_PATH); + CachingService.clearAll(); + ServiceProperties.set(ServiceKeys.DATA_STORE_ROOT, exportDataStore); + PrimitiveData.selectControllerByName("Open SpinedArrayStore"); + PrimitiveData.start(); + Composer composer = new Composer("Sept 2024 Connectathon Starter Data"); session = composer.open(State.ACTIVE, TinkarTerm.USER, TinkarTerm.PRIMORDIAL_MODULE, TinkarTerm.PRIMORDIAL_PATH); - createComposerConcepts(); configureConceptsAndPatterns(); composer.commitSession(session); - starterData.build(); exportStarterData(); - starterData.shutdown(); - } - - private void createComposerConcepts() { - Concept performance = Concept.make("Performance", UUID.fromString("395cc864-7c51-4072-b3e7-f9195b40053a")); - session.compose((ConceptAssembler conceptAssembler) -> conceptAssembler - .concept(performance) - .attach((FullyQualifiedName fqn) -> fqn - .language(ENGLISH_LANGUAGE) - .text("Performance") - .caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) - .attach((USDialect usDialect) -> usDialect.acceptability(TinkarTerm.PREFERRED))) - .attach((Synonym synonym) -> synonym - .text("Performance") - .language(ENGLISH_LANGUAGE) - .caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) - .attach((USDialect usDialect) -> usDialect.acceptability(TinkarTerm.PREFERRED))) - .attach((Identifier identifier) -> identifier - .source(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER) - .identifier(performance.asUuidArray()[0].toString())) - .attach((StatedAxiom axiom) -> axiom - .isA(TinkarTerm.MODEL_CONCEPT)) - ); - + PrimitiveData.stop(); } private void configureConceptsAndPatterns() { + createConcept(Concept.make("Performance", UUID.fromString("395cc864-7c51-4072-b3e7-f9195b40053a"))) + .attach((StatedAxiom axiom) -> axiom.isA(TinkarTerm.MODEL_CONCEPT)); + configureConnectathonPatterns(); configureValueContraintSemantics(); } - private void configureValueContraintSemantics() { - Concept cdcField1 = Concept.make("CDC", UUID.nameUUIDFromBytes("LP207920-2".getBytes())); - starterData.concept(cdcField1) - .synonym("CDC", TinkarTerm.PREFERRED) - .fullyQualifiedName("Center For Disease Control and Prevention", TinkarTerm.US_ENGLISH_DIALECT) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, cdcField1.asUuidArray()[0].toString()) - .build(); - - createBMISemantic("Underweight (finding)", "248342006", cdcField1, 0F, TinkarTerm.LESS_THAN, 18.5F); - createBMISemantic("Normal weight (finding)", "43664005", cdcField1, 18.5F, TinkarTerm.LESS_THAN_OR_EQUAL_TO, 24.99F); - createBMISemantic("Obese (finding)", "414915002", cdcField1, 30F, TinkarTerm.LESS_THAN, 500F); - createBMISemantic("Body mass index 30+ - obesity (finding)", "162864005", cdcField1, 30F, TinkarTerm.LESS_THAN, 500F); - createBMISemantic("Obese class I (finding) (Body mass index 30.00 to 34.99)", "443371000124107", cdcField1, 30F, TinkarTerm.LESS_THAN_OR_EQUAL_TO, 34.99F); - createBMISemantic("Obese class II (finding) ( Body mass index 35.00 to 39.99)", "443381000124105", cdcField1, 35F, TinkarTerm.LESS_THAN_OR_EQUAL_TO, 39.99F); - createBMISemantic("Body mass index 40+ - severely obese (finding)", "408512008", cdcField1, 40F, TinkarTerm.LESS_THAN, 500F); - createBMISemantic("Obese class III (finding) (Body mass index equal to or greater than 40)", "819948005", cdcField1, 40F, TinkarTerm.LESS_THAN, 500F); - } - - private void createBMISemantic(String description, String snomedctId, Concept cdcField1, float referenceRangeMinimum, - Concept maxRefRangeOperator, float referenceRangeMaximum) { - - Concept concept = makeBmiConcept(description, snomedctId); - - MutableList classPatternFields = Lists.mutable.empty(); - classPatternFields.add(cdcField1); - classPatternFields.add(TinkarTerm.GREATER_THAN_OR_EQUAL_TO); - classPatternFields.add(referenceRangeMinimum); - classPatternFields.add(maxRefRangeOperator); - classPatternFields.add(referenceRangeMaximum); - classPatternFields.add(EXAMPLE_UUCM); - - int patternNid = EntityService.get().nidForPublicId(TinkarTerm.VALUE_CONSTRAINT_PATTERN); - PublicId referencedComponentPublicID = concept.publicId(); - int referencedComponentNid = EntityService.get().nidForPublicId(referencedComponentPublicID); - PublicId semantic = PublicIds.singleSemanticId(TinkarTerm.VALUE_CONSTRAINT_PATTERN, referencedComponentPublicID); - int semanticNid = EntityService.get().nidForPublicId(semantic); - UUID primordialUUID = semantic.asUuidArray()[0]; - int stampNid = EntityService.get().nidForPublicId(starterData.getAuthoringSTAMP()); - - writeSemantic(semanticNid, primordialUUID, patternNid, referencedComponentNid, stampNid, classPatternFields); - } - private void configureConnectathonPatterns() { createPresenceOfCovidPattern(); createAbsenceOfCovidPattern(); @@ -153,24 +76,7 @@ private void configureConnectathonPatterns() { } private void createInvalidCovidTestResultPattern() { - Concept invalid = Concept.make("Invalid", UuidUtil.fromSNOMED("455371000124106")); - - session.compose((ConceptAssembler conceptAssembler) -> conceptAssembler - .concept(invalid) - .attach((FullyQualifiedName fqn) -> fqn - .language(ENGLISH_LANGUAGE) - .text("Invalid") - .caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) - .attach((USDialect usDialect) -> usDialect.acceptability(TinkarTerm.PREFERRED))) - .attach((Synonym synonym) -> synonym - .text("Invalid") - .language(ENGLISH_LANGUAGE) - .caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) - .attach((USDialect usDialect) -> usDialect.acceptability(TinkarTerm.PREFERRED))) - .attach((Identifier identifier) -> identifier - .source(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER) - .identifier(invalid.asUuidArray()[0].toString())) - ); + Concept invalid = createConceptFromSnomed("Invalid", "455371000124106"); session.compose((PatternAssembler patternAssembler) -> patternAssembler .pattern(EntityProxy.Pattern.make("Invalid Covid Test Result Pattern", uuidUtility.createUUID("Invalid Covid Test Result Pattern"))) @@ -186,157 +92,158 @@ private void createInvalidCovidTestResultPattern() { } private void createUndeterminedCovidTestResultPattern() { - Concept undetermined = Concept.make("Undetermined", UuidUtil.fromSNOMED("373068000")); - starterData.concept(undetermined) - .synonym("Undetermined", TinkarTerm.PREFERRED) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, undetermined.asUuidArray()[0].toString()) - .build(); + String undeterminedResultStr = "Undetermined Covid Test Result Pattern"; - starterData.pattern(EntityProxy.Pattern.make("Undetermined Covid Test Result Pattern", uuidUtility.createUUID("Undetermined Covid Test Result Pattern"))) + Concept undetermined = createConceptFromSnomed("Undetermined", "373068000"); + session.compose((PatternAssembler patternAssembler) -> patternAssembler + .pattern(EntityProxy.Pattern.make(undeterminedResultStr, uuidUtility.createUUID(undeterminedResultStr))) .meaning(undetermined) .purpose(TinkarTerm.MEMBERSHIP_SEMANTIC) - .build(); + .attach((Synonym synonym) -> synonym + .text(undeterminedResultStr) + .language(ENGLISH_LANGUAGE) + .caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) + .attach((USDialect usDialect) -> usDialect.acceptability(TinkarTerm.PREFERRED))) + ); } private void createAbsenceOfCovidPattern() { - Concept absenceFindings = Concept.make("Absence findings", UuidUtil.fromSNOMED("272519000")); - starterData.concept(absenceFindings) - .synonym("Absence findings", TinkarTerm.PREFERRED) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, absenceFindings.asUuidArray()[0].toString()) - .build(); - - Concept absent = Concept.make("Absent", UuidUtil.fromSNOMED("2667000")); - starterData.concept(absent) - .synonym("Absent", TinkarTerm.PREFERRED) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, absent.asUuidArray()[0].toString()) - .build(); - - Concept negative = Concept.make("Negative", UuidUtil.fromSNOMED("260385009")); - starterData.concept(negative) - .synonym("Negative", TinkarTerm.PREFERRED) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, negative.asUuidArray()[0].toString()) - .build(); - - Concept notDetected = Concept.make("Not Detected", UuidUtil.fromSNOMED("260415000")); - starterData.concept(notDetected) - .synonym("Not Detected", TinkarTerm.PREFERRED) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, notDetected.asUuidArray()[0].toString()) - .build(); - - String pattern = "Absence Of Covid Pattern"; - starterData.pattern(EntityProxy.Pattern.make(pattern, uuidUtility.createUUID(pattern))) + Concept absenceFindings = createConceptFromSnomed("Absence findings", "272519000"); + Concept absent = createConceptFromSnomed("Absent", "2667000"); + Concept negative = createConceptFromSnomed("Negative", "260385009"); + Concept notDetected = createConceptFromSnomed("Not Detected", "260415000"); + + String patternStr = "Absence Of Covid Pattern"; + EntityProxy.Pattern pattern = EntityProxy.Pattern.make(patternStr, uuidUtility.createUUID(patternStr)); + session.compose((PatternAssembler patternAssembler) -> patternAssembler + .pattern(pattern) .meaning(absenceFindings) .purpose(TinkarTerm.MEMBERSHIP_SEMANTIC) - .build(); + .attach((Synonym synonym) -> synonym + .text(patternStr) + .language(ENGLISH_LANGUAGE) + .caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) + .attach((USDialect usDialect) -> usDialect.acceptability(TinkarTerm.PREFERRED))) + ); + + session.compose((SemanticAssembler semanticAssembler) -> semanticAssembler + .pattern(pattern) + .reference(absent) + .fieldValues(MutableList::newEmpty)); + + session.compose((SemanticAssembler semanticAssembler) -> semanticAssembler + .pattern(pattern) + .reference(negative) + .fieldValues(MutableList::newEmpty)); - addConceptToSemanticPatterns(absent, pattern); - addConceptToSemanticPatterns(negative, pattern); - addConceptToSemanticPatterns(notDetected, pattern); + session.compose((SemanticAssembler semanticAssembler) -> semanticAssembler + .pattern(pattern) + .reference(notDetected) + .fieldValues(MutableList::newEmpty)); } private void createPresenceOfCovidPattern() { - Concept presenceFindings = Concept.make("Presence findings", UuidUtil.fromSNOMED("260411009")); - starterData.concept(presenceFindings) - .synonym("Presence Findings", TinkarTerm.PREFERRED) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, presenceFindings.asUuidArray()[0].toString()) - .build(); - - Concept present = Concept.make("Present", UuidUtil.fromSNOMED("52101004")); - starterData.concept(present) - .synonym("Present", TinkarTerm.PREFERRED) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, present.asUuidArray()[0].toString()) - .build(); - - Concept detected = Concept.make("Detected", UuidUtil.fromSNOMED("260373001")); - starterData.concept(detected) - .synonym("Detected", TinkarTerm.PREFERRED) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, detected.asUuidArray()[0].toString()) - .build(); - - Concept positive = Concept.make("Positive", UuidUtil.fromSNOMED("10828004")); - starterData.concept(positive) - .synonym("Positive", TinkarTerm.PREFERRED) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, positive.asUuidArray()[0].toString()) - .build(); - - Concept presumptivePositive = Concept.make("Presumptive Positive", UuidUtil.fromSNOMED("720735008")); - starterData.concept(presumptivePositive) - .synonym("Presumptive Positive", TinkarTerm.PREFERRED) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, presumptivePositive.asUuidArray()[0].toString()) - .build(); - - - String pattern = "Presence of Covid Pattern"; - - starterData.pattern(EntityProxy.Pattern.make(pattern, uuidUtility.createUUID(pattern))) + Concept presenceFindings = createConceptFromSnomed("Presence findings", "260411009"); + Concept present = createConceptFromSnomed("Present", "52101004"); + Concept detected = createConceptFromSnomed("Detected", "260373001"); + Concept positive = createConceptFromSnomed("Positive", "10828004"); + Concept presumptivePositive = createConceptFromSnomed("Presumptive Positive", "720735008"); + + String patternStr = "Presence of Covid Pattern"; + EntityProxy.Pattern pattern = EntityProxy.Pattern.make(patternStr, uuidUtility.createUUID(patternStr)); + session.compose((PatternAssembler patternAssembler) -> patternAssembler + .pattern(pattern) .meaning(presenceFindings) .purpose(TinkarTerm.MEMBERSHIP_SEMANTIC) - .build(); + .attach((Synonym synonym) -> synonym + .text(patternStr) + .language(ENGLISH_LANGUAGE) + .caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) + .attach((USDialect usDialect) -> usDialect.acceptability(TinkarTerm.PREFERRED))) + ); - addConceptToSemanticPatterns(positive, pattern); - addConceptToSemanticPatterns(present, pattern); - addConceptToSemanticPatterns(detected, pattern); - addConceptToSemanticPatterns(presumptivePositive, pattern); + session.compose((SemanticAssembler semanticAssembler) -> semanticAssembler + .pattern(pattern) + .reference(positive) + .fieldValues(MutableList::newEmpty)); + + session.compose((SemanticAssembler semanticAssembler) -> semanticAssembler + .pattern(pattern) + .reference(present) + .fieldValues(MutableList::newEmpty)); + + session.compose((SemanticAssembler semanticAssembler) -> semanticAssembler + .pattern(pattern) + .reference(detected) + .fieldValues(MutableList::newEmpty)); + + session.compose((SemanticAssembler semanticAssembler) -> semanticAssembler + .pattern(pattern) + .reference(presumptivePositive) + .fieldValues(MutableList::newEmpty)); } - private void addConceptToSemanticPatterns(EntityProxy.Concept concept, String semanticPattern) { - - MutableList classPatternFields = Lists.mutable.empty(); - - UUIDUtility uuidUtility = new UUIDUtility(); - PublicId patternPublicId = PublicIds.of(uuidUtility.createUUID(semanticPattern)); - int patternNid = EntityService.get().nidForPublicId(patternPublicId); - PublicId referencedComponentPublicID = concept.publicId(); - int referencedComponentNid = EntityService.get().nidForPublicId(referencedComponentPublicID); - PublicId semantic = PublicIds.singleSemanticId(patternPublicId, referencedComponentPublicID); - int semanticNid = EntityService.get().nidForPublicId(semantic); - UUID primordialUUID = semantic.asUuidArray()[0]; - int stampNid = EntityService.get().nidForPublicId(starterData.getAuthoringSTAMP()); + private void configureValueContraintSemantics() { + Concept cdcField1 = Concept.make("CDC", UUID.nameUUIDFromBytes("LP207920-2".getBytes())); + createConcept(cdcField1, "Center For Disease Control and Prevention"); - writeSemantic(semanticNid, primordialUUID, patternNid, referencedComponentNid, stampNid, classPatternFields); + createBMISemantic("Underweight (finding)", "248342006", cdcField1, 0F, TinkarTerm.LESS_THAN, 18.5F); + createBMISemantic("Normal weight (finding)", "43664005", cdcField1, 18.5F, TinkarTerm.LESS_THAN_OR_EQUAL_TO, 24.99F); + createBMISemantic("Obese (finding)", "414915002", cdcField1, 30F, TinkarTerm.LESS_THAN, 500F); + createBMISemantic("Body mass index 30+ - obesity (finding)", "162864005", cdcField1, 30F, TinkarTerm.LESS_THAN, 500F); + createBMISemantic("Obese class I (finding) (Body mass index 30.00 to 34.99)", "443371000124107", cdcField1, 30F, TinkarTerm.LESS_THAN_OR_EQUAL_TO, 34.99F); + createBMISemantic("Obese class II (finding) ( Body mass index 35.00 to 39.99)", "443381000124105", cdcField1, 35F, TinkarTerm.LESS_THAN_OR_EQUAL_TO, 39.99F); + createBMISemantic("Body mass index 40+ - severely obese (finding)", "408512008", cdcField1, 40F, TinkarTerm.LESS_THAN, 500F); + createBMISemantic("Obese class III (finding) (Body mass index equal to or greater than 40)", "819948005", cdcField1, 40F, TinkarTerm.LESS_THAN, 500F); } - private void writeSemantic(int semanticNid, UUID primordialUUID, int patternNid, int referencedComponentNid, int stampNid, MutableList lidrRecordFields) { - //Create empty version list - RecordListBuilder versions = RecordListBuilder.make(); - - //Create Semantic Chronology - SemanticRecord semanticRecord = SemanticRecordBuilder.builder() - .nid(semanticNid) - .leastSignificantBits(primordialUUID.getLeastSignificantBits()) - .mostSignificantBits(primordialUUID.getMostSignificantBits()) - .additionalUuidLongs(null) - .patternNid(patternNid) - .referencedComponentNid(referencedComponentNid) - .versions(versions.toImmutable()) - .build(); - - //Create Semantic Version - SemanticVersionRecord semanticVersionRecord = SemanticVersionRecordBuilder.builder() - .chronology(semanticRecord) - .stampNid(stampNid) - .fieldValues(lidrRecordFields.toImmutable()) - .build(); - - versions.add(semanticVersionRecord); - - //Rebuild the Semantic with the now populated version data - SemanticEntity semanticEntity = SemanticRecordBuilder - .builder(semanticRecord) - .versions(versions.toImmutable()).build(); - EntityService.get().putEntity(semanticEntity); + private void createBMISemantic(String description, String snomedctId, Concept cdcField1, float referenceRangeMinimum, + Concept maxRefRangeOperator, float referenceRangeMaximum) { + + Concept concept = createConceptFromSnomed(description, snomedctId); + + session.compose((SemanticAssembler semanticAssembler) -> semanticAssembler + .pattern(TinkarTerm.VALUE_CONSTRAINT_PATTERN) + .reference(concept) + .fieldValues((MutableList values) -> values + .with(cdcField1) + .with(TinkarTerm.GREATER_THAN_OR_EQUAL_TO) + .with(referenceRangeMinimum) + .with(maxRefRangeOperator) + .with(referenceRangeMaximum) + .with("lb/in^2")) + ); } - private EntityProxy.Concept makeBmiConcept(String description, String snomedctId) { + private EntityProxy.Concept createConceptFromSnomed(String description, String snomedctId) { Concept concept = EntityProxy.Concept.make(description, UuidUtil.fromSNOMED(snomedctId)); - starterData.concept(concept) - .synonym(description, TinkarTerm.PREFERRED) - .identifier(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER, concept.asUuidArray()[0].toString()) - .build(); + createConcept(concept); return concept; } + private Attachable createConcept(Concept concept, String fullyQualifiedName) { + return session.compose((ConceptAssembler conceptAssembler) -> conceptAssembler + .concept(concept) + .attach((FullyQualifiedName fqn) -> fqn + .language(ENGLISH_LANGUAGE) + .text(fullyQualifiedName) + .caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) + .attach((USDialect usDialect) -> usDialect.acceptability(TinkarTerm.PREFERRED))) + .attach((Synonym synonym) -> synonym + .text(concept.description()) + .language(ENGLISH_LANGUAGE) + .caseSignificance(DESCRIPTION_NOT_CASE_SENSITIVE) + .attach((USDialect usDialect) -> usDialect.acceptability(TinkarTerm.PREFERRED))) + .attach((Identifier identifier) -> identifier + .source(TinkarTerm.UNIVERSALLY_UNIQUE_IDENTIFIER) + .identifier(concept.asUuidArray()[0].toString()))); + } + + private Attachable createConcept(Concept concept) { + return createConcept(concept, concept.description()); + } + private void exportStarterData() { ExportEntitiesController exportEntitiesController = new ExportEntitiesController(); try {