
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
提供存储在Neo4j图数据库中的事物(Things)的公共API。目前事物正迁移至新的https://github.com/Financial-Times/public-concepts-api%EF%BC%8C%E5%9B%A0%E6%AD%A4%E6%9C%ACAPI%E6%9C%80%E7%BB%88%E5%B0%86%E8%A2%AB%E5%BC%83%E7%94%A8%E3%80%82%E8%87%AA2018%E5%B9%B47%E6%9C%88%E8%B5%B7%EF%BC%8C%E5%AF%B9%E6%9C%AC%E6%9C%8D%E5%8A%A1%E7%9A%84%E8%AF%B7%E6%B1%82%E5%B0%86%E9%80%9A%E8%BF%87%E6%A6%82%E5%BF%B5API%E9%87%8D%E5%AE%9A%E5%90%91%EF%BC%8C%E7%84%B6%E5%90%8E%E8%BD%AC%E6%8D%A2%E4%BB%A5%E5%8C%B9%E9%85%8D%E7%8E%B0%E6%9C%89%E5%A5%91%E7%BA%A6%E5%B9%B6%E8%BF%94%E5%9B%9E%E3%80%82
showRelationship查询参数获取事物间的关系(包括broader、broaderTransitive、narrower、related类型)适用于需要读取Neo4j图数据库中存储的事物信息的应用,可获取事物的基本信息及其与其他概念的关系。注意:本API正处于迁移阶段,未来将被Public Concepts API替代,建议新应用直接使用Public Concepts API。
| 参数名 | 描述 | 默认值 | 环境变量对应 |
|---|---|---|---|
| --app-system-code | 应用的系统代码 | public-things-api | APP_SYSTEM_CODE |
| --port | 监听端口 | 8080 | APP_PORT |
| --env | 应用运行环境(local/生产等) | local | - |
| --cache-duration | GET请求的缓存时长(例如2h45m表示7440秒) | 30s | CACHE_DURATION |
| --logLevel | 日志级别(debug/info/warn/error) | info | LOG_LEVEL |
| --publicConceptsApiURL | Public Concepts API端点URL | http://localhost:8080 | CONCEPTS_API |
基本运行
bashdocker run -d -p 8080:8080 \ -e APP_SYSTEM_CODE=public-things-api \ -e APP_PORT=8080 \ -e CACHE_DURATION=30s \ -e LOG_LEVEL=info \ -e CONCEPTS_API=http://public-concepts-api:8080 \ docker.xuanyuan.run/coco/public-things-api
自定义配置
bashdocker run -d -p 8081:8081 \ -e APP_SYSTEM_CODE=my-things-api \ -e APP_PORT=8081 \ -e CACHE_DURATION=5m \ -e LOG_LEVEL=debug \ -e CONCEPTS_API=http://concepts-api.example.com \ docker.xuanyuan.run/coco/public-things-api --env=production
获取单个事物描述
通过UUID获取事物的基本信息:
bashcurl http://localhost:8080/things/{concept-uuid} | jq
响应示例:
json{ "id": "http://api.ft.com/things/a11fa00f-777d-484a-9ebc-fbf81b774fc0", "apiUrl": "http://api.ft.com/things/a11fa00f-777d-484a-9ebc-fbf81b774fc0", "prefLabel": "Solar Wars", "types": [ "http://www.ft.com/ontology/core/Thing", "http://www.ft.com/ontology/concept/Concept", "http://www.ft.com/ontology/Topic" ], "directType": "http://www.ft.com/ontology/Topic", "aliases": [ "Solar Wars" ] }
获取带关系的事物描述
通过showRelationship参数获取事物与其他概念的关系,支持的值:broader( broader关系)、broaderTransitive(broader传递关系)、narrower(narrower关系)、related(related关系)。
bashcurl "http://localhost:8080/things/{concept-uuid}?showRelationship=broaderTransitive&showRelationship=related&showRelationship=narrower" | jq
响应示例(包含关系):
json{ "id": "http://api.ft.com/things/a11fa00f-777d-484a-9ebc-fbf81b774fc0", "apiUrl": "http://api.ft.com/things/a11fa00f-777d-484a-9ebc-fbf81b774fc0", "prefLabel": "Solar Wars", "types": [ "http://www.ft.com/ontology/core/Thing", "http://www.ft.com/ontology/concept/Concept", "http://www.ft.com/ontology/Topic" ], "directType": "http://www.ft.com/ontology/Topic", "aliases": [ "Solar Wars" ], "narrowerConcepts": [ { "id": "http://api.ft.com/things/0ff1c1c9-970a-4f05-9f97-c5150f8f907e", "apiUrl": "http://api.ft.com/things/0ff1c1c9-970a-4f05-9f97-c5150f8f907e", "prefLabel": "Macroeconomics", "types": [ "http://www.ft.com/ontology/core/Thing", "http://www.ft.com/ontology/concept/Concept", "http://www.ft.com/ontology/Topic" ], "directType": "http://www.ft.com/ontology/Topic", "predicate": "http://www.w3.org/2004/02/skos/core#narrower" } ], "broaderConcepts": [ { "id": "http://api.ft.com/things/49181791-a1a9-4966-ac30-010846ec76d8", "apiUrl": "http://api.ft.com/things/49181791-a1a9-4966-ac30-010846ec76d8", "prefLabel": "Trade disputes", "types": [ "http://www.ft.com/ontology/core/Thing", "http://www.ft.com/ontology/concept/Concept", "http://www.ft.com/ontology/Topic" ], "directType": "http://www.ft.com/ontology/Topic", "predicate": "http://www.w3.org/2004/02/skos/core#broader" } ], "relatedConcepts": [ { "id": "http://api.ft.com/things/29e9fad1-14fc-480b-a89c-cd964750bd80", "apiUrl": "http://api.ft.com/things/29e9fad1-14fc-480b-a89c-cd964750bd80", "prefLabel": "Renewable Energy", "types": [ "http://www.ft.com/ontology/core/Thing", "http://www.ft.com/ontology/concept/Concept", "http://www.ft.com/ontology/Topic" ], "directType": "http://www.ft.com/ontology/Topic", "predicate": "http://www.w3.org/2004/02/skos/core#related" } ] }
批量获取多个事物描述
通过多个uuid参数批量获取事物描述,支持自动解析非规范UUID:
bashcurl "http://localhost:8080/things?uuid={canonical-uuid}&uuid={non-canonical-uuid}&uuid={another-uuid}" | jq
响应示例:
json{ "things": { "a11fa00f-777d-484a-9ebc-fbf81b774fc0": { "id": "http://api.ft.com/things/a11fa00f-777d-484a-9ebc-fbf81b774fc0", "apiUrl": "http://api.ft.com/things/a11fa00f-777d-484a-9ebc-fbf81b774fc0", "prefLabel": "Solar Wars", "types": [ "http://www.ft.com/ontology/core/Thing", "http://www.ft.com/ontology/concept/Concept", "http://www.ft.com/ontology/Topic" ], "directType": "http://www.ft.com/ontology/Topic", "aliases": [ "Solar Wars" ] }, "non-canonical-uuid": { "id": "http://api.ft.com/things/canonical-uuid", "apiUrl": "http://api.ft.com/things/canonical-uuid", "prefLabel": "Resolved Thing", "types": [ "http://www.ft.com/ontology/core/Thing", "http://www.ft.com/ontology/concept/Concept" ], "directType": "http://www.ft.com/ontology/concept/Concept", "aliases": [] } } }
/__gtg: 健康状态检查(返回200表示正常)/__health: 详细健康信息/__build-info: 应用构建信息/__ping: 心跳检查(返回"pong")local环境:日志输出到控制台/__build-info和/__ping端点的请求不记录日志如需从源码构建,执行以下步骤:
bashcurl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
bashmkdir $GOPATH/src/github.com/Financial-Times/public-things-api cd $GOPATH/src/github.com/Financial-Times git clone https://github.com/Financial-Times/public-things-api.git cd public-things-api && dep ensure -vendor-only
bashgo build .
bashgo test ./... go install
--help查看参数):bash$GOPATH/bin/public-things-api --help
参数说明:
Options: --app-system-code 应用的系统代码(环境变量 $APP_SYSTEM_CODE)(默认 "public-things-api") --port 监听端口(环境变量 $APP_PORT)(默认 "8080") --env 应用运行环境(默认 "local") --cache-duration GET请求缓存时长(例如2h45m)(环境变量 $CACHE_DURATION)(默认 "30s") --logLevel 日志级别(环境变量 $LOG_LEVEL)(默认 "info") --publicConceptsApiURL Public Concepts API端点URL(环境变量 $CONCEPTS_API)(默认 "http://localhost:8080")
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务