Skip to content

Using "@container" : "@type"  #62

@saumier

Description

@saumier

Using "@container" : "@type" when Framing JSON-LD fails when @type is missing.

Test

Graph

{
  "@context": {
    "@vocab": "http://schema.org/"
  },
  "@type": "Event",
  "location": {
    "@id": "http://kg.artsdata.ca/resource/K11-200"
  }
}

Frame

{
  "@context": {
    "@vocab": "http://schema.org/",
    "location": {
      "@type": "@id",
      "@container": "@type"
    }
  },
  "@type": "Event"
}

Expected behaviour

"@none" when there is no @type.

Result from JSON-LD Playground

{
  "@context": {
    "@vocab": "http://schema.org/",
    "location": {
      "@type": "@id",
      "@container": "@type"
    }
  },
  "@type": "Event",
  "location": {
    "@none": "http://kg.artsdata.ca/resource/K11-200"
  }
}

Current behaviour

NoMethodError: undefined method `keys' for "http://kg.artsdata.ca/resource/K11-200":String
if compacted_item.keys.length == 1 && expanded_item.keys.include?('@id')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions