1

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.

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://stackoverflow.com/a/19389163/441662.

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

@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.
  • 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.

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.

Another possible solution is to have both agent and writer point to the same ContactPoint resource (see https://stackoverflow.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.


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

Community
  • 1
  • 1
Benny Bottema
  • 11,111
  • 10
  • 71
  • 96

2 Answers2

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.

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).

(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.)

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.

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.

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

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

<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.

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.

Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360
  • To clarify, my intention is to link an agent as a contactpoint for the writer, while at the same time indicating that the writer is _me_, the subject of the page. – Benny Bottema May 05 '15 at 12:18
  • I updated my post with some details as well and a specific question as to how to model the _agent as a contactPoint_ relationship. – Benny Bottema May 05 '15 at 12:42
  • @Plantface: I updated my answer. As mentioned, I don’t think Schema.org intends that `ContactPoint` could be an `Organization`/`Person`, so it’s kind of a stretch. However, you could state that something is both, an `Organization` and a `ContactPoint` (which would not be allowed in Microdata if you are using properties from only one of these types; but in RDFa, it’s valid). The probably better solution would be to use a property that actually references an editor (if Schema.org doesn’t have one, you could propose it), or use `ContactPoint` without conveying that it’s your agent’s. – unor May 05 '15 at 12:49
  • Thank you so far for your effort. What about using absolute resource identifiers? Would it be reasonable to speak in absolute terms in favor of encapsulation and being able to move entities around without breaking references? – Benny Bottema May 05 '15 at 12:55
  • @Plantface: Do you mean specifying `resource="http://example.com/lovecraft#me"` instead of `resource="#me"`? Yes, that’s fine/reasonable. Of course you don’t have to mint new URIs if there already exist suitable ones, but if creating your own, see also [Cool URIs for the Semantic Web](http://www.w3.org/TR/cooluris/), especially the [choice between 303 and hash URIs](http://stackoverflow.com/a/16017139/1591669) – unor May 05 '15 at 13:04
  • Oh, and if your markup allows it, you could of course still nest it accordingly instead of relying on the URIs (while specifying the URIs in addition). This *might* (I don’t know any specific examples, just a guess) get you better support from consumers that don’t go the full RDFa way (e.g., parsing it more like Microdata). – unor May 05 '15 at 13:09
  • No dice, there. I wish to represent the writer and its agent separately, yet give, machine readers a way to correlate between them. – Benny Bottema May 05 '15 at 13:16
  • RDFa Google schema.org validator doesn't seem to support entities that are both a `ContactPoint` and a `Person`, so I wonder if Google's crawlers would be able to work with it. Maybe a workaround is to have a proper agent `ContactPoint` which has a [sameAs](https://schema.org/sameAs) reference to the actual agent `Person` resource? – Benny Bottema May 05 '15 at 13:35
  • Or even have both the agent and the writer point to the same `ContactPoint` resource? – Benny Bottema May 05 '15 at 13:42
  • I amended my post with a sort of work-around at the end. I'm not too happy with it, but it works for now. To prevent a double _name_ property, I made the one on `contactPoint` a meta element. – Benny Bottema May 05 '15 at 14:24
0

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

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.

Turtle output in RDFa 1.1 Distiller and 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...

Benny Bottema
  • 11,111
  • 10
  • 71
  • 96