代表RDFa,schema.org和FOAF的人/代表或作家/代理人关系

时间:2023-01-24 00:02:57

I'm a little confused how to model a writer-agent relationship using RDFa (Lite), schema.org and FOAF. I'm not even sure if I need FOAF.

我有点困惑如何使用RDFa(Lite),schema.org和FOAF建模作家 - 代理关系。我甚至不确定我是否需要FOAF。

Let's say I publish a book, me being the writer and represented by an agent. So we have two Persons, one is me and one is the agent. To clarify, my intention is to link the agent as a contact point for the writer, while at the same time indicating that the writer is me, the subject of the page:

假设我出版一本书,我是作家,代理人代理。所以我们有两个人,一个是我,一个是代理人。为了澄清,我的目的是将代理链接为作者的联络点,同时指示作者是我,页面的主题:

<!-- the agent representing me -->
<div resource="/Writecorp/Michael Stern" vocab="http://schema.org/" typeof="Person">
    <span property="name">Michael Stern</span>
    <div property="memberOf">
        <div typeof="Organization">
            <span property="name">Writecorp Inc. agency</span>
        </div>
    </div>
</div>

<!-- the writer, me -->
<div rel="me" vocab="http://schema.org/" typeof="Person">
    <link rel="agent" property="contactPoint" href="/Writecorp/Michael Stern" />
    <span property="name">H. P. Lovecraft</span>
</div>

The <link> solution I gleaned from https://*.com/a/19389163/441662.

我从https://*.com/a/19389163/441662收集的 解决方案。

When I feed this to the RDFa 1.1 Distiller and Parser, it shows the following output:

当我将它提供给RDFa 1.1 Distiller和Parser时,它显示以下输出:

@prefix ns1: <http://www.w3.org/ns/rdfa#> .
@prefix ns2: <http://schema.org/> .

<> ns2:me [ a ns2:Person;
            ns2:contactPoint </Writecorp/Michael Stern>;
            ns2:name "H. P. Lovecraft" ];
    ns1:usesVocabulary ns2: .

</Writecorp/Michael Stern> a ns2:Person;
    ns2:memberOf """

                Writecorp Inc. agency

        """;
    ns2:name "Michael Stern" .

[] a ns2:Organization;
    ns2:name "Writecorp Inc. agency" .
  • Did it recognize rel="me" properly? It is showing ns1:me, but I can't find anything about it in the referred namespace vocabulary, schema.org. Should I use a FOAF prefix and then use foaf:me? I can't find many examples on that either.
  • 它是否正确识别了rel =“me”?它显示了ns1:me,但我在引用的命名空间词汇表schema.org中找不到任何关于它的内容。我应该使用FOAF前缀然后使用foaf:me?我也找不到很多这方面的例子。

  • How do I model the agent as a contactPoint relationship? According to schema.org and Google's testing tool, a Person is not allowed to be a contactPoint.
  • 如何将代理建模为contactPoint关系?根据schema.org和Google的测试工具,不允许Person成为contactPoint。


Solution?

One solution proposed further down is to have an entity that is both a ContactPoint and a Person, but Google's validator doesn't seem to like it much.

进一步提出的一个解决方案是拥有一个既是ContactPoint又是Person的实体,但Google的验证器似乎并不喜欢它。

Another possible solution is to have both agent and writer point to the same ContactPoint resource (see https://*.com/a/30055747/441662).

另一种可能的解决方案是让代理和编写器指向相同的ContactPoint资源(请参阅https://*.com/a/30055747/441662)。

Concerning rel="me", that came from a microformats example and is not possible with schema.org (yet, as @unor states in his answer) or foaf.

关于rel =“me”,这来自一个微格式的例子,并且不能用schema.org(但是,正如@unor在他的回答中陈述的那样)或者foaf。


/edit 7-5-2015: I raised a GitHub issue for this problem. I'll update this post when I learn more...

/编辑7-5-2015:我针对此问题提出了GitHub问题。当我了解更多信息时,我会更新这篇文章...

2 个解决方案

#1


While agent is a Schema.org property, its domain is Action (which you don’t seem to intend). And it’s neither a FOAF property nor a registered link type (so it must not be used in HTML5). So I guess you’d have to find an appropriate property instead.

虽然agent是Schema.org属性,但它的域是Action(您似乎并不打算这样做)。它既不是FOAF属性也不是注册链接类型(因此不能在HTML5中使用)。所以我想你必须找到一个合适的房产。

me is a link type, not a Schema.org or FOAF property. But as you are using vocab, the RDFa parser assumes that it’s a property from the default vocabulary (Schema.org, in your case). I’m not sure if you really intend to use it as link type (as you are using in the RDFa-way on non-link elements).

我是一种链接类型,而不是Schema.org或FOAF属性。但是当您使用vocab时,RDFa解析器假定它是默认词汇表中的属性(在您的情况下为Schema.org)。我不确定你是否真的打算将它用作链接类型(因为你在非链接元素的RDFa方式中使用它)。

(If the use of link types is intended, a possible solution is to use prefix instead of vocab. This way, unprefixed values of rel are interpreted as link types, prefixed values as properties.)

(如果打算使用链接类型,可能的解决方案是使用前缀而不是词汇。这样,rel的无前缀值被解释为链接类型,前缀值作为属性。)

If using Schema.org, the book would be of type Book. You would be the author of this Book.
You’d have to check the available properties for Book (if the agent is related to your work, not your person) or Person (or Organization if it’s your business) if Schema.org offers a suitable property for specifying your agent. Ah, I missed that the agent should be a ContactPoint. Now, I doubt if Schema.org intended that this type could also refer to organizations or persons, but I guess nothing is stopping you from stating that something is a ContactPoint and an Organization.

如果使用Schema.org,该书将为Book类型。你将成为本书的作者。如果Schema.org提供了用于指定代理的合适属性,则必须检查Book的可用属性(如果代理与您的工作相关,而不是您的人)或Person(或组织,如果这是您的业务)。啊,我错过了代理应​​该是一个ContactPoint。现在,我怀疑Schema.org是否打算这种类型也可以引用组织或个人,但我想没有什么能阻止你说明某些东西是ContactPoint和一个组织。

Regarding resource (or about): Yes, it’s usually better to provide URIs for your entities instead of using blank nodes. That way, you and others can make statements about these entities, in the same or a different document.

关于资源(或关于):是的,通常更好的是为您的实体提供URI而不是使用空白节点。这样,您和其他人可以在相同或不同的文档中对这些实体进行陈述。

So ideally, you would give every entity an URI (including yourself, different to the document’s URI).

理想情况下,您可以为每个实体提供一个URI(包括您自己,与文档的URI不同)。

For example, on the web page http://example.com/lovecraft, you could have:

例如,在网页http://example.com/lovecraft上,您可以:

<body prefix="schema: http://schema.org/">

  <div typeof="schema:Person" resource="#me"></div>

  <div typeof="schema:Organization schema:ContactPoint" resource="#agent"></div>

  <div typeof="schema:Book" resource="#book-1"></div>

</body>

Now your URI is http://example.com/lovecraft#me (this represents you, the person, not the page about you), your agent’s organization has the URI http://example.com/lovecraft#agent, your book has the URI http://example.com/lovecraft#book-1.

现在你的URI是http://example.com/lovecraft#me(这代表你,这个人,而不是关于你的页面),你的代理商的组织有你的书http://example.com/lovecraft#agent,你的书有URI http://example.com/lovecraft#book-1。

This allows you to make statements about these, in various ways, e.g.:

这允许您以各种方式对这些做出陈述,例如:

<body prefix="schema: http://schema.org/">

  <div typeof="schema:Person" resource="#me">
    <link property="schema:contactPoint" href="#agent" />
    <link property="schema:author" href="#book-1" />
  </div>

  <div typeof="schema:Organization schema:ContactPoint" resource="#agent"></div>

  <div typeof="schema:Book" resource="#book-1"></div>

</body>

To state that the page (http://example.com/lovecraft) is about you (http://example.com/lovecraft#me), you could wait for Schema.org’s mainEntity property (included in the next release), and/or use Schema.org’s about property, and/or use FOAF’s isPrimaryTopicOf property.

要声明该页面(http://example.com/lovecraft)与您有关(http://example.com/lovecraft#me),您可以等待Schema.org的mainEntity属性(包含在下一个版本中),和/或使用Schema.org关于属性,和/或使用FOAF的isPrimaryTopicOf属性。

#2


One option is to have both agent and writer point to the same ContactPoint resource.

一种选择是让代理和编写器指向同一个ContactPoint资源。

This seems to work somewhat. This allows the proper markdown to format the agent and its contact details and at the same time have the writer point to the agent's contact details. However, this is still not relating the agent properly as a representative for the writer (i.e. don't deal with me, but with my agent). And I'm not sure how machine readers will handle this situation.

这似乎有点奏效。这允许正确的降价格式化代理及其联系人详细信息,同时让作者指向代理的联系人详细信息。然而,这仍然没有恰当地将代理人作为作者的代表(即不与我打交道,而是与我的经纪人打交道)。我不确定机器读者如何处理这种情况。

<!-- the agent representing me -->
<div resource="/Writecorp/MichaelStern" vocab="http://schema.org/" typeof="Person">
    <span property="name">Michael Stern</span>
    <link property="contactPoint" href="/Writecorp/MichaelStern#contact" />
    <div resource="/Writecorp/MichaelStern#contact" vocab="http://schema.org/" typeof="ContactPoint">
        <meta property="name" content="Michael Stern" />
        <div>Phone:
            <span property="telephone">(540) 961-4469</span>
        </div>
        <div>
            <a property="email" href="mailto:michael.stern@writecorp.inc.agency.com">michael.stern@writecorp.inc.agency.com</a>
        </div>
    </div>
    <div property="memberOf">
        <div typeof="Organization">
            <span property="name">Writecorp Inc. agency</span>
        </div>
    </div>
</div>

<!-- the writer, me -->
<div vocab="http://schema.org/" typeof="Person">
    <link property="contactPoint" href="/Writecorp/MichaelStern#contact" />
    <span property="name">H. P. Lovecraft</span>
</div>

Notice that the name property on ContactPoint is a meta tag instead of a normal span element. This is to prevent double name output, while giving machine readers a way to still populate their data model with a contact point name.

请注意,ContactPoint上的name属性是元标记而不是普通的span元素。这是为了防止双重名称输出,同时为机器读者提供了一种仍然使用联系点名称填充其数据模型的方法。

Turtle output in RDFa 1.1 Distiller and Parser:

RDFa 1.1 Distiller和Parser中的海龟输出:

@prefix ns1: <http://www.w3.org/ns/rdfa#> .
@prefix ns2: <http://schema.org/> .

<> ns1:usesVocabulary ns2: .

</Writecorp/MichaelStern> a ns2:Person;
    ns2:contactPoint </Writecorp/MichaelStern#contact>;
    ns2:memberOf """

            Writecorp Inc. agency

    """;
    ns2:name "Michael Stern" .

</Writecorp/MichaelStern#contact> a ns2:ContactPoint;
    ns2:email <mailto:michael.stern@writecorp.inc.agency.com>;
    ns2:name "Michael Stern";
    ns2:telephone "(540) 961-4469" .

[] a ns2:Person;
    ns2:contactPoint </Writecorp/MichaelStern#contact>;
    ns2:name "H. P. Lovecraft" .

[] a ns2:Organization;
    ns2:name "Writecorp Inc. agency" .

/edit 7-5-2015: I raised a GitHub issue for this problem. I'll update this post when I learn more...

/编辑7-5-2015:我针对此问题提出了GitHub问题。当我了解更多信息时,我会更新这篇文章...

#1


While agent is a Schema.org property, its domain is Action (which you don’t seem to intend). And it’s neither a FOAF property nor a registered link type (so it must not be used in HTML5). So I guess you’d have to find an appropriate property instead.

虽然agent是Schema.org属性,但它的域是Action(您似乎并不打算这样做)。它既不是FOAF属性也不是注册链接类型(因此不能在HTML5中使用)。所以我想你必须找到一个合适的房产。

me is a link type, not a Schema.org or FOAF property. But as you are using vocab, the RDFa parser assumes that it’s a property from the default vocabulary (Schema.org, in your case). I’m not sure if you really intend to use it as link type (as you are using in the RDFa-way on non-link elements).

我是一种链接类型,而不是Schema.org或FOAF属性。但是当您使用vocab时,RDFa解析器假定它是默认词汇表中的属性(在您的情况下为Schema.org)。我不确定你是否真的打算将它用作链接类型(因为你在非链接元素的RDFa方式中使用它)。

(If the use of link types is intended, a possible solution is to use prefix instead of vocab. This way, unprefixed values of rel are interpreted as link types, prefixed values as properties.)

(如果打算使用链接类型,可能的解决方案是使用前缀而不是词汇。这样,rel的无前缀值被解释为链接类型,前缀值作为属性。)

If using Schema.org, the book would be of type Book. You would be the author of this Book.
You’d have to check the available properties for Book (if the agent is related to your work, not your person) or Person (or Organization if it’s your business) if Schema.org offers a suitable property for specifying your agent. Ah, I missed that the agent should be a ContactPoint. Now, I doubt if Schema.org intended that this type could also refer to organizations or persons, but I guess nothing is stopping you from stating that something is a ContactPoint and an Organization.

如果使用Schema.org,该书将为Book类型。你将成为本书的作者。如果Schema.org提供了用于指定代理的合适属性,则必须检查Book的可用属性(如果代理与您的工作相关,而不是您的人)或Person(或组织,如果这是您的业务)。啊,我错过了代理应​​该是一个ContactPoint。现在,我怀疑Schema.org是否打算这种类型也可以引用组织或个人,但我想没有什么能阻止你说明某些东西是ContactPoint和一个组织。

Regarding resource (or about): Yes, it’s usually better to provide URIs for your entities instead of using blank nodes. That way, you and others can make statements about these entities, in the same or a different document.

关于资源(或关于):是的,通常更好的是为您的实体提供URI而不是使用空白节点。这样,您和其他人可以在相同或不同的文档中对这些实体进行陈述。

So ideally, you would give every entity an URI (including yourself, different to the document’s URI).

理想情况下,您可以为每个实体提供一个URI(包括您自己,与文档的URI不同)。

For example, on the web page http://example.com/lovecraft, you could have:

例如,在网页http://example.com/lovecraft上,您可以:

<body prefix="schema: http://schema.org/">

  <div typeof="schema:Person" resource="#me"></div>

  <div typeof="schema:Organization schema:ContactPoint" resource="#agent"></div>

  <div typeof="schema:Book" resource="#book-1"></div>

</body>

Now your URI is http://example.com/lovecraft#me (this represents you, the person, not the page about you), your agent’s organization has the URI http://example.com/lovecraft#agent, your book has the URI http://example.com/lovecraft#book-1.

现在你的URI是http://example.com/lovecraft#me(这代表你,这个人,而不是关于你的页面),你的代理商的组织有你的书http://example.com/lovecraft#agent,你的书有URI http://example.com/lovecraft#book-1。

This allows you to make statements about these, in various ways, e.g.:

这允许您以各种方式对这些做出陈述,例如:

<body prefix="schema: http://schema.org/">

  <div typeof="schema:Person" resource="#me">
    <link property="schema:contactPoint" href="#agent" />
    <link property="schema:author" href="#book-1" />
  </div>

  <div typeof="schema:Organization schema:ContactPoint" resource="#agent"></div>

  <div typeof="schema:Book" resource="#book-1"></div>

</body>

To state that the page (http://example.com/lovecraft) is about you (http://example.com/lovecraft#me), you could wait for Schema.org’s mainEntity property (included in the next release), and/or use Schema.org’s about property, and/or use FOAF’s isPrimaryTopicOf property.

要声明该页面(http://example.com/lovecraft)与您有关(http://example.com/lovecraft#me),您可以等待Schema.org的mainEntity属性(包含在下一个版本中),和/或使用Schema.org关于属性,和/或使用FOAF的isPrimaryTopicOf属性。

#2


One option is to have both agent and writer point to the same ContactPoint resource.

一种选择是让代理和编写器指向同一个ContactPoint资源。

This seems to work somewhat. This allows the proper markdown to format the agent and its contact details and at the same time have the writer point to the agent's contact details. However, this is still not relating the agent properly as a representative for the writer (i.e. don't deal with me, but with my agent). And I'm not sure how machine readers will handle this situation.

这似乎有点奏效。这允许正确的降价格式化代理及其联系人详细信息,同时让作者指向代理的联系人详细信息。然而,这仍然没有恰当地将代理人作为作者的代表(即不与我打交道,而是与我的经纪人打交道)。我不确定机器读者如何处理这种情况。

<!-- the agent representing me -->
<div resource="/Writecorp/MichaelStern" vocab="http://schema.org/" typeof="Person">
    <span property="name">Michael Stern</span>
    <link property="contactPoint" href="/Writecorp/MichaelStern#contact" />
    <div resource="/Writecorp/MichaelStern#contact" vocab="http://schema.org/" typeof="ContactPoint">
        <meta property="name" content="Michael Stern" />
        <div>Phone:
            <span property="telephone">(540) 961-4469</span>
        </div>
        <div>
            <a property="email" href="mailto:michael.stern@writecorp.inc.agency.com">michael.stern@writecorp.inc.agency.com</a>
        </div>
    </div>
    <div property="memberOf">
        <div typeof="Organization">
            <span property="name">Writecorp Inc. agency</span>
        </div>
    </div>
</div>

<!-- the writer, me -->
<div vocab="http://schema.org/" typeof="Person">
    <link property="contactPoint" href="/Writecorp/MichaelStern#contact" />
    <span property="name">H. P. Lovecraft</span>
</div>

Notice that the name property on ContactPoint is a meta tag instead of a normal span element. This is to prevent double name output, while giving machine readers a way to still populate their data model with a contact point name.

请注意,ContactPoint上的name属性是元标记而不是普通的span元素。这是为了防止双重名称输出,同时为机器读者提供了一种仍然使用联系点名称填充其数据模型的方法。

Turtle output in RDFa 1.1 Distiller and Parser:

RDFa 1.1 Distiller和Parser中的海龟输出:

@prefix ns1: <http://www.w3.org/ns/rdfa#> .
@prefix ns2: <http://schema.org/> .

<> ns1:usesVocabulary ns2: .

</Writecorp/MichaelStern> a ns2:Person;
    ns2:contactPoint </Writecorp/MichaelStern#contact>;
    ns2:memberOf """

            Writecorp Inc. agency

    """;
    ns2:name "Michael Stern" .

</Writecorp/MichaelStern#contact> a ns2:ContactPoint;
    ns2:email <mailto:michael.stern@writecorp.inc.agency.com>;
    ns2:name "Michael Stern";
    ns2:telephone "(540) 961-4469" .

[] a ns2:Person;
    ns2:contactPoint </Writecorp/MichaelStern#contact>;
    ns2:name "H. P. Lovecraft" .

[] a ns2:Organization;
    ns2:name "Writecorp Inc. agency" .

/edit 7-5-2015: I raised a GitHub issue for this problem. I'll update this post when I learn more...

/编辑7-5-2015:我针对此问题提出了GitHub问题。当我了解更多信息时,我会更新这篇文章...