SOFT7语义互操作性框架。
项目描述
SOFT7
OTEAPI插件
软7包附带了一个OTEAPI 插件,允许将任何核心解析器数据转换为 SOFT7 实体实例。
要使用此插件,请调用 'soft7'
functionType
函数策略。
测试插件
在存储库的根目录中有一个 Docker Compose 文件,运行时将启动一个包含 soft7
OTEAPI 插件的 OTEAPI 服务。
要启动服务,请运行
docker compose pull
docker compose up -d
要跟随 soft7
包的安装和 OTEAPI 服务的启动,请运行
docker logs -f soft7-oteapi-1
按 Ctrl+C 停止跟踪日志。
要最终停止服务,请运行
docker compose down
但在测试插件之前,让我们先试试。
打开一个 Python shell、一个 IPython shell 或一个 Jupyter Notebook,并运行
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."),
}
}
项目详情
下载文件
为您的平台下载文件。如果您不确定要选择哪个,请了解有关 安装包 的更多信息。
源代码分发
soft7-0.2.1.tar.gz (70.6 kB 查看哈希值)
构建分发
soft7-0.2.1-py3-none-any.whl (35.2 kB 查看哈希值)