exampleOfWork and workExample lack JSON-LD example #471

Closed
Aaranged opened this Issue May 5, 2015 · 10 comments

Projects

None yet

4 participants

@Aaranged
Aaranged commented May 5, 2015

schema.org/exampleOfWork and its inverse property, schema.org/workExample, both lack JSON-LD examples. They both have microdata and RDFa examples, but the JSON-LD is present but empty (and without any explanation about why it's empty).

@danbri danbri self-assigned this May 6, 2015
@danbri danbri added this to the sdo-gozer release milestone May 6, 2015
@danbri
Contributor
danbri commented May 6, 2015

Thanks. Not sure what happened there. @dbs @dataliberate any idea?

Here's a quick first pass.

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@graph": 
  [
    {
      "@id": "http://www.freebase.com/m/0h35m",
      "@type": "Book",
      "name": "The Fellowship of the Ring",
      "author": "J.R.R Tolkien",
      "publisher":
      {
        "@type": "Organization",
        "location": "United Kingdom",
        "name": "George Allen & Unwin"
      }, 
      "datePublished": "1974",
      "isbn": "0007149212",
      "workExample": 
      {
         "@type": "Book",
         "publisher":
         {
           "@type": "Organization",
           "location": "United Kingdom",
           "name": "Ballantine"
         },
         "isbn": "0345296052"
      }
    }, 
    {
      "@type": "Movie",
      "exampleOfWork": { "@id": "http://www.freebase.com/m/0h35m" },
      "name": "The Lord of the Rings: The Fellowship of the Ring",
      "director": "Peter Jackson",
      "datePublished": "2001",
      "duration": "PT178M"
    }
  ]
}
</script>
@danbri
Contributor
danbri commented May 6, 2015

I think we also ought to say ""The Fellowship of the Ring" instead of "The Fellowship of the Ring_s_"

@Dataliberate
Contributor

The RDFa didn't parse well so I started again from the Microdata:

RDFA:

<div vocab="http://schema.org/">
<p typeof="Book" resource="http://www.freebase.com/m/0h35m">
    <em property="name">The Fellowship of the Ring</em> was written by
    <span property="author">J.R.R Tolkien</span> and was originally published
    in the <span property="publisher"  typeof="Organization">
        <span property="location">United Kingdom</span> by 
        <span property="name">George Allen &amp; Unwin</span>
    </span> in <time property="datePublished">1954</time>.
    The book has been republished many times, including editions by 
    <span property="workExample" typeof="Book">
        <span property="publisher" typeof="Organization">
            <span property="name">HarperCollins</span>
        </span> in <time property="datePublished">1974</time>
        (ISBN: <span property="isbn">0007149212</span>)
    </span> and by 
    <span property="workExample" typeof="Book">
        <span property="publisher" typeof="Organization">
            <span property="name">Ballantine</span>
        </span> in <time property="datePublished">1984</time>
        (ISBN: <span property="isbn">0345296052</span>).
    </span>
</p>
<p>
    The book has also been adapted for the screen several times.
    <span typeof="Movie">
        <link property="exampleOfWork" href="http://www.freebase.com/m/0h35m"/>
        <em property="name">J.R.R. Tolkien's The Lord of the Rings</em>, an
        animated version directed by <span property="director">Ralph Bakshi</span>
        and released in <time property="datePublished">1978</time>, covered the
        events of the novel and parts of its sequel.
    </span>
    <span typeof="Movie">
        <link property="exampleOfWork" href="http://www.freebase.com/m/0h35m"/>
        The movie <em property="name">The Lord of the Rings: The Fellowship of the
        Ring</em>, directed by <span property="director">Peter Jackson</span> and
        released in <time property="datePublished">2001</time>, ran
        <time property="duration" datetime="PT178M">178</time> minutes long in its
        theatrical release.
    </span>
</p>
</div>

JSON:

<script type="application/ld+json">
{
  "@context": {
    "schema": "http://schema.org/"
  },
  "@graph": [
    {
      "@id": "http://www.freebase.com/m/0h35m",
      "@type": "schema:Book",
      "schema:author": "J.R.R Tolkien",
      "schema:datePublished": "1954",
      "schema:name": "The Fellowship of the Ring",
      "schema:publisher": {
          "@type": "schema:Organization",
          "schema:location": "United Kingdom",
          "schema:name": "George Allen & Unwin"
      },
      "schema:workExample": [
    {
      "@type": "schema:Book",
      "schema:datePublished": "1974",
      "schema:isbn": "0007149212",
      "schema:publisher": {
          "@type": "schema:Organization",
          "schema:name": "HarperCollins"
      }
    },
    {
      "@type": "schema:Book",
      "schema:datePublished": "1984",
      "schema:isbn": "0345296052",
      "schema:publisher": {
          "@type": "schema:Organization",
          "schema:name": "Ballantine"
      }
    }
      ]
    },
    {
      "@type": "schema:Movie",
      "schema:datePublished": "2001",
      "schema:director": "Peter Jackson",
      "schema:duration": "PT178M",
      "schema:name": "The Lord of the Rings: The Fellowship of the Ring",
      "schema:exampleOfWork": {
        "@id": "http://www.freebase.com/m/0h35m"
      }
    },
    {
      "@type": "schema:Movie",
      "schema:datePublished": "1978",
      "schema:director": "Ralph Bakshi",
      "schema:name": "J.R.R. Tolkien's The Lord of the Rings",
      "schema:exampleOfWork": {
        "@id": "http://www.freebase.com/m/0h35m"
      }
    }
  ]
}
</script>

@danbri
Contributor
danbri commented May 6, 2015

@Dataliberate - did we both just do the same thing in parallel? see my version above...

@Dataliberate
Contributor

I did the RDFa and the JSON for the full Microdata.

Just spotted a typo in the RDFa I posted - the '&' on line 7 needs to be escaped as &amp;

@dbs
Contributor
dbs commented May 7, 2015

@danbri To address "what happened?", I think the development of the original examples predated the general availability of JSON-LD examples for most types. Note that the JSON-LD example that @Dataliberate provided more faithfully matches the source microdata / RDFa examples. Pull request forthcoming accordingly.

@Dataliberate Can you define what you mean by "the RDFa didn't parse well"? The existing RDFa seems to parse just fine in both linter.structured-data.org and Google's structured data testing tool. If it's just a matter of changing <meta ... href> to <link ... href>, sure, that's arguably more correct. But due to historical (mal)practice schema.org parsers accept the meta...href formulation. I'll open a separate issue for that so that we can hit all of the <meta...href> examples globally.

@dbs dbs added a commit to dbs/schemaorg that referenced this issue May 7, 2015
@dbs dbs Add JSON-LD example for workExample / exampleOfWork
The workExample / exampleOfWork property examples were missing a JSON-LD
example. This fills in that missing piece, based on an example that Richard
Wallis provided.

Fixes #471.

Signed-off-by: Dan Scott <dan@coffeecode.net>
fb60b9b
@dbs dbs added a commit to dbs/schemaorg that referenced this issue May 7, 2015
@dbs dbs Add JSON-LD example for workExample / exampleOfWork
The workExample / exampleOfWork property examples were missing a JSON-LD
example. This fills in that missing piece, based on an example that Richard
Wallis provided.

Fixes #471.

Signed-off-by: Dan Scott <dan@coffeecode.net>
7d7ac57
@dbs
Contributor
dbs commented May 7, 2015

Looks like #77 is already covering some of the <meta ... href> space (although the focus there was on the more worrisome <meta ... content="http://example.com"> usage).

@danbri
Contributor
danbri commented May 7, 2015

@Dataliberate - I fixed the & above. (I guess I get an edit button as I'm an admin?)

For the JSON, wouldn't it be simpler without schema: everywhere?

@dbs
Contributor
dbs commented May 7, 2015

Note that the branch in pull request #477 uses the JSON-LD provided by @DataLiberate as a base, with the schema: prefix stripped and minor changes to the indentation.

@danbri danbri closed this in #477 May 12, 2015
@danbri
Contributor
danbri commented May 12, 2015

Thanks everyone! I've just merged the pull request from @dbs :)

@danbri danbri added a commit that referenced this issue May 12, 2015
@danbri danbri Noted fix for #471 78caf73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment