Re: duplicate properties or duplicate content?

Hi Gunnar,

On Tue, May 5, 2015 at 8:10 AM, Gunnar Bittersmann <gunnar@bittersmann.de>
wrote:

> Hi there,
> Is there any way in RFDa to gather related property values that are
> distributed across the document?
>

Absolutely. In RDFa, you can assign an identifier to the objects described,
using the @resource attribute, and then describe that resource in other
parts of the page. (Or in other documents, although I wouldn't expect
search engines to collate that data any time soon.)


> Example: `addressLocality` and `streetAddress` in:
>
> On their Earth-wide tour the Kronos ensemble “Art Is a Weapon” will guest
> on 9 May 2315 at Warsaw’s Och-teatr to perform Wil'yam Shex'pir’s “Hamlet”
> in original Klingon language.
> Address: Grójecka 65, begin 20:00
>
> For “Warsaw” and “Och-teatr” I would open a `location` container:
>
> <article typeof="TheaterEvent" vocab="http://schema.org/">
>    <p>…at
>        <span property="location" typeof="PerformingArtsTheater">
>            <span property="address" typeof="PostalAddress">
>                <span property="addressLocality">Warsaw</span>’s
>            </span>
>            <span property="name" lang="pl">Och-teatr</span>
>        </span>
>        to perform
>        <span property="workPerformed" typeof="CreativeWork">…</span>
>    </p>
>
> The `location` container has to be closed because it’s followed by
> information that belongs into the `workPerformed` container.
>
> In the next paragraph, `location` information continues:
>
>    <p>
>        <span property="location" typeof="PerformingArtsTheater">
>    Address:
>            <span property="address" typeof="PostalAddress">
>                <span property="streetAddress"><span
> lang="pl">Grójecka</span> 65</span>, …
>            </span>
>        </span>
>        …
>    </p>
> </article>
>
> Using the `performance` predicate twice does not mean that their object
> nodes are identical, does it? Is there any way to make them the same?
>

You are correct that these nodes don't become identical. To get what you
want, use @resource like this:

    <article typeof="TheaterEvent" vocab="http://schema.org/">
       <p>…at
           <span property="location" typeof="PerformingArtsTheater">
               <span property="address" typeof="PostalAddress"
resource="_:addr1">
                   <span property="addressLocality">Warsaw</span>’s
               </span>
               <span property="name" lang="pl">Och-teatr</span>
           </span>
           to perform
           <span property="workPerformed" typeof="CreativeWork">…</span>
       </p>
       <p>
        <span>
          Address:
          <span resource="_:addr1">
            <span property="streetAddress"><span lang="pl">Grójecka</span>
65</span>, …
          </span>
        </span>
        …
       </p>
    </article>

Note that you don't have to link and type the resource twice, nor "wrap it"
repeatedly. In RDFa, resources are "free", and link to each other, either
implicitly, by nesting, or explicitly, using identifiers like above (it's a
graph, not a tree).

(Also, technically, these identifiers are either "local" (a.k.a. blank
nodes), which are named like above, by using the "_:" prefix. Or they are
full URLs. In your case, you can use the latter form by prepending "#"
instead of the "_:" prefix (e.g. resource="#addr1"). That really resolves
to the full page URL plus the fragment identifier hash (behaving just like
@href). But that is all technical.)

You can visualize the result of this data by pasting it into the RDFa
Playground at: http://rdfa.info/play/

Cheers,
Niklas



> Or would I have to notate all `location` information in one place, using
> `meta` elements?
>
> <article typeof="TheaterEvent" vocab="http://schema.org/">
>    <p>…at
>        <span property="location" typeof="PerformingArtsTheater">
>            <span property="address" typeof="PostalAddress">
>                <span property="addressLocality">Warsaw</span>’s
>                <meta property="streetAddress" content="Grójecka 65"/>
>            </span>
>            <span property="name" lang="pl">Och-teatr</span>
>        </span>
>        to perform
>        <span property="workPerformed" typeof="CreativeWork">…</span>
>    </p>
>
> And no further RDFa attributes down below?
>
>    <p>
> Address: <span lang="pl">Grójecka</span> 65, …
>        …
>    </p>
> </article>
>
> That would mean duplicated content: “Grójecka 65” appears twice. Is there
> any way to avoid this?
>
> Thanks,
> Gunnar
>
>

Received on Tuesday, 5 May 2015 07:50:53 UTC