rdf - What is the use of @vocab in JSON-LD and what is the difference to @context? -
what @vocab attribute in json-ld for? see can "import" remote vocabulary, isn't same can @context? if i'm not wrong can "import" remote source @context well. difference between @vocab , @context?
extra question: can have more 1 @vocab? example first referrers schema.org , other rdfs?
@vocab used declare default vocabulary terms derive, without having declare specific mappings each term (as in @context).
for example, see snippet (taken json-ld 1.0 spec):
{ "@context": { "@vocab": "http://schema.org/" } "@id": "http://example.org/places#breweats", "@type": "restaurant", "name": "brew eats" ... } in fragment, @vocab used define in context, terms derive schema.org vocabulary. in following fragments, restaurant maps http://schema.org/restaurant, , name maps http://schema.org/name. of course have done explicit mappings in @context well:
{ "@context": { "restaurant": "http://schema.org/restaurant", "name" : "http://schema.org/name" } "@id": "http://example.org/places#breweats", "@type": "restaurant", "name": "brew eats" ... } but becomes tedious start using more , more terms same vocabulary. @vocab useful short way say: "if don't have explicit mapping term, maps to".
as whether can use more 1 @vocab: can have more 1 @vocab in json-ld document (just can have more 1 @context), can not have more 1 in same @context. trust explanation defines default makes clear why can't have 2 in same context.
Comments
Post a Comment