Repository: SynBioDex/tyto (language: python)

Issue:
Make sure all SBOL ontologies are supported
Some ontologies used by SBOL are not currently built in for tyto (e.g., EDAM).
This also includes SBOL itself.

Make sure that all of these are included in tyto's default endpoints.


Discussion / hints:

Fix patch:
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..7264e4c
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "tyto/ontologies/sbol-owl3"]
+	path = tyto/ontologies/sbol-owl3
+	url = https://github.com/SynBioDex/sbol-owl3.git
+[submodule "tyto/ontologies/sbol-owl"]
+	path = tyto/ontologies/sbol-owl
+	url = https://github.com/dissys/sbol-owl.git
diff --git a/setup.py b/setup.py
index 5396982..833aa62 100644
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,9 @@
       packages=find_packages(),
       package_data={'tyto': ['ontologies/*.owl',
                               'ontologies/*.rdf',
-                              'ontologies/*.ttl']},
+                              'ontologies/*.ttl',
+                              'ontologies/sbol-owl3/sbolowl3.rdf',
+                              'ontologies/sbol-owl/sbol.rdf']},
       include_package_data=True,
       install_requires=[
             'rdflib>=5.0',
diff --git a/tyto/__init__.py b/tyto/__init__.py
index b4924a5..d56c40b 100644
--- a/tyto/__init__.py
+++ b/tyto/__init__.py
@@ -5,3 +5,6 @@
 from .ncit import NCIT
 from .om import OM
 from .ncbi_taxon import NCBITaxon
+from .sbol2 import SBOL2
+from .sbol3 import SBOL3
+from .edam import EDAM
diff --git a/tyto/edam.py b/tyto/edam.py
new file mode 100644
index 0000000..a41d6b1
--- /dev/null
+++ b/tyto/edam.py
@@ -0,0 +1,7 @@
+from .tyto import Ontology, Ontobee, installation_path, multi_replace
+
+
+EDAM = Ontology(endpoints=[Ontobee],
+                uri='http://edamontology.org/EDAM.owl')
+"""EDAM (EMBRACE Data and Methods) is an ontology of common bioinformatics operations, topics, types of data including identifiers, and formats. EDAM comprises common concepts (shared within the bioinformatics community) that apply to semantic annotation of resources."""
+
diff --git a/tyto/ontologies/sbol-owl b/tyto/ontologies/sbol-owl
new file mode 160000
index 0000000..d25247a
--- /dev/null
+++ b/tyto/ontologies/sbol-owl
@@ -0,0 +1,1 @@
+Subproject commit d25247ab99df195642a43f0bbb8c232154b4325d
diff --git a/tyto/ontologies/sbol-owl3 b/tyto/ontologies/sbol-owl3
new file mode 160000
index 0000000..1f827fa
--- /dev/null
+++ b/tyto/ontologies/sbol-owl3
@@ -0,0 +1,1 @@
+Subproject commit 1f827fa3c08f6df04b27d5e4d215ae5dc8f155d0
diff --git a/tyto/sbol2.py b/tyto/sbol2.py
new file mode 100644
index 0000000..4b68c3f
--- /dev/null
+++ b/tyto/sbol2.py
@@ -0,0 +1,7 @@
+from .tyto import Ontology, installation_path
+
+
+SBOL2 = Ontology(path=installation_path('ontologies/sbol-owl/sbol.rdf'),
+                 uri='http://sbols.org/v2')
+
+
diff --git a/tyto/sbol3.py b/tyto/sbol3.py
new file mode 100644
index 0000000..c43c8ee
--- /dev/null
+++ b/tyto/sbol3.py
@@ -0,0 +1,6 @@
+from .tyto import Ontology, installation_path
+
+
+SBOL3 = Ontology(path=installation_path('ontologies/sbol-owl3/sbolowl3.rdf'),
+                uri='http://sbols.org/v3')
+


Test patch:
diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml
index bf860bc..cdda9b0 100644
--- a/.github/workflows/python-tests.yml
+++ b/.github/workflows/python-tests.yml
@@ -29,6 +29,8 @@ jobs:
             python-version: 3.x
     steps:
     - uses: actions/checkout@v2
+      with:
+        submodules: true
     - name: Set up Python ${{ matrix.python-version }}
       uses: actions/setup-python@v2
       with:
diff --git a/test/test_ontology.py b/test/test_ontology.py
index de14f7c..45c2aea 100644
--- a/test/test_ontology.py
+++ b/test/test_ontology.py
@@ -160,6 +160,18 @@ def test_SBO(self):
         uri = 'https://identifiers.org/SBO:0000241'
         self.assertEqual(SBO.get_term_by_uri(uri), 'functional entity')
 
+class TestSBOL(unittest.TestCase):
+
+    def test_sbol2(self):
+        self.assertEqual(SBOL2.inline, 'http://sbols.org/v2#inline')
+        self.assertEqual(SBOL2.reverseComplement, 'http://sbols.org/v2#reverseComplement')
+        self.assertEqual(SBOL2.ComponentDefinition, 'http://sbols.org/v2#ComponentDefinition')
+
+    def test_sbol3(self):
+        self.assertEqual(SBOL3.inline, 'http://sbols.org/v3#inline')
+        self.assertEqual(SBOL3.reverseComplement, 'http://sbols.org/v3#reverseComplement')
+        self.assertEqual(SBOL3.Component, 'http://sbols.org/v3#Component')
+
 
 if __name__ == '__main__':
     unittest.main()