2

I want to create a context file to use for multiple data sources. Is it possible to state different terms that will refer to the exact same IRI?

For example:

{
    "@context": {
          "twitter_name": "http://schema.org/name",
          "facebook_name": "http://schema.org/name"
    }
}
DannyL
  • 505
  • 4
  • 10
  • there is no substitution to the right of the colon (to the right of the key). The value (to the right of the key) is as you expect it to be read or processed. unless your talking about bi sexuals, i'm not sure how to read "bi:name" – Jay Gray Apr 26 '18 at 16:49

1 Answers1

1

If I understand your question correctly, you want to define different aliases for the same property. So without the use of prefixes, this:

{
  "@context": {
    "twitter_name": "http://schema.org/name",
    "facebook_name": "http://schema.org/name"
  }
}

This should be valid. In an object, the keys must be unique, but there is no such requirement for the values.


You can test it in the JSON-LD Playground.

This example uses the four ways how the property could be specified:

{
  "@context": {
    "bi": "http://schema.org/",
    "twitter_name": "bi:name",
    "facebook_name": "bi:name"
  },
  "bi:name": "Alice (prefix)",
  "twitter_name": "Alice (alias for Twitter)",
  "facebook_name": "Alice (alias for Facebook)",
  "http://schema.org/name": "Alice (full URI)"
}

The compacted result contains an array value with the four names:

{
  "http://schema.org/name": [
    "Alice (prefix)",
    "Alice (alias for Facebook)",
    "Alice (full URI)",
    "Alice (alias for Twitter)"
  ]
}

So all the keys are correctly interpreted to be Schema.org’s name property.

unor
  • 92,415
  • 26
  • 211
  • 360