Search in sources :

Example 1 with DefaultEclSerializer

use of com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer in project snow-owl by b2ihealthcare.

the class SnomedValidationIssueDetailTest method setup.

@Before
public void setup() {
    final Index index = Indexes.createIndex(UUID.randomUUID().toString(), getMapper(), new Mappings(ValidationRule.class, ValidationIssue.class, ValidationWhiteList.class));
    repository = new ValidationRepository(index);
    ClassPathScanner scanner = new ClassPathScanner("com.b2international");
    context = TestBranchContext.on(MAIN).with(ObjectMapper.class, getMapper()).with(EclParser.class, new DefaultEclParser(INJECTOR.getInstance(IParser.class), INJECTOR.getInstance(IResourceValidator.class))).with(EclSerializer.class, new DefaultEclSerializer(INJECTOR.getInstance(ISerializer.class))).with(Index.class, rawIndex()).with(RevisionIndex.class, index()).with(ValidationThreadPool.class, new ValidationThreadPool(1, 1, 1)).with(ValidationRepository.class, repository).with(ClassPathScanner.class, scanner).with(ValidationIssueDetailExtensionProvider.class, new ValidationIssueDetailExtensionProvider(scanner)).with(ResourceURIPathResolver.class, ResourceURIPathResolver.fromMap(Map.of("SNOMEDCT", Branch.MAIN_PATH))).build();
    evaluator = new SnomedQueryValidationRuleEvaluator();
    if (!ValidationRuleEvaluator.Registry.types().contains(evaluator.type())) {
        ValidationRuleEvaluator.Registry.register(evaluator);
    }
    context.service(ValidationIssueDetailExtensionProvider.class).addExtension(new SnomedValidationIssueDetailExtension());
}
Also used : ValidationRepository(com.b2international.snowowl.core.internal.validation.ValidationRepository) RevisionIndex(com.b2international.index.revision.RevisionIndex) DefaultEclSerializer(com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer) ValidationThreadPool(com.b2international.snowowl.core.internal.validation.ValidationThreadPool) RevisionIndex(com.b2international.index.revision.RevisionIndex) Index(com.b2international.index.Index) DefaultEclSerializer(com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer) EclSerializer(com.b2international.snowowl.snomed.core.ecl.EclSerializer) ValidationIssue(com.b2international.snowowl.core.validation.issue.ValidationIssue) ValidationWhiteList(com.b2international.snowowl.core.validation.whitelist.ValidationWhiteList) ValidationRule(com.b2international.snowowl.core.validation.rule.ValidationRule) DefaultEclParser(com.b2international.snowowl.snomed.core.ecl.DefaultEclParser) Mappings(com.b2international.index.mapping.Mappings) ValidationIssueDetailExtensionProvider(com.b2international.snowowl.core.validation.issue.ValidationIssueDetailExtensionProvider) ClassPathScanner(com.b2international.snowowl.core.plugin.ClassPathScanner) SnomedValidationIssueDetailExtension(com.b2international.snowowl.snomed.validation.detail.SnomedValidationIssueDetailExtension) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ISerializer(org.eclipse.xtext.serializer.ISerializer) Before(org.junit.Before)

Example 2 with DefaultEclSerializer

use of com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer in project snow-owl by b2ihealthcare.

the class SnomedPlugin method init.

@Override
public void init(SnowOwlConfiguration configuration, Environment env) throws Exception {
    final SnomedCoreConfiguration coreConfig = configuration.getModuleConfig(SnomedCoreConfiguration.class);
    env.services().registerService(SnomedCoreConfiguration.class, coreConfig);
    final Injector injector = new EclStandaloneSetup().createInjectorAndDoEMFRegistration();
    env.services().registerService(EclParser.class, new DefaultEclParser(injector.getInstance(IParser.class), injector.getInstance(IResourceValidator.class)));
    env.services().registerService(EclSerializer.class, new DefaultEclSerializer(injector.getInstance(ISerializer.class)));
    // register SNOMED CT Query based validation rule evaluator
    ValidationRuleEvaluator.Registry.register(new SnomedQueryValidationRuleEvaluator());
}
Also used : DefaultEclParser(com.b2international.snowowl.snomed.core.ecl.DefaultEclParser) SnomedQueryValidationRuleEvaluator(com.b2international.snowowl.snomed.validation.SnomedQueryValidationRuleEvaluator) Injector(com.google.inject.Injector) EclStandaloneSetup(com.b2international.snomed.ecl.EclStandaloneSetup) DefaultEclSerializer(com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer) SnomedCoreConfiguration(com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration)

Example 3 with DefaultEclSerializer

use of com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer in project snow-owl by b2ihealthcare.

the class SnomedQueryValidationRuleEvaluatorTest method configureContext.

@Override
protected void configureContext(Builder context) {
    super.configureContext(context);
    context.with(EclParser.class, new DefaultEclParser(INJECTOR.getInstance(IParser.class), INJECTOR.getInstance(IResourceValidator.class))).with(EclSerializer.class, new DefaultEclSerializer(INJECTOR.getInstance(ISerializer.class))).with(ObjectMapper.class, getMapper());
    CodeSystemResource.configureCodeSystem(context);
    evaluator = new SnomedQueryValidationRuleEvaluator();
    if (!ValidationRuleEvaluator.Registry.types().contains(evaluator.type())) {
        ValidationRuleEvaluator.Registry.register(evaluator);
    }
}
Also used : DefaultEclParser(com.b2international.snowowl.snomed.core.ecl.DefaultEclParser) DefaultEclSerializer(com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer) DefaultEclSerializer(com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer) EclSerializer(com.b2international.snowowl.snomed.core.ecl.EclSerializer) ISerializer(org.eclipse.xtext.serializer.ISerializer)

Example 4 with DefaultEclSerializer

use of com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer in project snow-owl by b2ihealthcare.

the class BaseGenericValidationRuleTest method configureContext.

@Override
protected void configureContext(Builder context) {
    super.configureContext(context);
    final CodeSystem cs = new CodeSystem();
    cs.setBranchPath(MAIN);
    cs.setId(CODESYSTEM);
    context.with(TerminologyResource.class, cs).with(EclParser.class, new DefaultEclParser(ECL_INJECTOR.getInstance(IParser.class), ECL_INJECTOR.getInstance(IResourceValidator.class))).with(EclSerializer.class, new DefaultEclSerializer(ECL_INJECTOR.getInstance(ISerializer.class)));
}
Also used : DefaultEclParser(com.b2international.snowowl.snomed.core.ecl.DefaultEclParser) IResourceValidator(org.eclipse.xtext.validation.IResourceValidator) DefaultEclSerializer(com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer) DefaultEclParser(com.b2international.snowowl.snomed.core.ecl.DefaultEclParser) EclParser(com.b2international.snowowl.snomed.core.ecl.EclParser) CodeSystem(com.b2international.snowowl.core.codesystem.CodeSystem) IParser(org.eclipse.xtext.parser.IParser)

Aggregations

DefaultEclParser (com.b2international.snowowl.snomed.core.ecl.DefaultEclParser)4 DefaultEclSerializer (com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer)4 EclSerializer (com.b2international.snowowl.snomed.core.ecl.EclSerializer)2 ISerializer (org.eclipse.xtext.serializer.ISerializer)2 Index (com.b2international.index.Index)1 Mappings (com.b2international.index.mapping.Mappings)1 RevisionIndex (com.b2international.index.revision.RevisionIndex)1 EclStandaloneSetup (com.b2international.snomed.ecl.EclStandaloneSetup)1 CodeSystem (com.b2international.snowowl.core.codesystem.CodeSystem)1 ValidationRepository (com.b2international.snowowl.core.internal.validation.ValidationRepository)1 ValidationThreadPool (com.b2international.snowowl.core.internal.validation.ValidationThreadPool)1 ClassPathScanner (com.b2international.snowowl.core.plugin.ClassPathScanner)1 ValidationIssue (com.b2international.snowowl.core.validation.issue.ValidationIssue)1 ValidationIssueDetailExtensionProvider (com.b2international.snowowl.core.validation.issue.ValidationIssueDetailExtensionProvider)1 ValidationRule (com.b2international.snowowl.core.validation.rule.ValidationRule)1 ValidationWhiteList (com.b2international.snowowl.core.validation.whitelist.ValidationWhiteList)1 EclParser (com.b2international.snowowl.snomed.core.ecl.EclParser)1 SnomedCoreConfiguration (com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration)1 SnomedQueryValidationRuleEvaluator (com.b2international.snowowl.snomed.validation.SnomedQueryValidationRuleEvaluator)1 SnomedValidationIssueDetailExtension (com.b2international.snowowl.snomed.validation.detail.SnomedValidationIssueDetailExtension)1