diff --git a/elk-snomed-owl-el/.gitignore b/elk-snomed-owl-el/.gitignore
new file mode 100644
index 000000000..6d9594aa4
--- /dev/null
+++ b/elk-snomed-owl-el/.gitignore
@@ -0,0 +1 @@
+/logs/
diff --git a/elk-snomed-owl-el/LICENSE.txt b/elk-snomed-owl-el/LICENSE.txt
new file mode 100644
index 000000000..261eeb9e9
--- /dev/null
+++ b/elk-snomed-owl-el/LICENSE.txt
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/elk-snomed-owl-el/pom.xml b/elk-snomed-owl-el/pom.xml
new file mode 100644
index 000000000..fbd0b1e95
--- /dev/null
+++ b/elk-snomed-owl-el/pom.xml
@@ -0,0 +1,91 @@
+
+
+ 4.0.0
+
+
+ dev.ikm.elk
+ elk-parent
+ 0.36.0-SNAPSHOT
+
+
+ elk-snomed-owl-el
+
+
+ true
+ dev.ikm.snomed
+ 0.1.0
+
+
+
+
+ dev.ikm.jpms
+ antlr4-runtime
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+
+
+
+
+
+
+ org.antlr
+ antlr4-maven-plugin
+
+ true
+ true
+
+
+
+
+ antlr4
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ unpack-test-data
+ pre-integration-test
+
+ unpack
+
+
+ ${skipITs}
+
+
+ ${snomed-test-data.groupid}
+
+ snomed-test-data-intl-20241001
+ ${snomed-test-data.version}
+ zip
+
+
+
+ ${project.build.directory}/data
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+ ${skipITs}
+
+
+
+
+ integration-test
+ verify
+
+
+
+
+
+
+
diff --git a/elk-snomed-owl-el/src/main/antlr4/dev/ikm/elk/snomed/owlel/parser/SnomedOfsGrammar.g4 b/elk-snomed-owl-el/src/main/antlr4/dev/ikm/elk/snomed/owlel/parser/SnomedOfsGrammar.g4
new file mode 100644
index 000000000..27f379d5a
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/antlr4/dev/ikm/elk/snomed/owlel/parser/SnomedOfsGrammar.g4
@@ -0,0 +1,123 @@
+grammar SnomedOfsGrammar;
+
+// Grammar rules for the Snomed Owl Functional Syntax (OFS)
+
+// https://www.w3.org/TR/owl2-syntax/
+
+// Rule definitions
+
+ontologyExpression : prefixDeclaration | ontologyDeclaration | axiom ;
+
+// 3.7 https://www.w3.org/TR/owl2-syntax/#Functional-Style_Syntax
+prefixDeclaration : 'Prefix' '(' prefixName '=' fullIRI ')' ;
+ontologyDeclaration : 'Ontology' '(' iri ')' ;
+
+// 8 - https://www.w3.org/TR/owl2-syntax/#Class_Expressions
+classExpression : class | objectIntersectionOf | objectSomeValuesFrom | dataHasValue ;
+
+// 8.1.1 - https://www.w3.org/TR/owl2-syntax/#Intersection_of_Class_Expressions
+objectIntersectionOf : 'ObjectIntersectionOf' '(' classExpression classExpression+ ')' ;
+
+// 8.2.1 - https://www.w3.org/TR/owl2-syntax/#Existential_Quantification
+objectSomeValuesFrom : 'ObjectSomeValuesFrom' '(' objectPropertyExpression classExpression ')' ;
+
+// 8.4.3 - https://www.w3.org/TR/owl2-syntax/#Literal_Value_Restriction
+dataHasValue : 'DataHasValue' '(' dataPropertyExpression literal ')' ;
+
+// 9 - https://www.w3.org/TR/owl2-syntax/#Axioms
+axiom: classAxiom | objectPropertyAxiom | dataPropertyAxiom | annotationAxiom ;
+
+// 9.1 - https://www.w3.org/TR/owl2-syntax/#Class_Expression_Axioms
+classAxiom : subClassOf | equivalentClasses ;
+
+// 9.1.1 - https://www.w3.org/TR/owl2-syntax/#Subclass_Axioms
+subClassOf : 'SubClassOf' '(' classExpression classExpression ')' ;
+
+// 9.1.2 - https://www.w3.org/TR/owl2-syntax/#Equivalent_Classes
+// Note: In general this could be two or more
+equivalentClasses : 'EquivalentClasses' '(' classExpression classExpression ')' ;
+
+// 9.2 - https://www.w3.org/TR/owl2-syntax/#Object_Property_Axioms
+objectPropertyAxiom : subObjectPropertyOf | reflexiveObjectProperty | transitiveObjectProperty ;
+
+// 9.2.1 - https://www.w3.org/TR/owl2-syntax/#Object_Subproperties
+subObjectPropertyOf : 'SubObjectPropertyOf' '(' subObjectPropertyExpression objectPropertyExpression ')' ;
+subObjectPropertyExpression : objectPropertyExpression | propertyExpressionChain ;
+// Note: In general this could be two or more
+propertyExpressionChain : 'ObjectPropertyChain' '(' objectPropertyExpression objectPropertyExpression ')' ;
+
+// 9.2.9 - https://www.w3.org/TR/owl2-syntax/#Reflexive_Object_Properties
+reflexiveObjectProperty : 'ReflexiveObjectProperty' '(' objectPropertyExpression ')' ;
+
+// 9.2.13 - https://www.w3.org/TR/owl2-syntax/#Transitive_Object_Properties
+transitiveObjectProperty : 'TransitiveObjectProperty' '(' objectPropertyExpression ')' ;
+
+// 9.3 - https://www.w3.org/TR/owl2-syntax/#Data_Property_Axioms
+dataPropertyAxiom : subDataPropertyOf ;
+
+// 9.3.1 - https://www.w3.org/TR/owl2-syntax/#Data_Subproperties
+subDataPropertyOf : 'SubDataPropertyOf' '(' dataPropertyExpression dataPropertyExpression ')' ;
+
+// 10.2 - https://www.w3.org/TR/owl2-syntax/#Annotation_Axioms
+annotationAxiom : subAnnotationPropertyOf ;
+
+// 10.2.2 - https://www.w3.org/TR/owl2-syntax/#Annotation_Subproperties
+subAnnotationPropertyOf : 'SubAnnotationPropertyOf' '(' annotationProperty annotationProperty ')' ;
+
+// 5.1 - https://www.w3.org/TR/owl2-syntax/#Classes
+class : iri ;
+
+// 5.2 - https://www.w3.org/TR/owl2-syntax/#Datatypes
+datatype : iri ;
+
+// 5.3 - https://www.w3.org/TR/owl2-syntax/#Object_Properties
+objectProperty : iri ;
+
+// 5.4 - https://www.w3.org/TR/owl2-syntax/#Data_Properties
+dataProperty : iri ;
+
+// 5.5 - https://www.w3.org/TR/owl2-syntax/#Annotation_Properties
+annotationProperty : iri ;
+
+// 5.7 - https://www.w3.org/TR/owl2-syntax/#Literals
+literal : typedLiteral ;
+typedLiteral : lexicalForm '^^' datatype ;
+lexicalForm : QUOTED_STRING ;
+
+// 6.1 - https://www.w3.org/TR/owl2-syntax/#Object_Property_Expressions
+objectPropertyExpression : objectProperty ;
+
+// 6.2 -https://www.w3.org/TR/owl2-syntax/#Data_Property_Expressions
+dataPropertyExpression : dataProperty ;
+
+// 2.4 - https://www.w3.org/TR/owl2-syntax/#IRIs
+// fullIRI := an IRI as defined in [RFC3987], enclosed in a pair of < (U+3C) and > (U+3E) characters
+fullIRI : '<' fullIRI_IRI '>' ;
+fullIRI_IRI : (CHARS_SEQ | ':' | '/' | '.' | '#')+ ;
+// prefixName := a finite sequence of characters matching the PNAME_NS production of SPARQL
+prefixName : CHARS_SEQ? ':' ;
+// abbreviatedIRI := a finite sequence of characters matching the PNAME_LN production of SPARQL
+abbreviatedIRI : prefixName CHARS_SEQ;
+iri : fullIRI | abbreviatedIRI ;
+
+// Token definitions
+CHARS_SEQ : CHARS+ ;
+
+fragment CHARS : [A-Z] | [a-z] | [0-9] | '-' | '_' ;
+
+// https://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#sparqlGrammar
+// [71] PNAME_NS ::= PN_PREFIX? ':'
+// [72] PNAME_LN ::= PNAME_NS PN_LOCAL
+// [95] PN_CHARS_BASE ::= [A-Z] | [a-z] | ...
+// [96] PN_CHARS_U ::= PN_CHARS_BASE | '_'
+// [98] PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | ...
+// [99] PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)?
+// [100] PN_LOCAL ::= ( PN_CHARS_U | [0-9] ) ((PN_CHARS|'.')* PN_CHARS)?
+
+// https://www.w3.org/TR/owl2-syntax/#Integers.2C_Characters.2C_Strings.2C_Language_Tags.2C_and_Node_IDs
+// quotedString := a finite sequence of characters in which " and \ occur only in pairs of the form \" and \\, enclosed in a pair of " characters
+// https://github.com/antlr/grammars-v4/blob/master/java/java/JavaLexer.g4
+// 135 - STRING_LITERAL: '"' (~["\\\r\n] | EscapeSequence)* '"' ;
+QUOTED_STRING : '"' (~["\r\n])* '"' ;
+
+WS : [ \r\t\n]+ -> skip ;
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/OwlElObjectFactory.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/OwlElObjectFactory.java
new file mode 100644
index 000000000..161f6611f
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/OwlElObjectFactory.java
@@ -0,0 +1,64 @@
+package dev.ikm.elk.snomed.owlel;
+
+import java.util.ArrayList;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.util.HashMap;
+import java.util.List;
+
+import dev.ikm.elk.snomed.owlel.model.OwlElClass;
+import dev.ikm.elk.snomed.owlel.model.OwlElDataProperty;
+import dev.ikm.elk.snomed.owlel.model.OwlElObjectProperty;
+
+public class OwlElObjectFactory {
+
+ private final HashMap classesMap = new HashMap<>();
+
+ private final HashMap dataPropertiesMap = new HashMap<>();
+
+ private final HashMap objectPropertiesMap = new HashMap<>();
+
+ public List getClasses() {
+ return new ArrayList<>(classesMap.values());
+ }
+
+ public List getDataProperties() {
+ return new ArrayList<>(dataPropertiesMap.values());
+ }
+
+ public List getObjectProperties() {
+ return new ArrayList<>(objectPropertiesMap.values());
+ }
+
+ public OwlElClass getOwlElClass(String iri) {
+ return classesMap.computeIfAbsent(iri, OwlElClass::new);
+ }
+
+ public OwlElDataProperty getOwlElDataProperty(String iri) {
+ return dataPropertiesMap.computeIfAbsent(iri, OwlElDataProperty::new);
+ }
+
+ public OwlElObjectProperty getOwlElObjectProperty(String iri) {
+ return objectPropertiesMap.computeIfAbsent(iri, OwlElObjectProperty::new);
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/OwlElOntology.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/OwlElOntology.java
new file mode 100644
index 000000000..bf1fd57c6
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/OwlElOntology.java
@@ -0,0 +1,83 @@
+package dev.ikm.elk.snomed.owlel;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+
+import dev.ikm.elk.snomed.owlel.model.OwlElAxiom;
+import dev.ikm.elk.snomed.owlel.model.OwlElClass;
+import dev.ikm.elk.snomed.owlel.model.OwlElDataProperty;
+import dev.ikm.elk.snomed.owlel.model.OwlElObject;
+import dev.ikm.elk.snomed.owlel.model.OwlElObjectProperty;
+import dev.ikm.elk.snomed.owlel.model.OwlElOntologyDeclaration;
+import dev.ikm.elk.snomed.owlel.model.OwlElPrefixDeclaration;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsParser;
+
+public class OwlElOntology {
+
+ private OwlElObjectFactory factory = new OwlElObjectFactory();
+
+ private String iri = "Undefined";
+
+ private ArrayList axioms = new ArrayList<>();
+
+ public List getClasses() {
+ return factory.getClasses();
+ }
+
+ public List getDataProperties() {
+ return factory.getDataProperties();
+ }
+
+ public List getObjectProperties() {
+ return factory.getObjectProperties();
+ }
+
+ public String getIri() {
+ return iri;
+ }
+
+ public ArrayList getAxioms() {
+ return axioms;
+ }
+
+ public List getAxioms(Class clazz) {
+ return axioms.stream().filter(clazz::isInstance).map(clazz::cast).toList();
+ }
+
+ public void load(Path file) throws IOException {
+ for (String expr : SnomedOwlExpressions.read(file)) {
+ SnomedOfsParser parser = new SnomedOfsParser(factory);
+ OwlElObject obj = parser.buildExpression(expr);
+ switch (obj) {
+ case OwlElOntologyDeclaration x -> iri = x.getIri();
+ case OwlElPrefixDeclaration x -> {
+ }
+ case OwlElAxiom x -> axioms.add(x);
+ default -> throw new IllegalArgumentException("Unexpected value: " + obj);
+ }
+ }
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/SnomedOwlExpressions.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/SnomedOwlExpressions.java
new file mode 100644
index 000000000..a5219c636
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/SnomedOwlExpressions.java
@@ -0,0 +1,50 @@
+package dev.ikm.elk.snomed.owlel;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class SnomedOwlExpressions {
+
+// public static Stream stream(Path file) throws IOException {
+// // id effectiveTime active moduleId refsetId referencedComponentId owlExpression
+// return Files.lines(file).skip(1).map(line -> line.split("\\t")) //
+// .filter(fields -> Integer.parseInt(fields[2]) == 1) // active
+// .map(fields -> fields[6]);
+// }
+
+ public static List read(Path file) throws IOException {
+ // id effectiveTime active moduleId refsetId referencedComponentId owlExpression
+ try (Stream st = Files.lines(file)) {
+ return st.skip(1).map(line -> line.split("\\t")) //
+ .filter(fields -> Integer.parseInt(fields[2]) == 1) // active
+ .map(fields -> fields[6]) //
+ .collect(Collectors.toCollection(ArrayList::new));
+ }
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/IriString.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/IriString.java
new file mode 100644
index 000000000..0fe2372c0
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/IriString.java
@@ -0,0 +1,36 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class IriString extends OwlElObject {
+
+ private String iri;
+
+ public String getIri() {
+ return iri;
+ }
+
+ public IriString(String iri) {
+ super();
+ this.iri = iri;
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElAnnotationProperty.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElAnnotationProperty.java
new file mode 100644
index 000000000..225d49f2f
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElAnnotationProperty.java
@@ -0,0 +1,41 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElAnnotationProperty extends OwlElObject {
+
+ private String iri;
+
+ public String getIri() {
+ return iri;
+ }
+
+ public OwlElAnnotationProperty(String iri) {
+ super();
+ this.iri = iri;
+ }
+
+ @Override
+ public String toString() {
+ return iri;
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElAxiom.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElAxiom.java
new file mode 100644
index 000000000..0f73f3a39
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElAxiom.java
@@ -0,0 +1,25 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public abstract class OwlElAxiom extends OwlElObject {
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElClass.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElClass.java
new file mode 100644
index 000000000..496d706d4
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElClass.java
@@ -0,0 +1,41 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElClass extends OwlElClassExpression {
+
+ private String iri;
+
+ public String getIri() {
+ return iri;
+ }
+
+ public OwlElClass(String iri) {
+ super();
+ this.iri = iri;
+ }
+
+ @Override
+ public String toString() {
+ return iri;
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElClassAxiom.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElClassAxiom.java
new file mode 100644
index 000000000..01f1ae124
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElClassAxiom.java
@@ -0,0 +1,25 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public abstract class OwlElClassAxiom extends OwlElAxiom {
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElClassExpression.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElClassExpression.java
new file mode 100644
index 000000000..5b72e4071
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElClassExpression.java
@@ -0,0 +1,25 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public abstract class OwlElClassExpression extends OwlElObject {
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElDataHasValue.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElDataHasValue.java
new file mode 100644
index 000000000..56959e2df
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElDataHasValue.java
@@ -0,0 +1,48 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElDataHasValue extends OwlElClassExpression {
+
+ private OwlElDataPropertyExpression dataPropertyExpression;
+
+ private OwlElTypedLiteral value;
+
+ public OwlElDataPropertyExpression getProperty() {
+ return dataPropertyExpression;
+ }
+
+ public OwlElTypedLiteral getFiller() {
+ return value;
+ }
+
+ public OwlElDataHasValue(OwlElDataPropertyExpression dataPropertyExpression, OwlElTypedLiteral value) {
+ super();
+ this.dataPropertyExpression = dataPropertyExpression;
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "DataHasValue(" + dataPropertyExpression + " " + value + ")";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElDataProperty.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElDataProperty.java
new file mode 100644
index 000000000..42d0a8ffc
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElDataProperty.java
@@ -0,0 +1,41 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElDataProperty extends OwlElDataPropertyExpression {
+
+ private String iri;
+
+ public String getIri() {
+ return iri;
+ }
+
+ public OwlElDataProperty(String iri) {
+ super();
+ this.iri = iri;
+ }
+
+ @Override
+ public String toString() {
+ return iri;
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElDataPropertyExpression.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElDataPropertyExpression.java
new file mode 100644
index 000000000..811c01466
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElDataPropertyExpression.java
@@ -0,0 +1,25 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public abstract class OwlElDataPropertyExpression extends OwlElObject {
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElEquivalentClasses.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElEquivalentClasses.java
new file mode 100644
index 000000000..4da2630f8
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElEquivalentClasses.java
@@ -0,0 +1,48 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElEquivalentClasses extends OwlElClassAxiom {
+
+ private OwlElClassExpression expression1;
+
+ private OwlElClassExpression expression2;
+
+ public OwlElClassExpression getExpression1() {
+ return expression1;
+ }
+
+ public OwlElClassExpression getExpression2() {
+ return expression2;
+ }
+
+ public OwlElEquivalentClasses(OwlElClassExpression expression1, OwlElClassExpression expression2) {
+ super();
+ this.expression1 = expression1;
+ this.expression2 = expression2;
+ }
+
+ @Override
+ public String toString() {
+ return "EquivalentClasses(" + expression1 + " " + expression2 + ")";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObject.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObject.java
new file mode 100644
index 000000000..c7b94539a
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObject.java
@@ -0,0 +1,25 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public abstract class OwlElObject {
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectIntersectionOf.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectIntersectionOf.java
new file mode 100644
index 000000000..aa13fab05
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectIntersectionOf.java
@@ -0,0 +1,45 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class OwlElObjectIntersectionOf extends OwlElClassExpression {
+
+ private List expressions;
+
+ public List getExpressions() {
+ return expressions;
+ }
+
+ public OwlElObjectIntersectionOf(List expressions) {
+ super();
+ this.expressions = expressions;
+ }
+
+ @Override
+ public String toString() {
+ return "ObjectIntersectionOf(" + expressions.stream().map(Object::toString).collect(Collectors.joining(" "))
+ + ")";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectProperty.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectProperty.java
new file mode 100644
index 000000000..2cda2b009
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectProperty.java
@@ -0,0 +1,41 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElObjectProperty extends OwlElObjectPropertyExpression {
+
+ private String iri;
+
+ public String getIri() {
+ return iri;
+ }
+
+ public OwlElObjectProperty(String iri) {
+ super();
+ this.iri = iri;
+ }
+
+ @Override
+ public String toString() {
+ return iri;
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectPropertyChain.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectPropertyChain.java
new file mode 100644
index 000000000..df9547145
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectPropertyChain.java
@@ -0,0 +1,49 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElObjectPropertyChain extends OwlElObjectPropertyExpression {
+
+ private OwlElObjectPropertyExpression expression1;
+
+ private OwlElObjectPropertyExpression expression2;
+
+ public OwlElObjectPropertyExpression getExpression1() {
+ return expression1;
+ }
+
+ public OwlElObjectPropertyExpression getExpression2() {
+ return expression2;
+ }
+
+ public OwlElObjectPropertyChain(OwlElObjectPropertyExpression expression1,
+ OwlElObjectPropertyExpression expression2) {
+ super();
+ this.expression1 = expression1;
+ this.expression2 = expression2;
+ }
+
+ @Override
+ public String toString() {
+ return "ObjectPropertyChain(" + expression1 + " " + expression2 + ")";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectPropertyExpression.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectPropertyExpression.java
new file mode 100644
index 000000000..a773c6544
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectPropertyExpression.java
@@ -0,0 +1,25 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public abstract class OwlElObjectPropertyExpression extends OwlElObject {
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectSomeValuesFrom.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectSomeValuesFrom.java
new file mode 100644
index 000000000..51ace4ec2
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElObjectSomeValuesFrom.java
@@ -0,0 +1,49 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElObjectSomeValuesFrom extends OwlElClassExpression {
+
+ private OwlElObjectPropertyExpression objectPropertyExpression;
+
+ private OwlElClassExpression classExpression;
+
+ public OwlElObjectPropertyExpression getProperty() {
+ return objectPropertyExpression;
+ }
+
+ public OwlElClassExpression getFiller() {
+ return classExpression;
+ }
+
+ public OwlElObjectSomeValuesFrom(OwlElObjectPropertyExpression objectPropertyExpression,
+ OwlElClassExpression classExpression) {
+ super();
+ this.objectPropertyExpression = objectPropertyExpression;
+ this.classExpression = classExpression;
+ }
+
+ @Override
+ public String toString() {
+ return "ObjectSomeValuesFrom(" + objectPropertyExpression + " " + classExpression + ")";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElOntologyDeclaration.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElOntologyDeclaration.java
new file mode 100644
index 000000000..96620e943
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElOntologyDeclaration.java
@@ -0,0 +1,41 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElOntologyDeclaration extends OwlElObject {
+
+ private String iri;
+
+ public String getIri() {
+ return iri;
+ }
+
+ public OwlElOntologyDeclaration(String iri) {
+ super();
+ this.iri = iri;
+ }
+
+ @Override
+ public String toString() {
+ return "Ontology(<" + iri + ">)";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElPrefixDeclaration.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElPrefixDeclaration.java
new file mode 100644
index 000000000..51a33ae54
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElPrefixDeclaration.java
@@ -0,0 +1,48 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElPrefixDeclaration extends OwlElObject {
+
+ private String prefixName;
+
+ private String iri;
+
+ public String getPrefixName() {
+ return prefixName;
+ }
+
+ public String getIri() {
+ return iri;
+ }
+
+ public OwlElPrefixDeclaration(String prefixName, String iri) {
+ super();
+ this.prefixName = prefixName;
+ this.iri = iri;
+ }
+
+ @Override
+ public String toString() {
+ return "Prefix(" + prefixName + "=<" + iri + ">)";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElReflexiveObjectProperty.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElReflexiveObjectProperty.java
new file mode 100644
index 000000000..006456755
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElReflexiveObjectProperty.java
@@ -0,0 +1,41 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElReflexiveObjectProperty extends OwlElAxiom {
+
+ private OwlElObjectPropertyExpression propertyExpression;
+
+ public OwlElObjectPropertyExpression getProperty() {
+ return propertyExpression;
+ }
+
+ public OwlElReflexiveObjectProperty(OwlElObjectPropertyExpression propertyExpression) {
+ super();
+ this.propertyExpression = propertyExpression;
+ }
+
+ @Override
+ public String toString() {
+ return "ReflexiveObjectProperty(" + propertyExpression + ")";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubAnnotationPropertyOf.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubAnnotationPropertyOf.java
new file mode 100644
index 000000000..69547e452
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubAnnotationPropertyOf.java
@@ -0,0 +1,41 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElSubAnnotationPropertyOf extends OwlElAxiom {
+
+ private OwlElAnnotationProperty subPropertyExpression;
+
+ private OwlElAnnotationProperty superPropertyExpression;
+
+ public OwlElSubAnnotationPropertyOf(OwlElAnnotationProperty subPropertyExpression,
+ OwlElAnnotationProperty superPropertyExpression) {
+ super();
+ this.subPropertyExpression = subPropertyExpression;
+ this.superPropertyExpression = superPropertyExpression;
+ }
+
+ @Override
+ public String toString() {
+ return "SubAnnotationPropertyOf(" + subPropertyExpression + " " + superPropertyExpression + ")";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubClassOf.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubClassOf.java
new file mode 100644
index 000000000..05c4f7eb4
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubClassOf.java
@@ -0,0 +1,48 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElSubClassOf extends OwlElClassAxiom {
+
+ private OwlElClassExpression subClassExpression;
+
+ private OwlElClassExpression superClassExpression;
+
+ public OwlElClassExpression getSubClass() {
+ return subClassExpression;
+ }
+
+ public OwlElClassExpression getSuperClass() {
+ return superClassExpression;
+ }
+
+ public OwlElSubClassOf(OwlElClassExpression subClassExpression, OwlElClassExpression superClassExpression) {
+ super();
+ this.subClassExpression = subClassExpression;
+ this.superClassExpression = superClassExpression;
+ }
+
+ @Override
+ public String toString() {
+ return "SubClassOf(" + subClassExpression + " " + superClassExpression + ")";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubDataPropertyOf.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubDataPropertyOf.java
new file mode 100644
index 000000000..9d0e51e74
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubDataPropertyOf.java
@@ -0,0 +1,49 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElSubDataPropertyOf extends OwlElAxiom {
+
+ private OwlElDataPropertyExpression subPropertyExpression;
+
+ private OwlElDataPropertyExpression superPropertyExpression;
+
+ public OwlElDataPropertyExpression getSubProperty() {
+ return subPropertyExpression;
+ }
+
+ public OwlElDataPropertyExpression getSuperProperty() {
+ return superPropertyExpression;
+ }
+
+ public OwlElSubDataPropertyOf(OwlElDataPropertyExpression subPropertyExpression,
+ OwlElDataPropertyExpression superPropertyExpression) {
+ super();
+ this.subPropertyExpression = subPropertyExpression;
+ this.superPropertyExpression = superPropertyExpression;
+ }
+
+ @Override
+ public String toString() {
+ return "SubDataPropertyOf(" + subPropertyExpression + " " + superPropertyExpression + ")";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubObjectPropertyOf.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubObjectPropertyOf.java
new file mode 100644
index 000000000..06bd0013b
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElSubObjectPropertyOf.java
@@ -0,0 +1,49 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElSubObjectPropertyOf extends OwlElAxiom {
+
+ private OwlElObjectPropertyExpression subPropertyExpression;
+
+ private OwlElObjectPropertyExpression superPropertyExpression;
+
+ public OwlElObjectPropertyExpression getSubProperty() {
+ return subPropertyExpression;
+ }
+
+ public OwlElObjectPropertyExpression getSuperProperty() {
+ return superPropertyExpression;
+ }
+
+ public OwlElSubObjectPropertyOf(OwlElObjectPropertyExpression subPropertyExpression,
+ OwlElObjectPropertyExpression superPropertyExpression) {
+ super();
+ this.subPropertyExpression = subPropertyExpression;
+ this.superPropertyExpression = superPropertyExpression;
+ }
+
+ @Override
+ public String toString() {
+ return "SubObjectPropertyOf(" + subPropertyExpression + " " + superPropertyExpression + ")";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElTransitiveObjectProperty.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElTransitiveObjectProperty.java
new file mode 100644
index 000000000..24a53a376
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElTransitiveObjectProperty.java
@@ -0,0 +1,41 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElTransitiveObjectProperty extends OwlElAxiom {
+
+ private OwlElObjectPropertyExpression propertyExpression;
+
+ public OwlElObjectPropertyExpression getProperty() {
+ return propertyExpression;
+ }
+
+ public OwlElTransitiveObjectProperty(OwlElObjectPropertyExpression propertyExpression) {
+ super();
+ this.propertyExpression = propertyExpression;
+ }
+
+ @Override
+ public String toString() {
+ return "TransitiveObjectProperty(" + propertyExpression + ")";
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElTypedLiteral.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElTypedLiteral.java
new file mode 100644
index 000000000..12aa901d9
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/model/OwlElTypedLiteral.java
@@ -0,0 +1,48 @@
+package dev.ikm.elk.snomed.owlel.model;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+public class OwlElTypedLiteral extends OwlElObject {
+
+ private String lexicalForm;
+
+ private String datatype;
+
+ public String getLiteral() {
+ return lexicalForm;
+ }
+
+ public String getDatatype() {
+ return datatype;
+ }
+
+ public OwlElTypedLiteral(String lexicalForm, String datatype) {
+ super();
+ this.lexicalForm = lexicalForm.replaceFirst("^\"", "").replaceFirst("\"$", "");
+ this.datatype = datatype;
+ }
+
+ @Override
+ public String toString() {
+ return "\"" + lexicalForm + "\"" + "^^" + datatype;
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/parser/SnomedOfsParser.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/parser/SnomedOfsParser.java
new file mode 100644
index 000000000..8cf01506e
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/parser/SnomedOfsParser.java
@@ -0,0 +1,85 @@
+package dev.ikm.elk.snomed.owlel.parser;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import org.antlr.v4.runtime.BaseErrorListener;
+import org.antlr.v4.runtime.CharStreams;
+import org.antlr.v4.runtime.CommonTokenStream;
+import org.antlr.v4.runtime.RecognitionException;
+import org.antlr.v4.runtime.Recognizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import dev.ikm.elk.snomed.owlel.OwlElObjectFactory;
+import dev.ikm.elk.snomed.owlel.model.OwlElObject;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.OntologyExpressionContext;
+
+public class SnomedOfsParser {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SnomedOfsParser.class);
+
+ private OwlElObjectFactory factory;
+
+ private SnomedOfsGrammarParser parser;
+
+ private RecognitionException syntaxError;
+
+ public RecognitionException getSyntaxError() {
+ return syntaxError;
+ }
+
+ public SnomedOfsParser(OwlElObjectFactory factory) {
+ super();
+ this.factory = factory;
+ }
+
+ public OntologyExpressionContext parseStatement(String input) {
+ SnomedOfsGrammarLexer lexer = new SnomedOfsGrammarLexer(CharStreams.fromString(input));
+ parser = new SnomedOfsGrammarParser(new CommonTokenStream(lexer));
+ parser.addErrorListener(new BaseErrorListener() {
+ @Override
+ public void syntaxError(Recognizer, ?> recognizer, Object offendingSymbol, int line,
+ int charPositionInLine, String msg, RecognitionException e) {
+ LOG.error("Input: " + input);
+ LOG.error("At " + charPositionInLine + " " + msg);
+ LOG.error("");
+ syntaxError = e;
+ }
+ });
+ OntologyExpressionContext context = parser.ontologyExpression();
+ return context;
+ }
+
+ public OwlElObject buildExpression(OntologyExpressionContext context) {
+ SnomedOfsVisitor visitor = new SnomedOfsVisitor(factory);
+ OwlElObject expr = visitor.visit(context);
+ return expr;
+ }
+
+ public OwlElObject buildExpression(String input) {
+ return buildExpression(parseStatement(input));
+ }
+
+ public String toStringTree(OntologyExpressionContext context) {
+ return context.toStringTree(parser);
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/parser/SnomedOfsVisitor.java b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/parser/SnomedOfsVisitor.java
new file mode 100644
index 000000000..312663f6e
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/dev/ikm/elk/snomed/owlel/parser/SnomedOfsVisitor.java
@@ -0,0 +1,271 @@
+package dev.ikm.elk.snomed.owlel.parser;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import dev.ikm.elk.snomed.owlel.OwlElObjectFactory;
+import dev.ikm.elk.snomed.owlel.model.IriString;
+import dev.ikm.elk.snomed.owlel.model.OwlElAnnotationProperty;
+import dev.ikm.elk.snomed.owlel.model.OwlElClassExpression;
+import dev.ikm.elk.snomed.owlel.model.OwlElDataHasValue;
+import dev.ikm.elk.snomed.owlel.model.OwlElDataPropertyExpression;
+import dev.ikm.elk.snomed.owlel.model.OwlElEquivalentClasses;
+import dev.ikm.elk.snomed.owlel.model.OwlElObject;
+import dev.ikm.elk.snomed.owlel.model.OwlElObjectIntersectionOf;
+import dev.ikm.elk.snomed.owlel.model.OwlElObjectPropertyChain;
+import dev.ikm.elk.snomed.owlel.model.OwlElObjectPropertyExpression;
+import dev.ikm.elk.snomed.owlel.model.OwlElObjectSomeValuesFrom;
+import dev.ikm.elk.snomed.owlel.model.OwlElOntologyDeclaration;
+import dev.ikm.elk.snomed.owlel.model.OwlElPrefixDeclaration;
+import dev.ikm.elk.snomed.owlel.model.OwlElReflexiveObjectProperty;
+import dev.ikm.elk.snomed.owlel.model.OwlElSubAnnotationPropertyOf;
+import dev.ikm.elk.snomed.owlel.model.OwlElSubClassOf;
+import dev.ikm.elk.snomed.owlel.model.OwlElSubDataPropertyOf;
+import dev.ikm.elk.snomed.owlel.model.OwlElSubObjectPropertyOf;
+import dev.ikm.elk.snomed.owlel.model.OwlElTransitiveObjectProperty;
+import dev.ikm.elk.snomed.owlel.model.OwlElTypedLiteral;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.AbbreviatedIRIContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.AnnotationPropertyContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.ClassContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.DataHasValueContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.DataPropertyContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.EquivalentClassesContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.FullIRIContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.IriContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.ObjectIntersectionOfContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.ObjectPropertyContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.ObjectSomeValuesFromContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.OntologyDeclarationContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.PrefixDeclarationContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.PropertyExpressionChainContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.ReflexiveObjectPropertyContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.SubAnnotationPropertyOfContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.SubClassOfContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.SubDataPropertyOfContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.SubObjectPropertyOfContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.TransitiveObjectPropertyContext;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.TypedLiteralContext;
+
+public class SnomedOfsVisitor extends SnomedOfsGrammarBaseVisitor {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SnomedOfsVisitor.class);
+
+ private final static boolean log_visit = false;
+
+ private OwlElObjectFactory factory;
+
+ public SnomedOfsVisitor(OwlElObjectFactory factory) {
+ super();
+ this.factory = factory;
+ }
+
+ @Override
+ public OwlElObject visitPrefixDeclaration(PrefixDeclarationContext context) {
+ if (log_visit)
+ LOG.info("visitPrefixDeclaration: " + context.getText());
+ String prefix_name = context.prefixName().getText();
+ IriString iri = (IriString) context.fullIRI().accept(this);
+ return new OwlElPrefixDeclaration(prefix_name, iri.getIri());
+ }
+
+ @Override
+ public OwlElObject visitOntologyDeclaration(OntologyDeclarationContext context) {
+ if (log_visit)
+ LOG.info("visitOntologyDeclaration: " + context.getText());
+ IriString iri = (IriString) context.iri().accept(this);
+ return new OwlElOntologyDeclaration(iri.getIri());
+ }
+
+ @Override
+ public OwlElObject visitObjectIntersectionOf(ObjectIntersectionOfContext context) {
+ if (log_visit)
+ LOG.info("visitObjectIntersectionOf: " + context.getText());
+ List exprs = context.classExpression().stream()
+ .map(class_expr_context -> (OwlElClassExpression) class_expr_context.accept(this)).toList();
+ return new OwlElObjectIntersectionOf(exprs);
+ }
+
+ @Override
+ public OwlElObject visitObjectSomeValuesFrom(ObjectSomeValuesFromContext context) {
+ if (log_visit)
+ LOG.info("visitObjectSomeValuesFrom: " + context.getText());
+ OwlElObjectPropertyExpression prop_expr = (OwlElObjectPropertyExpression) context.objectPropertyExpression()
+ .accept(this);
+ OwlElClassExpression class_expr = (OwlElClassExpression) context.classExpression().accept(this);
+ return new OwlElObjectSomeValuesFrom(prop_expr, class_expr);
+ }
+
+ @Override
+ public OwlElObject visitDataHasValue(DataHasValueContext context) {
+ if (log_visit)
+ LOG.info("visitDataHasValue: " + context.getText());
+ OwlElDataPropertyExpression prop_expr = (OwlElDataPropertyExpression) context.dataPropertyExpression()
+ .accept(this);
+ OwlElTypedLiteral class_expr = (OwlElTypedLiteral) context.literal().accept(this);
+ return new OwlElDataHasValue(prop_expr, class_expr);
+ }
+
+ @Override
+ public OwlElObject visitSubClassOf(SubClassOfContext context) {
+ if (log_visit)
+ LOG.info("visitSubClassOf: " + context.getText());
+ OwlElClassExpression expr1 = (OwlElClassExpression) context.classExpression(0).accept(this);
+ OwlElClassExpression expr2 = (OwlElClassExpression) context.classExpression(1).accept(this);
+ return new OwlElSubClassOf(expr1, expr2);
+ }
+
+ @Override
+ public OwlElObject visitEquivalentClasses(EquivalentClassesContext context) {
+ if (log_visit)
+ LOG.info("visitEquivalentClasses: " + context.getText());
+ OwlElClassExpression expr1 = (OwlElClassExpression) context.classExpression(0).accept(this);
+ OwlElClassExpression expr2 = (OwlElClassExpression) context.classExpression(1).accept(this);
+ return new OwlElEquivalentClasses(expr1, expr2);
+ }
+
+ @Override
+ public OwlElObject visitSubObjectPropertyOf(SubObjectPropertyOfContext context) {
+ if (log_visit)
+ LOG.info("visitSubObjectPropertyOf: " + context.getText());
+ OwlElObjectPropertyExpression expr1 = (OwlElObjectPropertyExpression) context.subObjectPropertyExpression()
+ .accept(this);
+ OwlElObjectPropertyExpression expr2 = (OwlElObjectPropertyExpression) context.objectPropertyExpression()
+ .accept(this);
+ return new OwlElSubObjectPropertyOf(expr1, expr2);
+ }
+
+ @Override
+ public OwlElObject visitPropertyExpressionChain(PropertyExpressionChainContext context) {
+ if (log_visit)
+ LOG.info("visitPropertyExpressionChain: " + context.getText());
+ OwlElObjectPropertyExpression expr1 = (OwlElObjectPropertyExpression) context.objectPropertyExpression(0)
+ .accept(this);
+ OwlElObjectPropertyExpression expr2 = (OwlElObjectPropertyExpression) context.objectPropertyExpression(1)
+ .accept(this);
+ return new OwlElObjectPropertyChain(expr1, expr2);
+ }
+
+ @Override
+ public OwlElObject visitReflexiveObjectProperty(ReflexiveObjectPropertyContext context) {
+ if (log_visit)
+ LOG.info("visitReflexiveObjectProperty: " + context.getText());
+ OwlElObjectPropertyExpression expr1 = (OwlElObjectPropertyExpression) context.objectPropertyExpression()
+ .accept(this);
+ return new OwlElReflexiveObjectProperty(expr1);
+ }
+
+ @Override
+ public OwlElObject visitTransitiveObjectProperty(TransitiveObjectPropertyContext context) {
+ if (log_visit)
+ LOG.info("visitTransitiveObjectProperty: " + context.getText());
+ OwlElObjectPropertyExpression expr1 = (OwlElObjectPropertyExpression) context.objectPropertyExpression()
+ .accept(this);
+ return new OwlElTransitiveObjectProperty(expr1);
+ }
+
+ @Override
+ public OwlElObject visitSubDataPropertyOf(SubDataPropertyOfContext context) {
+ if (log_visit)
+ LOG.info("visitSubDataPropertyOf: " + context.getText());
+ OwlElDataPropertyExpression expr1 = (OwlElDataPropertyExpression) context.dataPropertyExpression(0)
+ .accept(this);
+ OwlElDataPropertyExpression expr2 = (OwlElDataPropertyExpression) context.dataPropertyExpression(1)
+ .accept(this);
+ return new OwlElSubDataPropertyOf(expr1, expr2);
+ }
+
+ @Override
+ public OwlElObject visitSubAnnotationPropertyOf(SubAnnotationPropertyOfContext context) {
+ if (log_visit)
+ LOG.info("visitSubAnnotationPropertyOf: " + context.getText());
+ OwlElAnnotationProperty expr1 = (OwlElAnnotationProperty) context.annotationProperty(0).accept(this);
+ OwlElAnnotationProperty expr2 = (OwlElAnnotationProperty) context.annotationProperty(1).accept(this);
+ return new OwlElSubAnnotationPropertyOf(expr1, expr2);
+ }
+
+ @Override
+ public OwlElObject visitClass(ClassContext context) {
+ if (log_visit)
+ LOG.info("visitClass: " + context.getText());
+ IriString iri = (IriString) context.iri().accept(this);
+ return factory.getOwlElClass(iri.getIri());
+ }
+
+ @Override
+ public OwlElObject visitObjectProperty(ObjectPropertyContext context) {
+ if (log_visit)
+ LOG.info("visitObjectProperty: " + context.getText());
+ IriString iri = (IriString) context.iri().accept(this);
+ return factory.getOwlElObjectProperty(iri.getIri());
+ }
+
+ @Override
+ public OwlElObject visitDataProperty(DataPropertyContext context) {
+ if (log_visit)
+ LOG.info("visitDataProperty: " + context.getText());
+ IriString iri = (IriString) context.iri().accept(this);
+ return factory.getOwlElDataProperty(iri.getIri());
+ }
+
+ @Override
+ public OwlElObject visitAnnotationProperty(AnnotationPropertyContext context) {
+ if (log_visit)
+ LOG.info("visitAnnotationProperty: " + context.getText());
+ IriString iri = (IriString) context.iri().accept(this);
+ return new OwlElAnnotationProperty(iri.getIri());
+ }
+
+ @Override
+ public OwlElObject visitTypedLiteral(TypedLiteralContext context) {
+ if (log_visit)
+ LOG.info("visitTypedLiteral: " + context.getText());
+ String lexical_form = context.lexicalForm().getText();
+ String datatype = context.datatype().getText();
+ return new OwlElTypedLiteral(lexical_form, datatype);
+ }
+
+ @Override
+ public OwlElObject visitFullIRI(FullIRIContext context) {
+ if (log_visit)
+ LOG.info("visitFullIRI: " + context.getText());
+ String str = context.fullIRI_IRI().getText();
+ return new IriString(str);
+ }
+
+ @Override
+ public OwlElObject visitAbbreviatedIRI(AbbreviatedIRIContext context) {
+ if (log_visit)
+ LOG.info("visitAbbreviatedIRI: " + context.getText());
+ return new IriString(context.getText());
+ }
+
+ @Override
+ public OwlElObject visitIri(IriContext context) {
+ if (log_visit)
+ LOG.info("visitIri: " + context.getText());
+ return super.visitChildren(context);
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/main/java/module-info.java b/elk-snomed-owl-el/src/main/java/module-info.java
new file mode 100644
index 000000000..9a8f698c5
--- /dev/null
+++ b/elk-snomed-owl-el/src/main/java/module-info.java
@@ -0,0 +1,29 @@
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+open module dev.ikm.elk.snomed.owlel{
+
+ requires org.slf4j;
+ requires dev.ikm.jpms.antlr4.runtime;
+
+ exports dev.ikm.elk.snomed.owlel;
+ exports dev.ikm.elk.snomed.owlel.model;
+ exports dev.ikm.elk.snomed.owlel.parser;
+
+}
diff --git a/elk-snomed-owl-el/src/test/java/dev/ikm/elk/snomed/owlel/parser/OwlElOntologyTestIT.java b/elk-snomed-owl-el/src/test/java/dev/ikm/elk/snomed/owlel/parser/OwlElOntologyTestIT.java
new file mode 100644
index 000000000..bf368a490
--- /dev/null
+++ b/elk-snomed-owl-el/src/test/java/dev/ikm/elk/snomed/owlel/parser/OwlElOntologyTestIT.java
@@ -0,0 +1,45 @@
+package dev.ikm.elk.snomed.owlel.parser;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.IOException;
+
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import dev.ikm.elk.snomed.owlel.OwlElOntology;
+
+public class OwlElOntologyTestIT {
+
+ private static final Logger LOG = LoggerFactory.getLogger(OwlElOntologyTestIT.class);
+
+ @Test
+ public void load() throws IOException {
+ OwlElOntology ontology = new OwlElOntology();
+ ontology.load(SnomedOfsParserTestIT.file);
+ assertEquals("http://snomed.info/sct/900000000000207008", ontology.getIri());
+ assertEquals(369438, ontology.getAxioms().size());
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/test/java/dev/ikm/elk/snomed/owlel/parser/SnomedOfsParserTestIT.java b/elk-snomed-owl-el/src/test/java/dev/ikm/elk/snomed/owlel/parser/SnomedOfsParserTestIT.java
new file mode 100644
index 000000000..7edc70a56
--- /dev/null
+++ b/elk-snomed-owl-el/src/test/java/dev/ikm/elk/snomed/owlel/parser/SnomedOfsParserTestIT.java
@@ -0,0 +1,179 @@
+package dev.ikm.elk.snomed.owlel.parser;
+
+/*-
+ * #%L
+ * elk-snomed-owl-el
+ * %%
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import dev.ikm.elk.snomed.owlel.OwlElObjectFactory;
+import dev.ikm.elk.snomed.owlel.SnomedOwlExpressions;
+import dev.ikm.elk.snomed.owlel.model.OwlElObject;
+import dev.ikm.elk.snomed.owlel.parser.SnomedOfsGrammarParser.OntologyExpressionContext;
+
+public class SnomedOfsParserTestIT {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SnomedOfsParserTestIT.class);
+
+ public static Path file = Paths.get("target/data", "snomed-test-data-intl-20241001",
+ "sct2_sRefset_OWLExpressionSnapshot_INT_20241001.txt");
+
+ private List getExpressions(String regex) throws IOException {
+ return SnomedOwlExpressions.read(file).stream().filter(expr -> expr.matches(regex)).toList();
+ }
+
+ public int parse(List exprs) throws Exception {
+ return parse(exprs, false);
+ }
+
+ public int parse(List exprs, boolean log_parse) throws Exception {
+ int miss_cnt = 0;
+ for (String expr : exprs) {
+ SnomedOfsParser parser = new SnomedOfsParser(new OwlElObjectFactory());
+ OntologyExpressionContext context = parser.parseStatement(expr);
+ OwlElObject obj = parser.buildExpression(context);
+ if (log_parse) {
+ LOG.info("Stmt: " + expr);
+ LOG.info(" " + parser.toStringTree(context));
+ LOG.info(" " + parser.buildExpression(context));
+ }
+ if (obj == null || !expr.equals(obj.toString())) {
+ LOG.error("Expect: " + expr);
+ LOG.error("Actual: " + obj);
+ miss_cnt++;
+ }
+ assertNull(context.exception);
+ assertNull(parser.getSyntaxError());
+ }
+ return miss_cnt;
+ }
+
+ @Test
+ public void syntaxError() throws Exception {
+ String expr = "SubClassOf )";
+ SnomedOfsParser parser = new SnomedOfsParser(new OwlElObjectFactory());
+ OntologyExpressionContext context = parser.parseStatement(expr);
+ assertNotNull(parser.getSyntaxError());
+ LOG.info("Stmt: " + expr);
+ LOG.info(" " + parser.toStringTree(context));
+ }
+
+ @Test
+ public void subClassOf() throws Exception {
+ List exprs = List.of("SubClassOf(:1 :2)");
+ assertEquals(1, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void equivalentClasses() throws Exception {
+ List exprs = List.of("EquivalentClasses(:1 :2)");
+ assertEquals(1, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void subObjectPropertyOf() throws Exception {
+ List exprs = List.of("SubObjectPropertyOf(:1 :2)");
+ assertEquals(1, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void subDataPropertyOf() throws Exception {
+ List exprs = List.of("SubDataPropertyOf(:1 :2)");
+ assertEquals(1, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void subAnnotationPropertyOf() throws Exception {
+ List exprs = List.of("SubAnnotationPropertyOf(:1 :2)");
+ assertEquals(1, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void objectIntersectionOf() throws Exception {
+ List exprs = List.of("SubClassOf(:1 ObjectIntersectionOf(:2 :3))");
+ assertEquals(1, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void objectSomeValuesFrom() throws Exception {
+ List exprs = List.of("SubClassOf(:1 ObjectIntersectionOf(:2 ObjectSomeValuesFrom(:3 :4)))");
+ assertEquals(1, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void dataHasValue() throws Exception {
+ List exprs = List.of("SubClassOf(:1 ObjectIntersectionOf(:2 DataHasValue(:3 \"1.1\"^^xsd:decimal)))");
+ assertEquals(1, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void allOntologyDecl() throws Exception {
+ List exprs = getExpressions("^Ontology.+");
+ assertEquals(1, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void allPrefixDecl() throws Exception {
+ List exprs = getExpressions("^Prefix.+");
+ assertEquals(6, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void allObjectProperty() throws Exception {
+ List exprs = getExpressions("^.*ObjectProperty.+");
+ assertEquals(136, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void allDataProperty() throws Exception {
+ List exprs = getExpressions("^.*DataProperty.+");
+ assertEquals(10, exprs.size());
+ assertEquals(0, parse(exprs));
+ }
+
+ @Test
+ public void all() throws Exception {
+ List exprs = getExpressions(".+");
+ assertEquals(369445, exprs.size());
+ assertEquals(0, parse(exprs, false));
+ }
+
+}
diff --git a/elk-snomed-owl-el/src/test/resources/log4j2-test.properties b/elk-snomed-owl-el/src/test/resources/log4j2-test.properties
new file mode 100644
index 000000000..78c0e32c8
--- /dev/null
+++ b/elk-snomed-owl-el/src/test/resources/log4j2-test.properties
@@ -0,0 +1,17 @@
+# Set root logger level to INFO and log to console and file
+rootLogger = INFO, console, log
+
+# Console is a ConsoleAppender
+appender.console.type = Console
+appender.console.name = console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{ABSOLUTE} [%-6p] %40.40c - %m%n
+
+# File is a FileAppender
+appender.file.type = File
+appender.file.name = log
+appender.file.fileName = logs/log.txt
+appender.file.append = false
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d{ABSOLUTE} [%-6p] %40.40c - %m%n
+
diff --git a/elk-snomed-owl/src/main/java/dev/ikm/elk/snomed/owl/SnomedOwlOntology.java b/elk-snomed-owl/src/main/java/dev/ikm/elk/snomed/owl/SnomedOwlOntology.java
index 743f07078..b860d8a3d 100644
--- a/elk-snomed-owl/src/main/java/dev/ikm/elk/snomed/owl/SnomedOwlOntology.java
+++ b/elk-snomed-owl/src/main/java/dev/ikm/elk/snomed/owl/SnomedOwlOntology.java
@@ -62,10 +62,13 @@ public class SnomedOwlOntology {
private static final Logger LOG = LoggerFactory.getLogger(SnomedOwlOntology.class);
+ @Deprecated
public static final long root = SnomedIds.root;
+ @Deprecated
public static final long isa = SnomedIds.isa;
+ @Deprecated
public static final long role_group = SnomedIds.role_group;
private OWLOntology ontology;
@@ -187,7 +190,7 @@ public Set getOwlClasses() {
public Set getOwlObjectProperties() {
return ontology.getObjectPropertiesInSignature();
}
-
+
public Set getOwlDataProperties() {
return ontology.getDataPropertiesInSignature();
}
@@ -203,7 +206,7 @@ public static long getId(OWLObjectProperty prop) {
public OWLObjectProperty getOwlObjectProperty(long id) {
return objectPropertyMap.get(id);
}
-
+
public static long getId(OWLDataProperty prop) {
return Long.parseLong(prop.getIRI().getShortForm());
}
@@ -221,7 +224,7 @@ public void removeAxioms(Set axioms) {
OWLOntologyManager mgr = getOntologyManager();
mgr.removeAxioms(ontology, axioms);
}
-
+
public void loadOntology(Set axioms) {
addAxioms(axioms);
initMaps();
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/NecessaryNormalFormTest.java b/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/NecessaryNormalFormTest.java
index f3c289cfe..52ef55b7e 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/NecessaryNormalFormTest.java
+++ b/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/NecessaryNormalFormTest.java
@@ -38,6 +38,7 @@
import dev.ikm.elk.snomed.model.Concept;
import dev.ikm.elk.snomed.model.Definition;
import dev.ikm.elk.snomed.model.RoleGroup;
+import dev.ikm.elk.snomed.owl.SnomedOwlOntology;
public class NecessaryNormalFormTest {
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormTst.java b/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormTst.java
deleted file mode 100644
index b993f355d..000000000
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormTst.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package dev.ikm.elk.snomed.owl;
-
-/*-
- * #%L
- * ELK Integration with SNOMED
- * %%
- * Copyright (C) 2023 Integrated Knowledge Management
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-import java.nio.file.Paths;
-
-import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import dev.ikm.elk.snomed.ConceptComparer;
-import dev.ikm.elk.snomed.NecessaryNormalFormBuilder;
-import dev.ikm.elk.snomed.SnomedOntology;
-import dev.ikm.elk.snomed.SnomedRoles;
-
-public class SnomedNecessaryNormalFormTst extends SnomedTestBase {
-
- private static final Logger LOG = LoggerFactory.getLogger(SnomedNecessaryNormalFormTst.class);
-
- @Test
- public void init() throws Exception {
- SnomedOwlOntology ontology = SnomedOwlOntology.createOntology();
- ontology.loadOntology(axioms_file);
- ontology.classify();
- LOG.info("Classify complete");
- SnomedOntology snomedOntology = new OwlTransformer().transform(ontology);
- NecessaryNormalFormBuilder nnfb = NecessaryNormalFormBuilder.create(snomedOntology,
- ontology.getSuperClasses(), ontology.getSuperObjectProperties(false));
- assertEquals(361331, nnfb.getConcepts().size());
- LOG.info("Init complete");
- NecessaryNormalFormTest.checkPriors(ontology, nnfb);
-// SnomedRoles roles = SnomedRoles.init(rels_file);
- SnomedRoles roles = SnomedRoles.init(Paths.get("nnf-data", "nnf-20231121.txt"));
- ConceptComparer cc = new ConceptComparer(roles, null);
- nnfb.generate(cc);
-// write(nnfb);
- }
-
-// private void write(NecessaryNormalFormBuilder nnfb) throws Exception {
-// // id effectiveTime active moduleId sourceId destinationId relationshipGroup
-// // typeId characteristicTypeId modifierId
-// PrintWriter out = new PrintWriter(Files.newBufferedWriter(Paths.get("nnf.txt")));
-// out.println("id" + "\t" + "effectiveTime" + "\t" + "active" + "\t" + "moduleId" + "\t" + "sourceId" + "\t"
-// + "destinationId" + "\t" + "relationshipGroup" + "\t" + "typeId" + "\t" + "characteristicTypeId" + "\t"
-// + "modifierId");
-// String active = "1";
-// for (Entry es : nnfb.getNecessaryNormalForm().entrySet()) {
-// long sourceId = SnomedOwlOntology.getId(es.getKey());
-// ArrayList> props = new ArrayList<>();
-// props.add(es.getValue().getUngroupedProps());
-// props.addAll(es.getValue().getGroupedProps());
-//// if (!es.getValue().getUngroupedProps().isEmpty() && !es.getValue().getGroupedProps().isEmpty())
-//// LOG.info("Ungrouped and grouped (props): " + sourceId);
-// int relationshipGroup = 0;
-// for (Set group : props) {
-// for (OWLObjectSomeValuesFrom prop : group) {
-// OWLObjectProperty property = prop.getProperty().asOWLObjectProperty();
-// OWLClass filler = prop.getFiller().asOWLClass();
-// long destinationId = SnomedOwlOntology.getId(filler);
-// long typeId = SnomedOwlOntology.getId(property);
-// out.println("-1\t-2\t" + active + "\t-4\t" + sourceId + "\t" + destinationId + "\t"
-// + relationshipGroup + "\t" + typeId + "\t" + "-9\t-10");
-// }
-// relationshipGroup++;
-// }
-// }
-// out.close();
-// }
-
-}
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerTestIT.java b/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerTestIT.java
deleted file mode 100644
index e35555a28..000000000
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerTestIT.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package dev.ikm.elk.snomed.owl;
-
-/*-
- * #%L
- * ELK Integration with SNOMED
- * %%
- * Copyright (C) 2023 Integrated Knowledge Management
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import dev.ikm.elk.snomed.SnomedIds;
-import dev.ikm.elk.snomed.SnomedIsa;
-import dev.ikm.elk.snomed.SnomedOntology;
-import dev.ikm.elk.snomed.SnomedOntologyReasoner;
-import dev.ikm.elk.snomed.model.Concept;
-import dev.ikm.elk.snomed.model.RoleType;
-
-public class SnomedOntologyReasonerTestIT extends SnomedNecessaryNormalFormTestBase {
- private static final Logger LOG = LoggerFactory.getLogger(SnomedOntologyReasonerTestIT.class);
-
- protected String getVersion() {
- return "20190731";
- }
-
- @Test
- public void classify() throws Exception {
- SnomedOwlOntology ontology = SnomedOwlOntology.createOntology();
- ontology.loadOntology(axioms_file);
- SnomedOntology snomedOntology = new OwlTransformer().transform(ontology);
- SnomedOntologyReasoner sor = SnomedOntologyReasoner.create(snomedOntology);
- for (RoleType rt : snomedOntology.getRoleTypes()) {
- if (!rt.getSuperRoleTypes().stream().map(RoleType::getId).toList().equals(List.of(762705008l))) {
- LOG.info("" + rt);
- rt.getSuperRoleTypes().forEach(sup -> LOG.info("\tSup 1: " + sup));
- sor.getSuperObjectProperties(rt).forEach(sup -> LOG.info("\tSup 2: " + sup));
- }
- if (rt.isTransitive())
- LOG.info("Transitive: " + rt);
- if (rt.getChained() != null)
- LOG.info("Chained: " + rt + " " + rt.getChained());
- if (rt.isReflexive())
- LOG.info("Reflexive: " + rt);
- }
- {
- ArrayList misses = new ArrayList<>();
- int miss_cnt = 0;
- SnomedIsa isas = SnomedIsa.init(rels_file);
- for (Long id : isas.getOrderedConcepts()) {
- Concept con = snomedOntology.getConcept(id);
- if (isas.hasAncestor(id, SnomedIds.concept_model_object_attribute))
- continue;
- if (con == null) {
- LOG.info("Skipping: " + id);
- continue;
- }
- Set sups = sor.getSuperClasses(con).stream()
- .map(cl -> Long.parseLong(cl.getIri().toString().substring(1)))
- .collect(Collectors.toCollection(HashSet::new));
- Set parents = isas.getParents(id);
- if (id == SnomedIds.root) {
- assertTrue(parents.isEmpty());
- } else {
- assertNotNull(parents);
- }
- if (!parents.equals(sups)) {
- misses.add(id);
- miss_cnt++;
- LOG.info("Miss: " + con);
- HashSet extra = new HashSet(sups);
- extra.removeAll(parents);
- for (long x : extra) {
- LOG.info("\tExtra: " + x);
- }
- HashSet missing = new HashSet(parents);
- missing.removeAll(sups);
- for (long x : missing) {
- LOG.info("\tMissing: " + x);
- }
- }
- }
- LOG.info("Miss: " + miss_cnt);
- assertEquals(0, miss_cnt);
- }
- }
-
-}
diff --git a/elk-snomed/pom.xml b/elk-snomed/pom.xml
index 6d13ccde7..200d446c8 100644
--- a/elk-snomed/pom.xml
+++ b/elk-snomed/pom.xml
@@ -12,6 +12,12 @@
ELK Integration with SNOMED
+
+ true
+ dev.ikm.snomed
+ 0.1.0
+
+
${project.groupId}
@@ -21,9 +27,123 @@
${project.groupId}
elk-snomed-reasoner
+
+ ${project.groupId}
+ elk-snomed-owl-el
+
org.junit.jupiter
junit-jupiter-api
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ unpack-test-data
+ pre-integration-test
+
+ unpack
+
+
+ ${skipITs}
+
+
+ ${snomed-test-data.groupid}
+
+ snomed-test-data-intl-20190731
+ ${snomed-test-data.version}
+ zip
+
+
+ ${snomed-test-data.groupid}
+
+ snomed-test-data-intl-20200131
+ ${snomed-test-data.version}
+ zip
+
+
+ ${snomed-test-data.groupid}
+
+ snomed-test-data-intl-20200731
+ ${snomed-test-data.version}
+ zip
+
+
+ ${snomed-test-data.groupid}
+
+ snomed-test-data-intl-20210131
+ ${snomed-test-data.version}
+ zip
+
+
+ ${snomed-test-data.groupid}
+
+ snomed-test-data-intl-20230630
+ ${snomed-test-data.version}
+ zip
+
+
+ ${snomed-test-data.groupid}
+
+ snomed-test-data-us-20210301
+ ${snomed-test-data.version}
+ zip
+
+
+ ${snomed-test-data.groupid}
+
+ snomed-test-data-us-20230301
+ ${snomed-test-data.version}
+ zip
+
+
+ ${snomed-test-data.groupid}
+
+ snomed-test-data-us-20230901
+ ${snomed-test-data.version}
+ zip
+
+
+ ${snomed-test-data.groupid}
+
+ snomed-test-data-us-20240301
+ ${snomed-test-data.version}
+ zip
+
+
+ ${snomed-test-data.groupid}
+
+ snomed-test-data-us-20240901
+ ${snomed-test-data.version}
+ zip
+
+
+
+ ${project.build.directory}/data
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
+ ${skipITs}
+
+
+
+
+ integration-test
+ verify
+
+
+
+
+
+
diff --git a/elk-snomed/src/main/java/dev/ikm/elk/snomed/OwlElTransformer.java b/elk-snomed/src/main/java/dev/ikm/elk/snomed/OwlElTransformer.java
new file mode 100644
index 000000000..87391d62c
--- /dev/null
+++ b/elk-snomed/src/main/java/dev/ikm/elk/snomed/OwlElTransformer.java
@@ -0,0 +1,283 @@
+package dev.ikm.elk.snomed;
+
+/*-
+ * #%L
+ * ELK Integration with SNOMED using OWL API
+ * %%
+ * Copyright (C) 2023 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import dev.ikm.elk.snomed.model.Concept;
+import dev.ikm.elk.snomed.model.ConcreteRole;
+import dev.ikm.elk.snomed.model.ConcreteRoleType;
+import dev.ikm.elk.snomed.model.Definition;
+import dev.ikm.elk.snomed.model.DefinitionType;
+import dev.ikm.elk.snomed.model.Role;
+import dev.ikm.elk.snomed.model.RoleGroup;
+import dev.ikm.elk.snomed.model.RoleType;
+import dev.ikm.elk.snomed.owlel.OwlElOntology;
+import dev.ikm.elk.snomed.owlel.model.OwlElClass;
+import dev.ikm.elk.snomed.owlel.model.OwlElClassExpression;
+import dev.ikm.elk.snomed.owlel.model.OwlElDataHasValue;
+import dev.ikm.elk.snomed.owlel.model.OwlElDataProperty;
+import dev.ikm.elk.snomed.owlel.model.OwlElEquivalentClasses;
+import dev.ikm.elk.snomed.owlel.model.OwlElObjectIntersectionOf;
+import dev.ikm.elk.snomed.owlel.model.OwlElObjectProperty;
+import dev.ikm.elk.snomed.owlel.model.OwlElObjectPropertyChain;
+import dev.ikm.elk.snomed.owlel.model.OwlElObjectSomeValuesFrom;
+import dev.ikm.elk.snomed.owlel.model.OwlElReflexiveObjectProperty;
+import dev.ikm.elk.snomed.owlel.model.OwlElSubClassOf;
+import dev.ikm.elk.snomed.owlel.model.OwlElSubDataPropertyOf;
+import dev.ikm.elk.snomed.owlel.model.OwlElSubObjectPropertyOf;
+import dev.ikm.elk.snomed.owlel.model.OwlElTransitiveObjectProperty;
+import dev.ikm.elk.snomed.owlel.model.OwlElTypedLiteral;
+
+public class OwlElTransformer {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(OwlElTransformer.class);
+
+ HashMap concepts = new HashMap<>();
+
+ HashMap roleTypes = new HashMap<>();
+
+ HashMap dataPropertyTypes = new HashMap<>();
+
+ private static long toLong(String iri) {
+ return Long.parseLong(iri.replaceFirst("^.*:", ""));
+ }
+
+ public static long getId(OwlElClass clazz) {
+ return toLong(clazz.getIri());
+ }
+
+ public static long getId(OwlElDataProperty prop) {
+ return toLong(prop.getIri());
+ }
+
+ public static long getId(OwlElObjectProperty prop) {
+ return toLong(prop.getIri());
+ }
+
+ private Concept getConcept(OwlElClass clazz) {
+ long id = getId(clazz);
+ concepts.putIfAbsent(clazz, new Concept(id));
+ return concepts.get(clazz);
+ }
+
+ private RoleType getRoleType(OwlElObjectProperty prop) {
+ long id = getId(prop);
+ roleTypes.putIfAbsent(prop, new RoleType(id));
+ return roleTypes.get(prop);
+ }
+
+ private ConcreteRoleType getConcreteRoleType(OwlElDataProperty prop) {
+ long id = getId(prop);
+ dataPropertyTypes.putIfAbsent(prop, new ConcreteRoleType(id));
+ return dataPropertyTypes.get(prop);
+ }
+
+ public SnomedOntology transform(OwlElOntology ontology) {
+ for (OwlElObjectProperty prop : ontology.getObjectProperties()) {
+ getRoleType(prop);
+ }
+ for (OwlElSubObjectPropertyOf ax : ontology.getAxioms(OwlElSubObjectPropertyOf.class)) {
+ if (ax.getSubProperty() instanceof OwlElObjectPropertyChain) {
+ OwlElObjectPropertyChain chain = (OwlElObjectPropertyChain) ax.getSubProperty();
+ OwlElObjectProperty prop1 = (OwlElObjectProperty) chain.getExpression1();
+ OwlElObjectProperty prop2 = (OwlElObjectProperty) chain.getExpression2();
+ OwlElObjectProperty sup = (OwlElObjectProperty) ax.getSuperProperty();
+ if (!prop1.equals(sup))
+ throw new UnsupportedOperationException("Unexpected: " + ax);
+ if (getRoleType(prop1).getChained() != null)
+ throw new UnsupportedOperationException(
+ "Two chains for: " + prop1 + " " + ax + " " + getRoleType(prop1).getChained());
+ getRoleType(prop1).setChained(getRoleType(prop2));
+ } else {
+ OwlElObjectProperty sub = (OwlElObjectProperty) ax.getSubProperty();
+ OwlElObjectProperty sup = (OwlElObjectProperty) ax.getSuperProperty();
+ getRoleType(sub).addSuperRoleType(getRoleType(sup));
+ }
+ }
+ for (OwlElTransitiveObjectProperty ax : ontology.getAxioms(OwlElTransitiveObjectProperty.class)) {
+ OwlElObjectProperty prop = (OwlElObjectProperty) ax.getProperty();
+ getRoleType(prop).setTransitive(true);
+ }
+ for (OwlElReflexiveObjectProperty ax : ontology.getAxioms(OwlElReflexiveObjectProperty.class)) {
+ OwlElObjectProperty prop = (OwlElObjectProperty) ax.getProperty();
+ getRoleType(prop).setReflexive(true);
+ }
+ for (OwlElDataProperty prop : ontology.getDataProperties()) {
+ getConcreteRoleType(prop);
+ }
+ for (OwlElSubDataPropertyOf ax : ontology.getAxioms(OwlElSubDataPropertyOf.class)) {
+ OwlElDataProperty sub = (OwlElDataProperty) ax.getSubProperty();
+ OwlElDataProperty sup = (OwlElDataProperty) ax.getSuperProperty();
+ getConcreteRoleType(sub).addSuperConcreteRoleType(getConcreteRoleType(sup));
+ }
+ for (OwlElEquivalentClasses ax : ontology.getAxioms(OwlElEquivalentClasses.class)) {
+ OwlElClass clazz = (OwlElClass) ax.getExpression1();
+ Concept concept = getConcept(clazz);
+ Definition def = new Definition();
+ def.setDefinitionType(DefinitionType.EquivalentConcept);
+ concept.addDefinition(def);
+ processClassExpression(def, ax.getExpression2());
+ }
+ for (OwlElSubClassOf ax : ontology.getAxioms(OwlElSubClassOf.class)) {
+ if (ax.getSubClass() instanceof OwlElClass) {
+ OwlElClass clazz = (OwlElClass) ax.getSubClass();
+ Concept concept = getConcept(clazz);
+ Definition def = new Definition();
+ def.setDefinitionType(DefinitionType.SubConcept);
+ concept.addDefinition(def);
+ processClassExpression(def, ax.getSuperClass());
+ } else {
+ // GCI
+ OwlElClass clazz = (OwlElClass) ax.getSuperClass();
+ Concept concept = getConcept(clazz);
+ Definition def = new Definition();
+ def.setDefinitionType(DefinitionType.SubConcept);
+ concept.addGciDefinition(def);
+ processClassExpression(def, ax.getSubClass());
+ }
+ }
+ return new SnomedOntology(concepts.values(), roleTypes.values(), dataPropertyTypes.values());
+ }
+
+// private Definition createDefinition(OwlElClass concept, OwlElClassAxiom axiom, boolean isGci) {
+// Definition def = new Definition();
+// switch (axiom) {
+// case OwlElEquivalentClasses x -> def.setDefinitionType(DefinitionType.EquivalentConcept);
+// case OwlElSubClassOf x -> def.setDefinitionType(DefinitionType.SubConcept);
+// default -> throw new UnsupportedOperationException("Unexpected: " + axiom);
+// }
+// processAxiom(def, concept, axiom, isGci);
+// return def;
+// }
+
+// private void processAxiom(Definition def, OwlElClass concept, OwlElClassAxiom axiom, boolean isGci) {
+// switch (axiom) {
+// case OwlElEquivalentClasses x -> {
+// if (isGci)
+// throw new UnsupportedOperationException("Unexpected: GCI for " + axiom);
+// OwlElClassExpression expr = x.getExpression2();
+// processClassExpression(def, expr);
+// }
+// case OwlElSubClassOf x -> {
+// OwlElClassExpression expr = (isGci ? x.getSubClass() : x.getSuperClass());
+// processClassExpression(def, expr);
+// }
+// default -> throw new UnsupportedOperationException("Unexpected: " + axiom);
+// }
+// }
+
+ private void processClassExpression(Definition def, OwlElClassExpression class_expr) {
+ switch (class_expr) {
+ case OwlElClass x -> {
+ Concept sup = getConcept(x);
+ def.addSuperConcept(sup);
+ }
+ case OwlElObjectIntersectionOf x -> processIntersection(def, x.getExpressions());
+ default -> throw new UnsupportedOperationException("Unexpected: " + class_expr);
+ }
+ }
+
+ private void processIntersection(Definition def, List class_exprs) {
+ for (OwlElClassExpression class_expr : class_exprs) {
+ switch (class_expr) {
+ case OwlElClass clazz -> {
+ Concept sup = getConcept(clazz);
+ def.addSuperConcept(sup);
+ }
+ case OwlElObjectSomeValuesFrom svf -> {
+ if (getId((OwlElObjectProperty) svf.getProperty()) == SnomedIds.role_group) {
+ processRoleGroup(def, svf.getFiller());
+ } else {
+ Role role = makeRole(svf);
+ def.addUngroupedRole(role);
+ }
+ }
+ case OwlElDataHasValue dhv -> {
+ ConcreteRole data_property = makeDataProperty(dhv);
+ def.addUngroupedConcreteRole(data_property);
+ }
+ default -> throw new UnsupportedOperationException("Unexpected: " + class_expr);
+ }
+ }
+ }
+
+ private Role makeRole(OwlElObjectSomeValuesFrom svf) {
+ RoleType roleType = getRoleType((OwlElObjectProperty) svf.getProperty());
+ Concept concept = getConcept((OwlElClass) svf.getFiller());
+ return new Role(roleType, concept);
+ }
+
+ private ConcreteRole makeDataProperty(OwlElDataHasValue dhv) {
+ ConcreteRoleType dataPropertyType = getConcreteRoleType((OwlElDataProperty) dhv.getProperty());
+ OwlElTypedLiteral value = dhv.getFiller();
+ String datatype = value.getDatatype();
+ ConcreteRole.ValueType value_type = switch (datatype) {
+ case "xsd:integer" -> ConcreteRole.ValueType.Integer;
+ case "xsd:decimal" -> ConcreteRole.ValueType.Decimal;
+ default -> throw new UnsupportedOperationException("Unexpected value: " + datatype);
+ };
+ return new ConcreteRole(dataPropertyType, value.getLiteral(), value_type);
+ }
+
+ private void processRole(RoleGroup rg, OwlElObjectSomeValuesFrom svf) {
+ Role role = makeRole(svf);
+ rg.addRole(role);
+ }
+
+ private void processRoleGroup(Definition def, OwlElClassExpression class_expr) {
+ switch (class_expr) {
+ case OwlElObjectSomeValuesFrom svf -> {
+ RoleGroup rg = new RoleGroup();
+ def.addRoleGroup(rg);
+ processRole(rg, svf);
+ }
+ // TODO Should add data property, but this never happens, yet...
+ case OwlElObjectIntersectionOf x -> {
+ processRoleGroup(def, x.getExpressions());
+ }
+ default -> throw new UnsupportedOperationException("Unexpected: " + class_expr);
+ }
+ }
+
+ private void processRoleGroup(Definition def, List class_exprs) {
+ RoleGroup rg = new RoleGroup();
+ def.addRoleGroup(rg);
+ for (OwlElClassExpression class_expr : class_exprs) {
+ switch (class_expr) {
+ case OwlElObjectSomeValuesFrom svf -> {
+ processRole(rg, svf);
+ }
+ case OwlElDataHasValue dhv -> {
+ ConcreteRole data_property = makeDataProperty(dhv);
+ rg.addConcreteRole(data_property);
+ }
+ default -> throw new UnsupportedOperationException("Unexpected: " + class_expr);
+ }
+ }
+ }
+
+}
diff --git a/elk-snomed/src/main/java/module-info.java b/elk-snomed/src/main/java/module-info.java
index a1bf7a1ad..b29640aaa 100644
--- a/elk-snomed/src/main/java/module-info.java
+++ b/elk-snomed/src/main/java/module-info.java
@@ -24,6 +24,7 @@
requires org.semanticweb.elk.owl.model;
requires org.semanticweb.elk.reasoner;
+ requires dev.ikm.elk.snomed.owlel;
requires dev.ikm.elk.snomed.reasoner;
exports dev.ikm.elk.snomed;
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20190731TestIT.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20190731TestIT.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20190731TestIT.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20190731TestIT.java
index f5d12c630..328451a67 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20190731TestIT.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20190731TestIT.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20200131TestIT.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20200131TestIT.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20200131TestIT.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20200131TestIT.java
index 7d6c1063a..bc7a94872 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20200131TestIT.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20200131TestIT.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20200731TestIT.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20200731TestIT.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20200731TestIT.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20200731TestIT.java
index a8e1d9dd8..9c0f30956 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20200731TestIT.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20200731TestIT.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20210131TestIT.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20210131TestIT.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20210131TestIT.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20210131TestIT.java
index c900e530e..6e80d5784 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternational20210131TestIT.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternational20210131TestIT.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternationalTestBase.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternationalTestBase.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternationalTestBase.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternationalTestBase.java
index 14e31910f..1d02cec14 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormInternationalTestBase.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormInternationalTestBase.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormTestBase.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormTestBase.java
similarity index 61%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormTestBase.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormTestBase.java
index 1ae2f2f7a..ecd7c3446 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormTestBase.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormTestBase.java
@@ -1,10 +1,10 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
* ELK Integration with SNOMED
* %%
- * Copyright (C) 2023 Integrated Knowledge Management
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,61 +20,51 @@
* #L%
*/
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.HashSet;
+
import org.junit.jupiter.api.Test;
-import org.semanticweb.owlapi.model.OWLAxiom;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import dev.ikm.elk.snomed.ConceptComparer;
-import dev.ikm.elk.snomed.NecessaryNormalFormBuilder;
-import dev.ikm.elk.snomed.SnomedConcreteRoles;
-import dev.ikm.elk.snomed.SnomedOntology;
-import dev.ikm.elk.snomed.SnomedOntologyReasoner;
-import dev.ikm.elk.snomed.SnomedRoles;
+import dev.ikm.elk.snomed.model.Concept;
+import dev.ikm.elk.snomed.owlel.OwlElOntology;
public abstract class SnomedNecessaryNormalFormTestBase extends SnomedTestBase {
private static final Logger LOG = LoggerFactory.getLogger(SnomedNecessaryNormalFormTestBase.class);
+ public static void checkPriors(SnomedOntologyReasoner ontology, NecessaryNormalFormBuilder nnf) {
+ HashSet priors = new HashSet<>();
+ for (Concept con : nnf.getConcepts()) {
+ for (Long sup : ontology.getSuperConcepts(con.getId())) {
+ assertTrue(priors.contains(sup));
+ }
+ priors.add(con.getId());
+ }
+ }
+
@Test
public void checkPriors() throws Exception {
- SnomedOwlOntology ontology = SnomedOwlOntology.createOntology();
- ontology.loadOntology(axioms_file);
- ontology.classify();
- SnomedOntology snomedOntology = new OwlTransformer().transform(ontology);
+ OwlElOntology ontology = new OwlElOntology();
+ ontology.load(axioms_file);
+// ontology.classify();
+ SnomedOntology snomedOntology = new OwlElTransformer().transform(ontology);
SnomedOntologyReasoner snomedOntologyReasoner = SnomedOntologyReasoner.create(snomedOntology);
snomedOntologyReasoner.flush();
NecessaryNormalFormBuilder nnfb = NecessaryNormalFormBuilder.create(snomedOntology,
snomedOntologyReasoner.getSuperConcepts(), snomedOntologyReasoner.getSuperRoleTypes(false));
- NecessaryNormalFormTest.checkPriors(ontology, nnfb);
+ checkPriors(snomedOntologyReasoner, nnfb);
}
public NecessaryNormalFormBuilder generate() throws Exception {
- SnomedOwlOntology ontology = SnomedOwlOntology.createOntology();
- ontology.loadOntology(axioms_file);
+ OwlElOntology ontology = new OwlElOntology();
+ ontology.load(axioms_file);
+
LOG.info("Load complete");
//
- for (OWLAxiom ax : ontology.getOntology().getAxioms()) {
- switch (ax.getAxiomType().getName()) {
- case "SubClassOf" -> {
- }
- case "EquivalentClasses" -> {
- }
- case "SubObjectPropertyOf" -> {
- }
- case "SubPropertyChainOf" -> {
- }
- case "TransitiveObjectProperty" -> {
- }
- case "ReflexiveObjectProperty" -> {
- }
- case "SubDataPropertyOf" -> {
- }
- default -> throw new UnsupportedOperationException("Unexpected: " + ax + " " + ax.getAxiomType());
- }
- }
- //
- SnomedOntology snomedOntology = new OwlTransformer().transform(ontology);
+ SnomedOntology snomedOntology = new OwlElTransformer().transform(ontology);
SnomedOntologyReasoner snomedOntologyReasoner = SnomedOntologyReasoner.create(snomedOntology);
snomedOntologyReasoner.flush();
NecessaryNormalFormBuilder nnfb = NecessaryNormalFormBuilder.create(snomedOntology,
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormUs20240301TestIT.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormUs20240301TestIT.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormUs20240301TestIT.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormUs20240301TestIT.java
index f6cc36f3b..1e4841885 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormUs20240301TestIT.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormUs20240301TestIT.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormUsTestBase.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormUsTestBase.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormUsTestBase.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormUsTestBase.java
index 1e13a9fb8..cd0958a91 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedNecessaryNormalFormUsTestBase.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedNecessaryNormalFormUsTestBase.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20190731TestIT.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20190731TestIT.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20190731TestIT.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20190731TestIT.java
index 65b60a334..dc0390798 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20190731TestIT.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20190731TestIT.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20200131TestIT.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20200131TestIT.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20200131TestIT.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20200131TestIT.java
index 0343480e1..d9d685f96 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20200131TestIT.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20200131TestIT.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20200731TestIT.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20200731TestIT.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20200731TestIT.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20200731TestIT.java
index 1f5f7d788..3ac3ff9a9 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20200731TestIT.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20200731TestIT.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20210131TestIT.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20210131TestIT.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20210131TestIT.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20210131TestIT.java
index d7672bbcf..5abdbc9a5 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternational20210131TestIT.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternational20210131TestIT.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternationalTestBase.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternationalTestBase.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternationalTestBase.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternationalTestBase.java
index c3816b7d0..4f9bd06c2 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerInternationalTestBase.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerInternationalTestBase.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerTestBase.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerTestBase.java
similarity index 88%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerTestBase.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerTestBase.java
index 289c38bd9..31c5954b7 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerTestBase.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerTestBase.java
@@ -1,10 +1,10 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
* ELK Integration with SNOMED
* %%
- * Copyright (C) 2023 Integrated Knowledge Management
+ * Copyright (C) 2023 - 2024 Integrated Knowledge Management
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,12 +34,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import dev.ikm.elk.snomed.SnomedIds;
-import dev.ikm.elk.snomed.SnomedIsa;
-import dev.ikm.elk.snomed.SnomedOntology;
-import dev.ikm.elk.snomed.SnomedOntologyReasoner;
import dev.ikm.elk.snomed.model.Concept;
import dev.ikm.elk.snomed.model.RoleType;
+import dev.ikm.elk.snomed.owlel.OwlElOntology;
public class SnomedOntologyReasonerTestBase extends SnomedTestBase {
@@ -47,9 +44,9 @@ public class SnomedOntologyReasonerTestBase extends SnomedTestBase {
@Test
public void classify() throws Exception {
- SnomedOwlOntology ontology = SnomedOwlOntology.createOntology();
- ontology.loadOntology(axioms_file);
- SnomedOntology snomedOntology = new OwlTransformer().transform(ontology);
+ OwlElOntology ontology = new OwlElOntology();
+ ontology.load(axioms_file);
+ SnomedOntology snomedOntology = new OwlElTransformer().transform(ontology);
SnomedOntologyReasoner sor = SnomedOntologyReasoner.create(snomedOntology);
for (RoleType rt : snomedOntology.getRoleTypes()) {
if (!rt.getSuperRoleTypes().stream().map(RoleType::getId).toList().equals(List.of(762705008l))) {
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerUs20240301TestIT.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerUs20240301TestIT.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerUs20240301TestIT.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerUs20240301TestIT.java
index e27e91393..b6b1e4ba1 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerUs20240301TestIT.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerUs20240301TestIT.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerUs20240901TestIT.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerUs20240901TestIT.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerUs20240901TestIT.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerUs20240901TestIT.java
index 15708f188..f42f96fa2 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerUs20240901TestIT.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerUs20240901TestIT.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerUsTestBase.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerUsTestBase.java
similarity index 97%
rename from elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerUsTestBase.java
rename to elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerUsTestBase.java
index c7cdb7672..e05f5fcd8 100644
--- a/elk-snomed-owl/src/test/java/dev/ikm/elk/snomed/owl/SnomedOntologyReasonerUsTestBase.java
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedOntologyReasonerUsTestBase.java
@@ -1,4 +1,4 @@
-package dev.ikm.elk.snomed.owl;
+package dev.ikm.elk.snomed;
/*-
* #%L
diff --git a/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedTestBase.java b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedTestBase.java
new file mode 100644
index 000000000..e178bd6c7
--- /dev/null
+++ b/elk-snomed/src/test/java/dev/ikm/elk/snomed/SnomedTestBase.java
@@ -0,0 +1,77 @@
+package dev.ikm.elk.snomed;
+
+/*-
+ * #%L
+ * ELK Integration with SNOMED
+ * %%
+ * Copyright (C) 2023 Integrated Knowledge Management
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class SnomedTestBase {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SnomedTestBase.class);
+
+ protected String getDir() {
+ return "target/data/snomed-test-data-" + getEditionDir() + "-" + getVersion();
+ }
+
+ protected String getEdition() {
+ return "US1000124";
+ }
+
+ protected String getEditionDir() {
+ return "us";
+ }
+
+ protected String getVersion() {
+ return "20210301";
+ }
+
+ protected Path axioms_file = Paths.get(getDir(),
+ "sct2_sRefset_OWLExpressionSnapshot_" + getEdition() + "_" + getVersion() + ".txt");
+
+ protected Path rels_file = Paths.get(getDir(),
+ "sct2_Relationship_Snapshot_" + getEdition() + "_" + getVersion() + ".txt");
+
+ protected Path values_file = Paths.get(getDir(),
+ "sct2_RelationshipConcreteValues_Snapshot_" + getEdition() + "_" + getVersion() + ".txt");
+
+ protected Path descriptions_file = Paths.get(getDir(),
+ "sct2_Description_Snapshot-en_" + getEdition() + "_" + getVersion() + ".txt");
+
+ @BeforeEach
+ protected void filesExist() {
+ assumeTrue(Files.exists(axioms_file), "No file: " + axioms_file);
+ assumeTrue(Files.exists(rels_file), "No file: " + rels_file);
+ assumeTrue(Files.exists(descriptions_file), "No file: " + descriptions_file);
+ LOG.info("Files exist");
+ LOG.info("\t" + axioms_file);
+ LOG.info("\t" + rels_file);
+ LOG.info("\t" + values_file);
+ LOG.info("\t" + descriptions_file);
+ }
+
+}
diff --git a/pom.xml b/pom.xml
index 8a8718763..e47ec3bff 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,6 +47,7 @@
elk-proofs-test
elk-owlapi
elk-owlapi-test
+ elk-snomed-owl-el
elk-snomed
elk-snomed-reasoner
elk-snomed-owl
@@ -66,6 +67,7 @@
4.13.2
5.11.2
+ 4.13.2-r1
33.3.0-jre-r2
3.0.2-r7
@@ -92,6 +94,7 @@
3.3.0
3.2.2
+ 4.13.2
2.4.0
1.6.13
1.3.0
@@ -125,6 +128,11 @@
test
+
+ dev.ikm.jpms
+ antlr4-runtime
+ ${antlr4-runtime.version}
+
dev.ikm.jpms
guava
@@ -226,6 +234,11 @@
elk-snomed-owl
${project.version}
+
+ ${project.groupId}
+ elk-snomed-owl-el
+ ${project.version}
+
${project.groupId}
elk-snomed-reasoner
@@ -366,6 +379,11 @@
${maven-surefire-plugin.version}
+
+ org.antlr
+ antlr4-maven-plugin
+ ${antlr4-maven-plugin.version}
+
org.codehaus.mojo
license-maven-plugin