Specifying a typed property as a text value (shorthand)

13 views
Skip to first unread message

Tony McCreath

unread,
Jan 17, 2021, 11:51:22 PM1/17/21
to Semantic Search Marketing
The MusicGroup example contains the following line:

"interactionType": "https://schema.org/ListenAction", 

interactionType should be any type of Action. So I take this syntax to mean that you can short hand the following by the above:

"interactionType": {"@type": "https://schema.org/ListenAction"},

So would this also be valid?:

"interactionType": "ListenAction",   

Are there rules on when this shorthand can be used. e.g. What if a Text value is also allowed? 

 

Richard Wallis

unread,
Jan 18, 2021, 8:04:24 AM1/18/21
to Tony McCreath, Semantic Search Marketing
Hi Tony,

The rules that apply here are the JSON-LD syntax rules and how the context is interpreted.

In simple terms, the case you reference:
"interactionType": "ListenAction",
would be valid because the following is contained within the schema.org context document (human readable version:https://schema.org/docs/jsonldcontext.json.txt ):
"ListenAction": {"@id": "schema:ListenAction"},
A json-ld processor  would interpret the "ListenAction" string  as representing the Schema.org type schema:ListenAction the full URI for which is https://schema.org/ListenAction
~Richard.
Richard Wallis
Founder, Data Liberate
http://dataliberate.com
Twitter: @rjw



--
You received this message because you are subscribed to the Google Groups "Semantic Search Marketing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semantic-search-ma...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/semantic-search-marketing/273387f9-8ede-42e7-9a79-298ce366003en%40googlegroups.com.

Dan Brickley

unread,
Jan 18, 2021, 9:11:34 AM1/18/21
to Richard Wallis, Tony McCreath, Semantic Search Marketing

Isn't the issue here that interactionType expects a value that is an instance of Action (directly or via its subtypes), but is instead (in the example at https://schema.org/MusicGroup#eg-0009) being given the identifier for a class that is a subtype of Action?

(The question of whether and when enumerated values can be shorthand abbreviated to a non-URL form seems different)

Dan
Reply all
Reply to author
Forward
0 new messages