Skip to content

Repeated instances from vocab with metatypes don't serialize properly #27

@azaroth42

Description

@azaroth42

Thanks to @kasei for finding.

from cromulent import model, vocab
what = model.HumanMadeObject()
what.referred_to_by = vocab.MaterialStatement(content="a")
what.referred_to_by = vocab.MaterialStatement(content="b")
print(model.factory.toString(what, compact=False))

Results in the below, where brief text metatype is not repeated on the second instance.

{
  "@context": "https://linked.art/ns/v1/linked-art.json",
  "id": "http://lod.example.org/museum/HumanMadeObject/0",
  "type": "HumanMadeObject",
  "referred_to_by": [
    {
      "id": "http://lod.example.org/museum/LinguisticObject/0",
      "type": "LinguisticObject",
      "classified_as": [
        {
          "id": "http://vocab.getty.edu/aat/300435429",
          "type": "Type",
          "_label": "Material Statement",
          "classified_as": [
            {
              "id": "http://vocab.getty.edu/aat/300418049",
              "type": "Type",
              "_label": "Brief Text"
            }
          ]
        }
      ],
      "content": "a"
    },
    {
      "id": "http://lod.example.org/museum/LinguisticObject/1",
      "type": "LinguisticObject",
      "classified_as": [
        {
          "id": "http://vocab.getty.edu/aat/300435429",
          "type": "Type",
          "_label": "Material Statement"
        }
      ],
      "content": "b"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions