必须在 JSON-LD 中显式输入 type=@id 值吗?

do type=@id values have to be explicitly typed in JSON-LD?

我正在研究 JSON-LD,专门与 schema.org 结合使用。

schema.org/Person 的 Json-LD 示例之一让我觉得错误:

        {
          "@context": "http://schema.org",
          "@type": "Person",
          "address": {
            "@type": "PostalAddress",
            "addressLocality": "Seattle",
            "addressRegion": "WA",
            "postalCode": "98052",
            "streetAddress": "20341 Whitworth Institute 405 N. Whitworth"
          },
          "colleague": [
            "http://www.xyz.edu/students/alicejones.html",
            "http://www.xyz.edu/students/bobsmith.html"
          ],
          "email": "mailto:jane-doe@xyz.edu",
          "image": "janedoe.jpg",
          "jobTitle": "Professor",
          "name": "Jane Doe",
          "telephone": "(425) 123-4567",
          "url": "http://www.janedoe.com"
        }

我觉得不对劲的是,colleague 被定义为 type=Person(见上文 link),而是提供了一个实体引用 (url/text)。

格式化的正确方法似乎是在 @context 中提供额外的信息,如下所示:

        {
          "@context": {
                "@vocab": "http://schema.org/",
                "colleague": { "@type": "@id" }
            },
          "@type": "Person",
          "address": {
            "@type": "PostalAddress",
            "addressLocality": "Seattle",
            "addressRegion": "WA",
            "postalCode": "98052",
            "streetAddress": "20341 Whitworth Institute 405 N. Whitworth"
          },
          "colleague": [
            "http://www.xyz.edu/students/alicejones.html",
            "http://www.xyz.edu/students/bobsmith.html"
          ],
          "email": "mailto:jane-doe@xyz.edu",
          "image": "janedoe.jpg",
          "jobTitle": "Professor",
          "name": "Jane Doe",
          "telephone": "(425) 123-4567",
          "url": "http://www.janedoe.com"
        }

schema.org 上的示例(代码示例 1)确实 incorrect/incomplete,代码示例 2 是否正确?

或者一般来说:当引用而不是嵌入实体时,是否需要明确这一点(使用 @type: @id),或者,规范中是否有一些隐含的概念,即当值是 URL 被@id认为是引用?

你是对的,这个例子不是 100% 正确。 @id 的类型强制缺失。我提交了一个错误来解决这个问题:https://github.com/schemaorg/schemaorg/issues/929