schemaorg / schemaorg

Schema.org - schemas and supporting software
https://schema.org/
Apache License 2.0
5.3k stars 813 forks source link

missing "url": "@id" in JSON-LD @context #410

Open elf-pavlik opened 9 years ago

elf-pavlik commented 9 years ago

continuing discussion with @gkellogg from #239

grep '"@id":' schemaorg/data/examples.txt

 "@id": "http://www.ncbi.nlm.nih.gov/mesh/D02.078.370.141.450",
    "@id": "http://www.ncbi.nlm.nih.gov/mesh/C18.452.394.750.149",
  "@id": "#product",
  "@id": "#product",
  "@id": "#model",
          "@id": "284708449",
          "@id": "5b23b738-bb64-4829-9296-5bcb59bb0d2d",
    "@id": "http://mlb.com/ws2013g1",
  "@id": "http://mlb.com/ws2013g1",
  "@id": "http://mlb.com/ws2013g2",

just few occurrences of @id from commits by @danbri but those on Product examples suggest @mfhepp https://github.com/schemaorg/schemaorg/blame/sdo-gozer/data/examples.txt

while ImageObject and thumbnail have their own peculiarities, I really have hard time to believe that in general schema.org doesn't actually use "url" as "@id"

grep '"url":' schemaorg/data/examples.txt |wc
     50     100    2311

also mentioned on https://github.com/schemaorg/schemaorg/wiki/JsonLd#improvements

discuss whether url should be an alias of JSON-LD's @id keyword

elf-pavlik commented 8 years ago

https://github.com/schemaorg/schemaorg/issues/239#issuecomment-88974791

No, url and @id are really different things, and it could be a mistake to alias them. @id sets the subject of the statements derived from an object, whereas url establishes an object value. It is true that url is often use for identifying the subject as well, but not necessarily. In many cases, it seems to act like sameAs.

...

The distinction between using an anonymous node with a url reference to the thing it describes, and using that thing as the subject goes back to many Microdata examples, where the use of @itemid is rare. In the end, I don't think the search engines care, and the semantic modelers presumably know the difference. If I were modeling it, I'd typically use @id.

Looking at trimmed example which we can find on http://schema.org/Offer

{
  "@context": "http://schema.org",
  "@type": "Event",
  "location": {
    "name": "The Hi-Dive"
  },
  "name": "Typhoon with Radiation City",
  "offers": {
    "@type": "Offer",
    "price": "13.00",
    "priceCurrency": "USD",
    "url": "http://www.ticketfly.com/purchase/309433"
  },
  "startDate": "Sat Sep 14"
}

To my understanding one MUST NOT try to use as equivalent the value of url instead of nested object!

{
  "@context": "http://schema.org",
  "@type": "Event",
  "location": {
    "name": "The Hi-Dive"
  },
  "name": "Typhoon with Radiation City",
  "offers": "http://www.ticketfly.com/purchase/309433",
  "startDate": "Sat Sep 14"
}

Similar if "The Hi-Dive" had "url": "http://hi-dive.example", one can NOT use

{
  "@context": "http://schema.org",
  "@type": "Event",
  "location": "http://hi-dive.example",
  "name": "Typhoon with Radiation City",
  "offers": "http://www.ticketfly.com/purchase/309433",
  "startDate": "Sat Sep 14"
}

And always use nested objects (blank nodes) like:

{
  "@context": "http://schema.org",
  "@type": "Event",
  "location": { "url": "http://hi-dive.example" },
  "name": "Typhoon with Radiation City",
  "offers": { "url": "http://www.ticketfly.com/purchase/309433"},
  "startDate": "Sat Sep 14"
}

In such case, I think we can resolve this issue by clearly documenting the difference between use of @id and url with examples similar to those above.

letmaik commented 8 years ago

Being fairly new to schema.org I am confused by this as well. I don't see how url and @id are really that different from a conceptual view. Coming from a linked data world, it seems only @id makes sense since typically you describe a given thing. If you don't describe that thing, then what does url refer to? So +1 for guidance on that.

github-actions[bot] commented 3 years ago

This issue is being tagged as Stale due to inactivity.