Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

OrderedCollection with multiple items values. #507

Closed
1 of 5 tasks
timothee-haudebourg opened this issue Dec 7, 2019 · 4 comments
Closed
1 of 5 tasks

OrderedCollection with multiple items values. #507

timothee-haudebourg opened this issue Dec 7, 2019 · 4 comments

Comments

@timothee-haudebourg
Copy link

Please Indicate One:

  • Editorial
  • Question
  • Feedback
  • Blocking Issue
  • Non-Blocking Issue

Please Describe the Issue:

The as:items property is not defined as a functional property, allowing users to define multiple values for this property. I can see how it is not a problem for Collection, but it seems to me that it becomes one with OrderedCollection. If there are multiples occurrences of items for a single ordered collection, there are no ways to know how the items of the collection are actually ordered, right?

Here is an illustration of the issue in a JSON-LD document:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "summary": "Sally's notes",
  "type": "OrderedCollection",
  "totalItems": 2,
  "orderedItems": [
    {
      "type": "Note",
      "name": "Meeting 2016-11-17"
    },
  ],
  "orderedItems": [
    {
      "type": "Note",
      "name": "Reminder for Going-Away Party"
    }
  ]
}

How to interpret this? Is this supposed to be valid? Should the reader just give up in finding the order between the two items?

@nightpool
Copy link
Collaborator

so, one thing to keep in mind is that (as i understand it) JSON-LD doesn't allow you to have duplicate keys, only duplicate values, using an array syntax. So your example would actually look something like

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "summary": "Sally's notes",
  "type": "OrderedCollection",
  "totalItems": 2,
  "orderedItems": [
    [
      {
        "type": "Note",
        "name": "Meeting 2016-11-17"
      },
    ],
    [
      {
        "type": "Note",
        "name": "Reminder for Going-Away Party"
      }
    ]
  ]
}

So we can already see that there is going to be some conflict between ordered lists / multi properties. As I understand JSON-LD, the "ordering" of the list comes from the @container property specified in the context document here:

"orderedItems": {
  "@id": "as:items",
  "@type": "@id",
  "@container": "@list"
},

The default container is @set, and you can see that items doesn't have any special container:

"items": {
  "@id": "as:items",
  "@type": "@id"
},

So putting all of this together, I think the way to understand multiple items values is that giving a list of items is exactly the same as giving multiple definitions of items, and JSON-LD only supports the former. The orderedItems property just has a special bit of syntax that makes it clear these items are ordered.

@timothee-haudebourg
Copy link
Author

Thanks for the explanation :)
However my question was not focused on JSON-LD, and I just used it as an example. It was a more general question about the RDF model defining Activity Streams. In this model, nothing forbids us to define multiples values for the items property in an OrderedCollection.

In an implementation strictly following the formal definition (which I'm trying to make), as I understand it, there is no way to define a unique ordering between the items of an instance of OrderedCollection in general.

@nightpool
Copy link
Collaborator

nightpool commented Dec 7, 2019

Yes, I think that's correct. As I found out when researching #508, as:items was originally a functional property, and then that restriction was removed: f05bfa7, probably to make sure it was compatible with both ordered and unordered lists.

Another thing to keep in mind is that rdf:Lists don't have a restriction on the amount/ordering of properties either. Even if there was only one items list, that list may have multiple first values, or multiple rest values. Ultimately though, ActivityStreams is based on the normative JSON serialization defined at https://www.w3.org/TR/activitystreams-core, so while it can be represented as RDF, it's not defined in those terms. There may be things that are valid in RDF that aren't valid as part of ActivityStreams syntax.

@timothee-haudebourg
Copy link
Author

Thanks for the clarification, that answers the question.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants