轩辕镜像
轩辕镜像专业版
个人中心搜索镜像
交易
充值流量我的订单
工具
工单支持镜像收录Run 助手IP 归属地密码生成Npm 源Pip 源
帮助
常见问题我要吐槽
其他
关于我们网站地图

官方QQ群: 13763429

轩辕镜像
镜像详情
semtech/mu-cl-resources
官方博客使用教程热门镜像工单支持
本站面向开发者与科研用户,提供开源镜像的搜索和下载加速服务。
所有镜像均来源于原始开源仓库,本站不存储、不修改、不传播任何镜像内容。
轩辕镜像 - 国内开发者首选的专业 Docker 镜像下载加速服务平台 - 官方QQ群:13763429 👈点击免费获得技术支持。
本站面向开发者与科研用户,提供开源镜像的搜索和下载加速服务。所有镜像均来源于原始开源仓库,本站不存储、不修改、不传播任何镜像内容。

本站支持搜索的镜像仓库:Docker Hub、gcr.io、ghcr.io、quay.io、k8s.gcr.io、registry.gcr.io、elastic.co、mcr.microsoft.com

mu-cl-resources Docker 镜像下载 - 轩辕镜像

mu-cl-resources 镜像详细信息和使用指南

mu-cl-resources 镜像标签列表和版本信息

mu-cl-resources 镜像拉取命令和加速下载

mu-cl-resources 镜像使用说明和配置指南

Docker 镜像加速服务 - 轩辕镜像平台

国内开发者首选的 Docker 镜像加速平台

极速拉取 Docker 镜像服务

相关 Docker 镜像推荐

热门 Docker 镜像下载

mu-cl-resources
semtech/mu-cl-resources
自动构建

mu-cl-resources 镜像详细信息

mu-cl-resources 镜像标签列表

mu-cl-resources 镜像使用说明

mu-cl-resources 镜像拉取命令

Docker 镜像加速服务

轩辕镜像平台优势

镜像下载指南

相关 Docker 镜像推荐

提供高级抽象,用于生成符合JSONAPI规范的资源,通过Common Lisp进行配置的Docker镜像。
4 收藏0 次下载activesemtech镜像
🚀轩辕镜像专业版更稳定💎一键安装 Docker 配置镜像源
中文简介版本下载
🚀轩辕镜像专业版更稳定💎一键安装 Docker 配置镜像源

mu-cl-resources 镜像详细说明

mu-cl-resources 使用指南

mu-cl-resources 配置说明

mu-cl-resources 官方文档

mu-cl-resources:JSONAPI与SPARQL的双向转换

mu-cl-resources提供符合JSONAPI规范的接口,用于访问配置中指定的内容。大部分配置在configuration/domain.json或configuration/domain.lisp文件中进行(可选择其一),本仓库中提供了相关示例。

大部分配置在领域文件中完成。参见configuration/domain.json和configuration/domain.lisp了解入门知识。该文件定义了JSON世界与RDF世界之间的连接。定义模型时,需明确两个世界的结构。

本文档内容并非详尽无遗。该组件可处理多种用例,并支持实验性的特殊功能(可能在后续版本纳入核心功能)。因此,本README未涵盖组件的所有功能。

domain.json格式仍在发展中,部分配置参数只能在Lisp版本中设置。可组合使用两种格式,参见教程:组合domain.lisp和domain.json。

教程

将mu-cl-resources添加到栈中

在docker-compose.yml的services块中添加以下片段:

services:
  resource:
    image: semtech/mu-cl-resources:1.20.0
    links:
      - db:database
    volumes:
      - ./config/resources:/config

接下来,将本仓库examples/文件夹中的配置文件复制到项目的./config/resources文件夹中。需复制JSON配置文件examples/domain.json或Lisp配置文件examples/domain.lisp和examples/repository.lisp。

最后,在项目的./config/dispatcher/dispatcher.ex的调度器配置中添加新规则,将/themes的请求转发到新的资源服务:

  get "/themes/*path", @any do
    forward conn, path, "[***]"
  end

运行docker-compose up -d启动栈。假设标识符在80端口发布,向http://localhost/themes发送请求应返回来自mu-cl-resources的空数组。

由于mu.semte.ch项目通常包含mu-cl-resources,mu.semte.ch项目的默认蓝图mu-semtech/mu-project已集成mu-cl-resources。

通过domain.lisp配置介绍

该服务由domain.lisp文件驱动,需根据领域需求调整该文件。本节简要说明各部分如何协同工作,以及如何快速启动API。

mu-cl-resources由domain.lisp文件驱动。该文件描述JSONAPI与语义模型之间的连接。其次是repository.lisp文件,可在其中定义新前缀以简化领域描述。本仓库的examples文件夹中提供了这两个文件的示例。

/configuration/domain.lisp

domain.lisp包含应用中每种资源类型的定义。这些定义提供三向连接:

  • 在domain.lisp文件中命名事物以建立连接
  • 描述通过JSON API可见的属性
  • 描述用于实现JSON API的语义模型

每个资源定义都是这三种视图的组合。假设使用foaf示例,建模一个拥有一个或多个在线账户的Person。可使用WebVOWL可视化该模型。

补充说明:mu-cl-resources主要通过Lisp配置。Lisp使用括号()进行内容分组。括号后接单词通常表示组的内容;无单词时通常为列表。其他字符如反引号(`)或逗号(,)建议从示例中复制使用。

(define-resource person ()
  :class (s-url "[***]")
  :properties `((:name :string ,(s-url "[***]")))
  :resource-base (s-url "[***]")
  :on-path "people")

一个简单的person定义使用foaf词汇表描述person和person name。

  • 第1行:define-resource person表示创建一个新端点,在文件中命名为person(通常使用单数形式)。
  • 第2行:指定三元组存储中person所属的RDF类为foaf:Person。
  • 第3行:指定person的单个属性。JSONAPI将string类型的内容存储在data.attributes.name中(因:name),该值通过三元组存储中的谓词foaf:name与资源连接。注意属性名可包含连字符,但不区分大小写(忽略大写字母)。
  • 第4行:创建此类新资源时在三元组存储中使用的URI前缀,会追加UUID。
  • 第5行:指定可列出/创建/更新资源的端点,此处/people请求映射到该资源。

假设定义了foaf前缀,可简化示例,使用s-prefix:

(define-resource person ()
  :class (s-prefix "foaf:Person")
  :properties `((:name :string ,(s-prefix "foaf:name")))
  :resource-base (s-url "[***]")
  :on-path "people")

此代码与上述示例功能相同,但更易读。

可添加多个属性,例如添加age属性(数字类型):

(define-resource person ()
  :class (s-prefix "foaf:Person")
  :properties `((:name :string ,(s-prefix "foaf:name"))
                (:age :number ,(s-prefix "foaf:age")))
  :resource-base (s-url "[***]")
  :on-path "people")

通过此修改,person支持name和age属性。

大多数资源链接到其他资源。首先定义第二个资源OnlineAccount:

(define-resource account ()
  :class (s-prefix "foaf:OnlineAccount")
  :properties `((:name :string ,(s-prefix "foaf:accountName")))
  :resource-base (s-url "[***]")
  :on-path "accounts")

account资源的定义与person类似。使用:has-many关键字将person链接到多个account:

(define-resource person ()
  :class (s-prefix "foaf:Person")
  :properties `((:name :string ,(s-prefix "foaf:name"))
                (:age :number ,(s-prefix "foaf:age")))
  :has-many `((account :via ,(s-prefix "foaf:account")
                       :as "accounts"))
  :resource-base (s-url "[***]")
  :on-path "people")

第5-6行指定person可链接到多个account类型的资源。在三元组存储中,通过foaf:account谓词查找链接。该关系通过JSON API的关系名称"accounts"暴露,因此GET /people/42/accounts将返回UUID为42的person的账户。

使用:has-one关键字获取链接到account的person,并添加:inverse t选项表示沿相反方向跟踪关系:

(define-resource account ()
  :class (s-prefix "foaf:OnlineAccount")
  :properties `((:name :string ,(s-prefix "foaf:accountName")))
  :has-one `((person :via ,(s-prefix "foaf:account")
                     :inverse t
                     :as "owner"))
  :resource-base (s-url "[***]")
  :on-path "accounts")

完整的user和account设置如下:

(define-resource person ()
  :class (s-prefix "foaf:Person")
  :properties `((:name :string ,(s-prefix "foaf:name"))
                (:age :number ,(s-prefix "foaf:age")))
  :has-many `((account :via ,(s-prefix "foaf:account")
                       :as "accounts"))
  :resource-base (s-url "[***]")
  :on-path "people")

(define-resource account ()
  :class (s-prefix "foaf:OnlineAccount")
  :properties `((:name :string ,(s-prefix "foaf:accountName")))
  :has-one `((person :via ,(s-prefix "foaf:account")
                     :inverse t
                     :as "owner"))
  :resource-base (s-url "[***]")
  :on-path "accounts")

/configuration/repositories.lisp

上述示例使用foaf前缀表示类和属性。/configuration/repositories.lisp允许定义自定义前缀,常用缩写可参考prefix.cc。

(add-prefix "foaf" "[***]")

生成的API

支持JSONAPI规范,常见调用示例:

  • # GET /people

  • # GET /people/0b29a57a-d324-4302-9c92-61958e4cf250/accounts

  • # GET /people?filter=John

  • # GET /people?filter[age]=42

  • # GET /people?include=accounts

  • # GET /people?filter[:exact:name]=John%20Doe

  • # GET /people?sort=age

  • # GET /accounts?sort=-person.age

  • # POST /people/0b29a57a-d324-4302-9c92-61958e4cf250

  • # PATCH /people/0b29a57a-d324-4302-9c92-61958e4cf250

  • # PATCH /people/0b29a57a-d324-4302-9c92-61958e4cf250/relationships/accounts

  • # DELETE /people/0b29a57a-d324-4302-9c92-61958e4cf250/relationships/accounts

  • # DELETE /people/0b29a57a-d324-4302-9c92-61958e4cf250

更多配置选项

  • mu-cl-resources选项:通过domain.lisp文件中的顶级defparameter表达式指定。
  • 资源特定选项:与:class同级的:features关键字可指定修改特定资源行为的选项。
  • 属性选项:单个属性定义后的符号可提供关于属性使用方式的额外信息。

通过domain.json配置介绍

mu-cl-resources通过domain.json文件驱动,该文件描述JSONAPI与语义模型之间的连接。本仓库的examples文件夹中提供了示例文件。

/configuration/domain.json

domain.json包含应用中每种资源类型的定义,提供三向连接(命名事物、描述JSON属性、描述语义模型)。

{
  "version": "0.1",
  "resources": {
    "people": {
      "name": "person",
      "class": "[***]",
      "attributes": {
        "name": {
          "type": "string",
          "predicate": "[***]"
        }
      },
      "new-resource-base": "[***]"
    }
  }
}

使用前缀简化配置:

{
  "version": "0.1",
  "prefixes": {
    "foaf": "[***]"
  },
  "resources": {
    "people": {
      "name": "person",
      "class": "foaf:Person",
      "attributes": {
        "name": {
          "type": "string",
          "predicate": "foaf:name"
        }
      },
      "new-resource-base": "[***]"
    }
  }
}

添加多个属性(如age):

{
  "version": "0.1",
  "prefixes": {
    "foaf": "[***]"
  },
  "resources": {
    "people": {
      "name": "person",
      "class": "foaf:Person",
      "attributes": {
        "name": {
          "type": "string",
          "predicate": "foaf:name"
        },
        "age": {
          "type": "number",
          "predicate": "foaf:age"
        }
      },
      "new-resource-base": "[***]"
    }
  }
}

定义关系(如person拥有多个account):

{
  "version": "0.1",
  "prefixes": {
    "foaf": "[***]"
  },
  "resources": {
    "people": {
      "name": "person",
      "class": "foaf:Person",
      "attributes": {
        "name": {
          "type": "string",
          "predicate": "foaf:name"
        },
        "age": {
          "type": "number",
          "predicate": "foaf:age"
        }
      },
      "relationships": {
        "accounts": {
          "predicate": "foaf:account",
          "target": "account",
          "cardinality": "many"
        }
      },
      "new-resource-base": "[***]"
    },
    "accounts": {
      "name": "account",
      "class": "foaf:OnlineAccount",
      "attributes": {
        "name": {
          "type": "string",
          "predicate": "foaf:accountName"
        }
      },
      "relationships": {
        "owner": {
          "predicate": "foaf:account",
          "target": "person",
          "cardinality": "one",
          "inverse": true
        }
      },
      "new-resource-base": "[***]"
    }
  }
}

组合domain.lisp和domain.json

对于大型应用,可将领域定义分散到多个文件。根领域文件必须为Lisp格式,包含的文件可以是Lisp或JSON格式。在domain.lisp顶部添加read-domain-file语句:

(in-package :mu-cl-resources)

(read-domain-file "users.json")
(read-domain-file "publications.lisp")

重启服务后,mu-cl-resources将加载额外配置文件。

使用domain.json配置设置

若使用domain.json定义资源,需创建domain.lisp文件并添加:

(in-package :mu-cl-resources)

(read-domain-file "domain.json")

在domain.lisp中添加设置,重启服务后生效。

参考

在Lisp中定义资源

define-resource结构用于定义资源,示例:

(define-resource person ()
  :class (s-prefix "foaf:Person")
  :properties `((:name :string ,(s-prefix "foaf:name")
                       :required)
                (:age :number ,(s-url "[***]")))
  :has-one `((location :via ,(s-prefix "foaf:based_near")
                       :as "location"))
  :has-many `((account :via ,(s-prefix "foaf:account")
                       :as "accounts")
              (document :via ,(s-prefix "foaf:publications")
                        :as "publications"))
  :features '(include-uri)
  :resource-base (s-url "[***]")
  :on-path "people")

关键字概述

  • :class:设置实例所属的RDF类。
  • :properties:描述资源属性(对应JSON attributes)。
  • :has-one:描述最多一个的关系。
  • :has-many:描述零个或多个的关系。
  • :features:资源使用的可选功能(如include-uri返回URI)。
  • :resource-base:新资源的URI前缀。
  • **
查看更多 mu-cl-resources 相关镜像 →
rancher/hardened-sriov-network-resources-injector logo
rancher/hardened-sriov-network-resources-injector
by Rancher by SUSE
认证
暂无描述
100K+ pulls
上次更新:11 天前

常见问题

轩辕镜像免费版与专业版有什么区别?

免费版仅支持 Docker Hub 加速,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。

轩辕镜像免费版与专业版有分别支持哪些镜像?

免费版仅支持 docker.io;专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等。

流量耗尽错误提示

当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。

410 错误问题

通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。

manifest unknown 错误

先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。

镜像拉取成功后,如何去掉轩辕镜像域名前缀?

使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。

查看全部问题→

轩辕镜像下载加速使用手册

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式

🔐

登录方式进行 Docker 镜像下载加速教程

通过 Docker 登录方式配置轩辕镜像加速服务,包含7个详细步骤

🐧

Linux Docker 镜像下载加速教程

在 Linux 系统上配置轩辕镜像源,支持主流发行版

🖥️

Windows/Mac Docker 镜像下载加速教程

在 Docker Desktop 中配置轩辕镜像加速,适用于桌面系统

📦

Docker Compose 镜像下载加速教程

在 Docker Compose 中使用轩辕镜像加速,支持容器编排

📋

K8s containerd 镜像下载加速教程

在 k8s 中配置 containerd 使用轩辕镜像加速

🔧

宝塔面板 Docker 镜像下载加速教程

在宝塔面板中配置轩辕镜像加速,提升服务器管理效率

💾

群晖 NAS Docker 镜像下载加速教程

在 Synology 群晖NAS系统中配置轩辕镜像加速

🐂

飞牛fnOS Docker 镜像下载加速教程

在飞牛fnOS系统中配置轩辕镜像加速

📱

极空间 NAS Docker 镜像下载加速教程

在极空间NAS中配置轩辕镜像加速

⚡

爱快路由 ikuai Docker 镜像下载加速教程

在爱快ikuai系统中配置轩辕镜像加速

🔗

绿联 NAS Docker 镜像下载加速教程

在绿联NAS系统中配置轩辕镜像加速

🌐

威联通 NAS Docker 镜像下载加速教程

在威联通NAS系统中配置轩辕镜像加速

📦

Podman Docker 镜像下载加速教程

在 Podman 中配置轩辕镜像加速,支持多系统

📚

ghcr、Quay、nvcr、k8s、gcr 等仓库下载镜像加速教程

配置轩辕镜像加速9大主流镜像仓库,包含详细配置步骤

🚀

专属域名方式进行 Docker 镜像下载加速教程

无需登录即可使用轩辕镜像加速服务,更加便捷高效

需要其他帮助?请查看我们的 常见问题 或 官方QQ群: 13763429

商务:17300950906
|©2024-2025 源码跳动
商务合作电话:17300950906|Copyright © 2024-2025 杭州源码跳动科技有限公司. All rights reserved.