Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exampleOfWork and workExample lack JSON-LD example #471

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

exampleOfWork and workExample lack JSON-LD example #471

Aaranged opened this issue May 5, 2015 · 10 comments
Assignees
Labels
guidelines docs examples Work on our supporting materials rather than on schema definitions

Comments

@Aaranged
Copy link

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 danbri added the guidelines docs examples Work on our supporting materials rather than on schema definitions label May 6, 2015
@danbri
Copy link
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
Copy link
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
Copy link
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
Copy link
Contributor

danbri commented May 6, 2015

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

@Dataliberate
Copy link
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
Copy link
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 added a commit to dbs/schemaorg that referenced this issue May 7, 2015
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 schemaorg#471.

Signed-off-by: Dan Scott <dan@coffeecode.net>
dbs added a commit to dbs/schemaorg that referenced this issue May 7, 2015
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 schemaorg#471.

Signed-off-by: Dan Scott <dan@coffeecode.net>
@dbs
Copy link
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
Copy link
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
Copy link
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
Copy link
Contributor

danbri commented May 12, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidelines docs examples Work on our supporting materials rather than on schema definitions
Projects
None yet
Development

No branches or pull requests

4 participants