Difference between revisions of "WebSchemas/RolesPattern"

From W3C Wiki
Jump to: navigation, search
(Examples)
(new examples of reification style)
Line 9: Line 9:
 
* [https://www.w3.org/wiki/images/2/22/RolesinSchema.orgMar26.pdf PDF] (Mar 26th draft), also available as a google [https://docs.google.com/document/d/1Cg-LZHHte1dDtkCZEQgo5WOrozzffQK8qLv83PyEZV4/edit?usp=sharing doc].
 
* [https://www.w3.org/wiki/images/2/22/RolesinSchema.orgMar26.pdf PDF] (Mar 26th draft), also available as a google [https://docs.google.com/document/d/1Cg-LZHHte1dDtkCZEQgo5WOrozzffQK8qLv83PyEZV4/edit?usp=sharing doc].
  
 +
 +
== Example 1 ==
 +
 +
''For example: JoeMontana was an athlete in the FootballTeam SF49ers, between a startDate of 2002 and an endDate of 2008; his position was that of QuarterBack.''
 +
 +
<syntaxhighlight lang="javascript">
 +
{
 +
    "@context": "http://schema.org/",
 +
    "@type": "AmericanFootballRole",
 +
    "roleSubject": {
 +
            "@type": "AmericanFootballTeam",
 +
            "name": "San Francisco 49ers"
 +
    },
 +
    "roleProperty": {
 +
        "http://schema.org/athlete"
 +
    },
 +
    "roleObject": {
 +
        "@type": "Person",
 +
        "name": "Joe Montana"
 +
    },
 +
    "startDate": "1979",
 +
    "endDate": "1992",
 +
    "position": "Quarterback"
 +
}
 +
</syntaxhighlight>
 +
 +
 +
== Example 2 ==
 +
 +
Ghostbusters actor BillMurray
 +
 +
<syntaxhighlight lang="javascript">
 +
{
 +
    "@context": "http://schema.org/",
 +
    "@type": "MovieRole",
 +
    "roleSubject": {
 +
            "@type": "Movie",
 +
            "name": "GhostBusters"
 +
    },
 +
    "roleProperty": {
 +
        "http://schema.org/actor"
 +
    },
 +
    "roleObject": {
 +
        "@type": "Person",
 +
        "name": "Bill Murray"
 +
    },
 +
    "characterName": "Dr. Peter Venkman"
 +
}
 +
</syntaxhighlight>
  
 
==Old Examples (from initial design sketches)==
 
==Old Examples (from initial design sketches)==

Revision as of 19:45, 17 April 2014


This is a WebSchemas proposal RolesPattern for schema.org. See Proposals listing for more. Status: Proposal



This page tracks a proposal from the schema.org team for modeling various kinds of roles and contributions in a way that allows rich qualification. For example, when we say that a Person was an actor in a Movie, we might want to mention their characterName too. When we say that a SportsTeam has a Person as an athlete, we might want to mention the position that they play, or the time period in which they fulfilled that role.

To achieve this, a type "Role" is proposed, alongside a new property, "hasRole".

Full details:

  • PDF (Mar 26th draft), also available as a google doc.


Example 1

For example: JoeMontana was an athlete in the FootballTeam SF49ers, between a startDate of 2002 and an endDate of 2008; his position was that of QuarterBack.

{
    "@context": "http://schema.org/",
     "@type": "AmericanFootballRole",
     "roleSubject": { 
            "@type": "AmericanFootballTeam",
            "name": "San Francisco 49ers"
     },
     "roleProperty": {
         "http://schema.org/athlete"
    },
    "roleObject": {
        "@type": "Person",
        "name": "Joe Montana"
    },
    "startDate": "1979",
    "endDate": "1992",
    "position": "Quarterback"
}


Example 2

Ghostbusters actor BillMurray

{
    "@context": "http://schema.org/",
     "@type": "MovieRole",
     "roleSubject": { 
            "@type": "Movie",
            "name": "GhostBusters"
     },
     "roleProperty": {
         "http://schema.org/actor"
    },
    "roleObject": {
        "@type": "Person",
        "name": "Bill Murray"
    },
    "characterName": "Dr. Peter Venkman"
}

Old Examples (from initial design sketches)

hasRole/inRole in RDFa

Note that this example is an exploratory variation on the main proposal. It distinguishes between 'hasRole' and 'inRole'.

The original design circulated March 26th had a complication: it wanted a role-oriented property linking the Movie to the Role, and also the Person to the Role. To achieve this, local identifiers for the role were used (in JSON-LD syntax). Commentators on the list noted that this introduced new complexities for publishers. However it is hard to represent a complex graph structured without ID-based references. This example shows that it can be done in RDFa 1.1 notation, although this is also complex in a different way:

<div vocab="http://schema.org/" typeof="Movie">
  <span property="name">Ghostbusters</span>
  <div property="hasRole" typeof="MovieRole">
    <span property="characterName">Dr. Peter Venkman</span>
    <div rel="actor" rev="inRole" typeof="Person">
      <span property="name">Bill Murray</span>
    </div>
  </div>
</div>
Servlet 7664281029414785522.png

image example