-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flesh out an OTEAPI function strategy plugin for converting between a parsed data source to a SOFT7 Entity instance. Ignore importlib.metadata deprecation warning: See issue #395 in oteapi-core to follow up on when this ignore statement can be removed. Remove all the noise in the repo, focus on: - the entity_instance factory - the OTEAPI plugins - the pydantic models Remove unused dependencies. Update pre-commit hooks. Update dependency versions. Update GH Actions.
- Loading branch information
Showing
39 changed files
with
2,937 additions
and
1,184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,73 @@ | ||
# SOFT7 | ||
|
||
## OTEAPI plugin | ||
|
||
The `soft7` packages comes with an [OTEAPI](https://github.com/EMMC-ASBL/oteapi-core) plugin that allows one to convert any core parser data to a SOFT7 Entity instance. | ||
|
||
To use the plugin, call the `'soft7'` `functionType` function strategy. | ||
|
||
### Test the plugin | ||
|
||
At the root of the repository is a [Docker Compose](https://docs.docker.com/compose/) file, which, when run, will start an [OTEAPI Service](https://github.com/EMMC-ASBL/oteapi-services#readme) that includes the `soft7` OTEAPI plugin. | ||
|
||
To start the service, run: | ||
|
||
```bash | ||
docker compose pull | ||
docker compose up -d | ||
``` | ||
|
||
To follow along with the installation of the `soft7` package and startup of the OTEAPI Service, run: | ||
|
||
```bash | ||
docker logs -f soft7-oteapi-1 | ||
``` | ||
|
||
Press Ctrl+C to stop following the logs. | ||
|
||
To eventually stop the services, run: | ||
|
||
```bash | ||
docker compose down | ||
``` | ||
|
||
But first, let's test the plugin. | ||
|
||
Open a Python shell, an [IPython shell](https://ipython.org/), or a [Jupyter Notebook](https://jupyter.org/), and run: | ||
|
||
```python | ||
from s7.factories import create_datasource | ||
|
||
# Let us use an OPTIMADE structure from the Materials Project as our "raw" data source. | ||
# The chosen structure is mp-1228448 (Al2O3): | ||
# https://materialsproject.org/materials/mp-1228448/ | ||
# For more information about OPTIMADE, see https://www.optimade.org/ | ||
# For more information about the Materials Project, see https://materialsproject.org/ | ||
dataresource_config = { | ||
"downloadUrl": ( | ||
"https://optimade.materialsproject.org/v1/structures/mp-1228448?" | ||
"response_format=json" | ||
), | ||
"mediaType": "application/json", | ||
} | ||
|
||
# We need to setup a mapping configuration to tell the plugin how to map the OPTIMADE | ||
# structure to a SOFT7 Entity instance. | ||
# This requires knowledge of the OPTIMADE structure and the SOFT7 Entity. | ||
# In our case the OPTIMADE structure specification is available at | ||
# https://github.com/Materials-Consortia/OPTIMADE/blob/v1.1.0/optimade.rst#structures-entries | ||
# and the SOFT7 Entity of choice is the `OPTIMADEStructure` Entity, which can be found | ||
# at http://onto-ns.com/meta/1.0/OPTIMADEStructure | ||
mapping_config = { | ||
"mappingType": "triples", | ||
"prefixes": { | ||
"optimade": "https://optimade.materialsproject.org/v1/structures/mp-1228448#", | ||
"soft7": "http://onto-ns.com/meta/1.0/OPTIMADEStructure#", | ||
}, | ||
"triples": { | ||
("optimade:data.id", "", "soft7:properties.id"), | ||
("optimade:data.type", "", "soft7:properties.type"), | ||
("optimade:data.attributes", "", "soft7:properties."), | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# AllegroGraph configuration file | ||
RunAs agraph | ||
SessionPorts 10000-10034 | ||
Port 10035 | ||
SettingsDirectory /agraph/data/settings | ||
LogDir /agraph/data | ||
PidFile /agraph/data/agraph.pid | ||
InstanceTimeout 604800 | ||
SuperUser dbuser:test123 | ||
<RootCatalog> | ||
Main /agraph/data/rootcatalog | ||
</RootCatalog> | ||
|
||
<SystemCatalog> | ||
Main /agraph/data/systemcatalog | ||
InstanceTimeout 10 | ||
</SystemCatalog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
version: "3" | ||
|
||
services: | ||
oteapi: | ||
image: ghcr.io/emmc-asbl/oteapi:${DOCKER_OTEAPI_VERSION:-latest} | ||
ports: | ||
- "${PORT:-8080}:8080" | ||
environment: | ||
OTEAPI_REDIS_TYPE: redis | ||
OTEAPI_REDIS_HOST: redis | ||
OTEAPI_REDIS_PORT: 6379 | ||
OTEAPI_prefix: "${OTEAPI_prefix:-/api/v1}" | ||
OTEAPI_INCLUDE_REDISADMIN: "${OTEAPI_INCLUDE_REDISADMIN:-False}" | ||
OTEAPI_EXPOSE_SECRETS: "${OTEAPI_EXPOSE_SECRETS:-True}" | ||
OTEAPI_AUTHENTICAION_DEPENDENCIES: | ||
OTEAPI_PLUGIN_PACKAGES: "-v -e /soft7" | ||
depends_on: | ||
- redis | ||
networks: | ||
- otenet | ||
volumes: | ||
- "${PWD}:/soft7" | ||
|
||
redis: | ||
image: redis:latest | ||
volumes: | ||
- redis-persist:/data | ||
networks: | ||
- otenet | ||
|
||
agraph: | ||
image: franzinc/agraph:v7.2.0 | ||
volumes: | ||
- agraph-data:/agraph/data | ||
- ./agraph.cfg:/agraph/etc/agraph.cfg | ||
ports: | ||
- "10000-10035:10000-10035" | ||
restart: on-failure | ||
shm_size: 4g | ||
networks: | ||
- otenet | ||
|
||
volumes: | ||
redis-persist: | ||
agraph-data: | ||
|
||
networks: | ||
otenet: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
"""SOFT7""" | ||
|
||
from __future__ import annotations | ||
|
||
import logging | ||
|
||
__version__ = "0.0.6" | ||
|
||
logging.getLogger("s7").setLevel(logging.DEBUG) |
Oops, something went wrong.