Skip to content
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

wrong use of ItemList #569

Closed
VladimirAlexiev opened this issue Sep 19, 2022 · 7 comments
Closed

wrong use of ItemList #569

VladimirAlexiev opened this issue Sep 19, 2022 · 7 comments

Comments

@VladimirAlexiev
Copy link
Contributor

The following schemas use https://schema.org/ItemList:

  • AgricultureActivity.yml: 3
  • AgriculturePackage.yml: 1
  • ppq203.yml: 1
  • PGAShipmentStatusList.yml: 1
  • Phytosanitary.yml: 1

That's a rather specific class that should only be used for ordered lists, and there's no way to specify the class of elements.
More precisely, its itemListElement must be ListItem, which must have a position (integer) and item that's Thing (i.e. unspecific class).

Here are 2 specific cases to illustrate the error:

AgricultureActivity.yml:

  actor:
    title: Actor
    description: The actual person or persons performing the activity.
    type: array
    items:
      $ref: ./Person.yml
    $linkedData:
      term: actor
      '@id': https://w3id.org/traceability#Person
      '@type': https://schema.org/ItemList

You cannot state "a list of Persons", and the Person.yml schema doesn't have any fields pertaining to ordered lists, nor does the example embedded in AgricultureActivity.yml.

  pgaShipmentStatusItems:
    title: PGA Shipment Status Items
    description: List of PGA Status Messages pertaining to per-line items
    type: array
    items:
      $ref: ./PGAShipmentStatus.yml
    $linkedData:
      term: pgaShipmentStatusItems
      '@id': https://schema.org/ItemList
      '@type': https://schema.org/ItemList

The problems are the same.


If you need an ordered list of items, you can do specify this in the JSONLD context:

"pgaShipmentStatusItems": {"@type":"@id", "@id","traceability:pgaShipmentStatusItems", "@collection":"@list"}

Then it will be emitted as an rdf:List that doesn't have integer position fields but uses a linked list to preserve order.
It looks nice in turtle, eg:

<list> traceability:pgaShipmentStatusItems ("one" "two" "three")

But such list uses blank nodes and looks like the following RDF structure:

<list> traceability:pgaShipmentStatusItems 
  [a rdf:List; rdf:first "one"; rdf:rest
    [a rdf:List; rdf:first "two"; rdf:rest
      [a rdf:List; rdf:first "three"; rdf:rest rdf:nil]]]

Despite JSONLD's syntactic support for rdf:List,
you probably will want to avoid it and use your own structure, eg a simplification of schema:ItemList:

<list> a traceability:PGAShipmentStatusList traceability:member
  [a traceability:PGAShipmentStatus; traceability:position 1; traceability:recordNo: "SO701"...],
  [a traceability:PGAShipmentStatus; traceability:position 2; traceability:recordNo: "SO702"...],
  [a traceability:PGAShipmentStatus; traceability:position 3; traceability:recordNo: "SO703"...].
@brownoxford
Copy link
Collaborator

@rhofvendahl can you please take a peek at this?

@rhofvendahl
Copy link
Collaborator

rhofvendahl commented Jan 9, 2023

@VladimirAlexiev Thanks for pointing this out, and for the explanation!

It looks as though the '@type' is used almost entirely for ItemList and identifier, both of which (as you've pointed out) are used incorrectly. Unless there are any objections I'd like to leave correct implementation of '@type' for future PRs and for now just remove the offending code.

@nissimsan
Copy link
Collaborator

nissimsan commented Jan 10, 2023

types are now removed - closing this issue.
We might want to introduce types on a case by case bases on dedicated tickets.

@VladimirAlexiev
Copy link
Contributor Author

@nissimsan it's still used in 7 schemas: https://github.com/w3c-ccg/traceability-vocab/search?q=ItemList&type=code
Please reopen.

@nissimsan nissimsan reopened this Mar 6, 2023
@nissimsan
Copy link
Collaborator

Nice search, @VladimirAlexiev.

The simple solution seems to be just removing '@type': https://schema.org/ItemList?

@VladimirAlexiev
Copy link
Contributor Author

VladimirAlexiev commented Jun 22, 2023

I'm afraid that the #686 fix doesn't do much.

Another example from RevocationList2020Status.yml:

  revocationListIndex:
    title: revocationListIndex
    type: string
    $linkedData:
      term: revocationListIndex
      '@id': https://schema.org/itemListElement
  revocationListCredential:
    title: revocationListCredential
    type: string
    $linkedData:
      term: revocationListCredential
      '@id': https://schema.org/LinkRole
example: |-
  {
    "type" : ["RevocationList2020Status"],
    "revocationListIndex" : "0",
    "revocationListCredential": "https://example.gov/revocation-lists/urn:uuid:3bc24f87-b47b-43a0-b5bf-b9fde7913746"
  }

There are several mistakes here:

  • the example suggests that revocationListIndex is an integer position. So it should be mapped to schema:position and made integer.
  • As described above, ItemListElement points to https://schema.org/ListItem that includes two fields position, item. Where in the above do you see item?
  • the prop revocationListCredential cannot be mapped to the class https://schema.org/LinkRole. Furthermore, when reading the definition (and even name) of that class, I don't see any relevance to the use shown above.

@OR13
Copy link
Collaborator

OR13 commented Oct 24, 2023

This is now controlled by https://github.com/w3c/vc-bitstring-status-list

I suggest we close this issue

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

No branches or pull requests

6 participants