RDFa and JSON-LD are not equivalent #78
Comments
Ivan is correct, for the My implementation produces the following output for the example in the spec: {
"@graph": [
{
"@context": {
"@vocab": "https://schema.org/"
},
"@type": [
"https://schema.org/BlogPosting"
],
"headline": [
"Progress report"
],
"url": [
{
"@id": "http://example.com?comments=0"
}
],
"comment": [
{
"@context": {
"@vocab": "https://schema.org/"
},
"@type": [
"https://schema.org/Comment"
],
"url": [
{
"@id": "http://example.com#c1"
}
],
"creator": [
{
"@context": {
"@vocab": "https://schema.org/"
},
"@type": [
"https://schema.org/Person"
],
"name": [
"Greg"
]
}
],
"dateCreated": [
"2013-08-29"
]
}
],
"datePublished": [
"2013-08-29"
]
}
]
} |
It looks like the example was just copy-pasted from the plain JSON conversion, and is really wrong :( So it looks like step 4 of the algorithm should say
@gkellogg you seem to have done the
to each item.
Seem like we should also clarify that the algorithm is not normatively required to be followed exactly, but that a conversion should produce JSON-LD that represents the same RDF graph, probably at the beginning of the JSON-LD conversion section. |
Setting I believe that setting |
But in microdata, my first instinct is that it cannot change anyway, in which case this protection is unnecessary. (Wondering if I missed something)
vocabulary-identifier is (meant to be) the URL path for the (first) itemtype. Are you getting something different to use as a value? (I don't understand "don't" in the sentence above) |
In section 4.3, the vocabulary identifier is determined based on itemtype, which can certainly change when a new itemscope is encountered. Otherwise, you couldn't use properties from different vocabularies. Certainly, the RDFa algorithm is written expecting that the vocabulary identifier can change with each item, which is my read of 4.3 and 5.2:
I'm not sure where you see that the vocabulary-identifier is only associated with the first itemtype. |
Looking at the example of @gkellogg's generation tells me that there is a need for a specific
could then disappear behind the smoke screen of a context. At present, without such a context file, the generated JSON-LD does not seem to be correct... |
That is correct, but I believe the comment of @chaals referred to the |
For the vocabulary to track, and properties to be properly expanded, the Consider a mixed use of DCMI and schema.org, if the context (and |
Ah, true. Would it be an over-complication in the document if the algorithm includes a check on whether |
Simplest, of course, is to just emit an |
Exactly. I would propose to add that to the algorithm. Because we are generating a proper and, potentially, human readable serialization of RDF (as opposed to an abstract RDF Graph), I think such seemingly minor improvements would help acceptance and deployment. |
Following discussion at TPAC, our proposal is to remove the JSON-LD conversion - it is just a convenience, and so long as you generate a minimal graph that is the same when converting to an RDF format it doesn't matter much which format you use... And I apparently made fewer mistakes in creating the first draft RDFa conversion, so we will stick to that. It is also closer in the problem space it covers. |
Fix #78, #80 The JSON-LD direct conversion algorithm is harder to get right, and is redundant in practice. Clarify that the "JSON" conversion is explicitly for `application/microdata+json` and mark it as obsolete but conforming since it seems to have been removed from current versions of known implementations. (And update status)
Fix #78, #80 The JSON-LD direct conversion algorithm is harder to get right, and is redundant in practice. Clarify that the "JSON" conversion is explicitly for `application/microdata+json` and mark it as obsolete but conforming since it seems to have been removed from current versions of known implementations. (And update status)
RDFa and JSON-LD are both serializations of RDF. What it means that, when converted to RDF, both conversion results should produce equivalent graphs.
However... this does not seem to be the case. At least the way I read it
items
property, which yields, in RDF one subject (a blank node, actually) which has a number of<items> _:XYZ
pairs, where_:XYZ
are blank nodes with the content coming from a specificitemscope
_:XYZ
triplets without any common subjects binding them together.This can be easily solved. Either
@graph
construct which can be used to specify a number of more or less independent group of triples with common subjectsitems
I am more in favour of the first approach to solve this, but the second one is also a solution.
(As an aside, the JSON-LD example is incomplete, there is no
@context
.)Cc: @gkellogg
The text was updated successfully, but these errors were encountered: