Re: Duration

> On Nov 26, 2019, at 12:12 PM, Phil Barker <phil.barker@pjjk.co.uk> wrote:
> 
> Hello all, I'm trying to get my head around a problem that involves durations and wonder what is the intent behind https://schema.org/Duration <https://schema.org/Duration> as a class?
> 
> https://schema.org/duration <https://schema.org/duration> has an expected type of Duration, but I've only ever seen examples with text values, e.g.
> 
> {
>   "@type": "MusicRecording",
>   "duration": "PT4M5S"
> }
> I've never seen 
> 
> {
>   "@type": "MusicRecording",
>   "duration": {
>      "@type": "Duration",
>      "???": "PT4M5S"
>    }
> }
> and I can't get anything like that through the Google testing tool (I know, it's not a schema.org testing tool).
> 
> Is this
> 
> {
>   "@type": "MusicRecording",
>   "duration": {
>      "@type": "Duration",
>      "@value": "PT4M5S"
>    }
> }
> 
> valid JSON-LD with Duration as defined as a class rather than a data type?
> 
Yes, in this context, @type defines the datatype of a literal value, so it is equivalent to the RDF literal “PT4M5S”^^http://schema.org/Duration <http://schema.org/Duration>.
> It would lead us in the direction of a context file with
> 
> "minDuration" {
>   "@id": "ex:minDuration",
>   "@type": "schema:Duration"
> }
> (FWIW, the issue we have hit with "@type":"xsd:duration" is that the xsd spec doesn't mention durations given as weeks (ISO 8601 does) but my questions about schema:Duration stand even if it the solution to that.) 
> 
Using xsd:Duration should be fine too, but I don’t believe that Google will look at any other context information (but, perhaps if it is done inline in the document they might). Certainly, the Structured-data Linter would interpret either.

Gregg
> Phil
> 
> -- 
> Phil Barker <http://people.pjjk.net/phil>. http://people.pjjk.net/phil <http://people.pjjk.net/phil>
> CETIS LLP <https://www.cetis.org.uk/>: a cooperative consultancy for innovation in education technology.
> PJJK Limited <https://www.pjjk.co.uk/>: technology to enhance learning; information systems for education.
> 
> CETIS is a co-operative limited liability partnership, registered in England number OC399090
> PJJK Limited is registered in Scotland as a private limited company, number SC569282.
> 

Received on Tuesday, 26 November 2019 20:04:35 UTC