acdh-oeaw / arche-ref-sources
从外部参考源获取数据的库
0.8.4
2024-08-26 09:53 UTC
Requires
- php: ^8.1
- acdh-oeaw/arche-assets: ^3.8.1
- acdh-oeaw/arche-lib: ^6
- acdh-oeaw/uri-normalizer: ^3
- psr/log: ^3
- zozlak/argparse: ^1
Requires (Dev)
- phpstan/phpstan: ^1
- phpunit/phpunit: ^10
README
一个脚本,用于增强 ARCHE Suite 仓库数据,通过从外部参考源(Geonames、GND、wikidata 等)收集的信息。
它通过解析现有的标识符(外部参考源 URI),从那里获取信息并更新相应的 ARCHE Suite 仓库资源来实现。
安装
- 运行
composer require acdh-oeaw/arche-ref-sources
或者
- 克隆此仓库并进入其目录
- 运行
composer update
配置
请参阅此仓库提供的 config-sample.yaml
以获取示例。
运行
- 如果您使用 composer 安装:在运行
composer
命令的目录中运行vendor/bin/arche-ref-sources
。 - 如果您克隆了此仓库:在包含仓库的目录中运行
php -f arche-ref-sources
。
备注(根据上述说明替换 {arche-ref-source}
)
- 运行
{arche-ref-source} --help
以获取可用选项列表。 - 运行
{arche-ref-source} {您可能想要的全部参数} pathToConfigFile.yaml
- 您需要一个配置文件。您可以使用此仓库提供的
config-sample.yaml
作为基础(它包含有用的注释)。 - 开始时,您可能想要坚持默认的
parse
模式(仅从外部源获取数据,但不要尝试更新 ARCHE)与--verbose
(以查看已获取和提取的内容)和可能--output
(所以已获取和提取的内容将保存到 TTL 文件中,您可以稍后使用) - 对于过滤资源,您可以使用
--id
(处理具有给定 id 的确切一个资源;id 命名空间不计),--after someDate
(仅处理在给定日期之后修改的资源)和可能--limit N
(仅处理 N 个资源) - 您可以通过提供
--repoUrl
(默认为 apollo,对于 minerva,您应使用--repoUrl https://arche-dev.acdh-dev.oeaw.ac.at/api
)来选择 ARCHE 实例 - 您还可以使用
--inputFile
参数从 RDF 文件而不是 ARCHE 仓库中读取数据。
- 您需要一个配置文件。您可以使用此仓库提供的
向 repo-ingestion@hephaistos.arz.oeaw.ac.at 的说明
该脚本已安装在 repo-ingestion@hephaistos.arz.oeaw.ac.at
- 通过 ssh 连接到 repo-ingestion@hephaistos
- 运行
./login.sh
- 运行
/ARCHE/vendor/bin/arche-ref-sources {parameters} {pathToConfigFile}
并将{}
中的部分替换为您选择的参数- 示例 1:对于 2021 年 12 月 1 日之后修改的资源,不更改现有内容,在控制台上输出已获取的内容,并将其写入文件
/ARCHE/vendor/bin/arche-ref-sources --mode parse --verbose --output /ARCHE/staging/enrichment/outputEnrich.ttl --after 2021-12-01 /ARCHE/vendor/acdh-oeaw/arche-ref-sources/config-sample.yaml
- 示例 2,对于胆小者来说可能不太适合:获取数据并在实例上更改,但立即撤销更改;同时也在控制台上输出已获取的内容,并将其写入文件
/ARCHE/vendor/bin/arche-ref-sources --mode test --verbose --output /ARCHE/staging/enrichment/outputEnrich.ttl /ARCHE/vendor/acdh-oeaw/arche-ref-sources/config-sample.yaml
- 如果您想使用自己的配置文件,请复制 /ARCHE/vendor/acdh-oeaw/arche-ref-sources/config-sample.yaml(
cp /ARCHE/vendor/acdh-oeaw/arche-ref-sources/config-sample.yaml {placeOfYourChoice
)并编辑它。
- 示例 1:对于 2021 年 12 月 1 日之后修改的资源,不更改现有内容,在控制台上输出已获取的内容,并将其写入文件