-
Notifications
You must be signed in to change notification settings - Fork 157
Array of IRIs is not supported by playground and not specified in the spec #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There's no provision in the RDF conversion algorithm for {"@id": ["a", "b"]} to generate multiple IRIs, Looking at step 3, the active subject and active property are passed in and then each value is handled in turn. As @id is not a property, there is no active property, so no triple to generate. Some time ago, I considered that we might want to specify that using an array in this context would result in the value of the last item be used as the "return value" of the array, which could be used for defining the subject. Of course, this was in the context of @subject, not @id which has multiple meanings now. In any case, I couldn't see anything in the spec that would indicate that @id with an array value would really do anything, as @id is really different than a property or type. As it happens, my implementation produces the following output, which agrees with Markus' interpretation:
But, it should probably be:
We should definitely clarify this behavior, but I could see that this might be considered as producing multiple subjects as follows:
What should that produce? You could see that it might be the following:
|
When I raised this issue I was primarily thinking about the object, not the subject. I think the following should be supported: _This example contains an error sorry, please see next comments_
This IMO should result in
Gregg, could you elaborate why the output of your example should be
and not
|
This goes back to Manu's statement that this was examined and found to be too complex for JSON-LD. The idea was that this would be a way of specifying entities that have common properties and values. Niklas also described this as a use-case for his proposed @Rev keyword. The thinking is that specifying an object with multiple @id entries is equivalent to describing multiple objects each with a singular @id having the identical key/value pairs, and that this was too complicated. In this specific case, the something property has as it's value on object with two @id values and an otherprop key also having two values. Associating the otherprop values with _:node1 would require promoting them to the object where _:node1 is defined, and I see no way to support this. I suggest that we either dis-allow an @id with multiple values, or say that the value is that of the last element of the array. |
Oh sorry, I just realized I made a mistake.. The example I wanted to put up above should be (so similar to
This IMO should result in
|
The problem is, it's difficult to distinguish between the following:
and
Both are object descriptions. If the first, when used as the value of another property, results in two entries, as you suggest, then how do we prohibit those from being two different subjects for the common "prop"? This gets into complicated territory. The easiest thing is to either prohibit the array form with @id, or define that it has a single value, being the last entry. This would mean that to specify what you want, we'd either need a coercion rule on "something", or the values would need to be expanded as follows:
Personally, I'm fine with this restriction. After all, you can easily define a term with @id coercion rules to get to a short form. |
We could also just disallow the
It's basically the same as with
|
The difference is that @list always ignores other keys, but @id would ignore other keys only when it is the value of another @id, this involves passing extra context information and complicates the algorithms. Array order is only undefined for the generated triples, we can make use of JSON array ordering for the purposes of satisfying an algorithmic step. In this case, @id is described explicitly in the RDF conversion algorithm, so we can add a phrase such as "If the value is an array, process each item using step 2.5.2 and set the active object to the result." The algorithm doesn't state this, but in my implementation, if the value is a JSON object, the active object is set to the result of performing the processing step, which returns the subject. This could be true for an array as well, if we define with the return result from the processing step is for an array; right now it's simply undefined. |
Well, the difference to
That might be easy to understand for us but I think a lot of authors without knowledge of all the algorithms and backgrounds would have a hard time understanding what's going on.. At the very beginning of the current spec we currently define an array as:
Why should that then be different for |
There are at least three reasons I'm against this sort of syntax: {"@id": ["a", "b"]}
I think that we should do one of the following things when we hit markup like that found above:
I think we should do #3. My preference is to use the first value in the @id array because if we ever want to support setting values for multiple subjects at the same time, we keep the door open for that functionality. Thoughts? |
OK, good point.. if we wanna keep the door open for something like that I think we should do #4, throw an exception. All the other options would potentially create invalid data after a spec update. If we throw an exception now, we can change it to whatever we like afterwards as it won't affect existing data.. So, +1 for # 4 |
I close this issue as it is not relevant anymore. The value of |
Look at the following example:
I think the output should be:
The playground fails to handle this. This case is similar to @list and should thus be supported. We might wanna support this also for @value:
Strange enough this doesn't fail but produces the following Turtle output in the playgorund:
The text was updated successfully, but these errors were encountered: