Re: how do I copy some properties that are part of a bigger pattern

On Mar 8, 2014, at 5:50 PM, Jarno van Driel <jarnovandriel@gmail.com> wrote:

> "..the @resource attributes get in the way.."
> Could you explain this to me a bit more please Gregg? Because if I parse my last markup through the Structured data linter and RDFa Play I get 100% the same outcome as with your markup. Yandex and Google see the same data as well (in a ever so slightly different manner).
> 
> When I look at the output these parsers have no trouble extracting the @resources as different rdfanodes. Unless I'm completely overlooking something, or am breaking some cardinal rules, which both are feasible since I just got around to looking more deeply into RDFa Lite. 

In order to be able to reference the publisher-uri and publisher-description information as patterns, they need to have an identifier, which I supplied by adding @resource (and @typeof=“rdfa:Pattern) to each. However, this changes the scope of their properties relative to the copyright-holder.

In you’re RDFa version you weren’t able to access the publisher-uri or publisher-description, as you do from Microdata. The RDFa property copying uses a resource of type rdfa:Pattern, which must be identified as a resource. For this reason, I added the @resource and @typeof for both the publisher-description and publisher-url. However, doing that, changes the current subject for each of these, so the “url” and “description” properties are allocated to different resources. To get around this, I added the rdfa:copy properties both the the publisher reference, and to the copyright-holder, so that the properties appear in each of them. I wouldn’t recommend the use of included patterns in RDFa, but it can be made to work.

I’d recommend both for Microdata and RDFa to keep references simple, and using included references, while possible, can make things more confusing. This is certainly not a pattern we were concerned about when crafting the property copying mechanism in HTML+RDFa. They two really work quite differently: Microdata requires full access to the DOM so that referenced elements can be copied, which requires random access to the DOM. The RDFa mechanism operates at a semantic level, by creating triples as normal. RDFa is intended to work with streaming processors, where there is no random-access to the DOM. The spec provides details of the rules which are applied to achieve the effect of property copying [1], but it’s not really magic to RDFa, and could just as easily be done for triples extracted from Turtle, or even Microdata, if the appropriate copying rules were applied.

I understood that you didn’t know how to deal with a pattern embedded in another pattern, which I attempted to address for you. I think that the RDFa I provided does essentially what your Microdata does. If you want to discuss more, we should probably meet on IRC.

Gregg

P.S., I think it’s great that you’re trying to describe this for a wider audience!

[1] http://www.w3.org/TR/rdfa-in-html/#implementing-property-copying


> 2014-03-09 1:33 GMT+01:00 Gregg Kellogg <gregg@greggkellogg.net>:
> Hi Jarno, I don’t think you can do precicely what you want, since if a pattern is included in another pattern, the @resource attributes get in the way. You can do it by adding some more rdfa:copy properties. This is what I came up with:
> 
> <body vocab="http://schema.org/" resource="#item-page" typeof="ItemPage">
>   <link property="rdfa:copy" href="#copyright-holder">
> 
>   <article property="text">
>     <div resource="#article" typeof="Article">
>       <div property="publisher" typeof="Corporation">
>         <link property="rdfa:copy" href="#publisher-url"/>
>         <link property="rdfa:copy" href="#publisher-description"/>
>       </div>
> 
> 
>       <h1 property="Name">How to copy properties in RDFa Lite &amp; Microdata</h1>
>     </div>
>   </article>
> 
>   <footer property="mentions" typeof="WPFooter">
>     <div property="text">
>       <p resource="#copyright-holder" typeof="rdfa:Pattern">
>         <span property="copyrightHolder" typeof="Corporation">
>           <link property="rdfa:copy" href="#publisher-url"/>
>           <link property="rdfa:copy" href="#publisher-description"/>
>           <span resource="#publisher-url" typeof="rdfa:Pattern">
>             <a id="publisher-url" property="url" href="http://www.example.org" title>
>               <span property="name">Corporation name</span>
>             </a>
>           </span>
> 
>           <span resource="#publisher-description" typeof="rdfa:Pattern">
>             <span id="publisher-description" property="description">Corporation description</span>
>           </span>
>         </span>
>       </p>
>     </div>
>   </footer>
> </body>
> 
> Gregg Kellogg
> gregg@greggkellogg.net
> 
> On Mar 8, 2014, at 2:37 PM, Jarno van Driel <jarnovandriel@gmail.com> wrote:
> 
>> <body vocab="http://schema.org/" resource="#item-page" typeof="ItemPage">
>> 	<link property="rdfa:copy" href="#copyright-holder">
>> 
>> 	<article property="text">
>> 		<div resource="#article" typeof="Article">
>> 			<link property="publisher" typeof="Corporation" href=?????>
>> 
>> 
>> 			<h1 property="Name">How to copy properties in RDFa Lite & Microdata</h1>
>> 		</div>
>> 	</article>
>> 
>> 	<footer property="mentions" typeof="WPFooter">
>> 		<div property="text">
>> 			<p resource="#copyright-holder" typeof="rdfa:Pattern">
>> 				<span property="copyrightHolder" typeof="Corporation">
>> 					<a id="publisher-url" property="url" href="http://www.example.org" title>
>> 						<span property="name">Corporation name</span>
>> 					</a>
>> 
>> 					<span id="publisher-description" property="description">Corporation description</span>
>> 				</span>
>> 			</p>
>> 		</div>
>> 	</footer>
>> </body>
>> 
> 
> 

Received on Sunday, 9 March 2014 05:46:56 UTC