Skip to content

Property folding, opposite of nested properties? #877

@jgonggrijp

Description

@jgonggrijp

I feel that this question must have been asked before, but I could not find previous instances, let alone answers. This could be a duplicate of #718 but I am not sure; in any case, that question seems to come closest to what I want to ask.

The nested properties feature allows us to write nested objects in the compacted form that disappear in the expanded form. I need the opposite: a way to abbreviate a chain of properties into a single term, so that I can compact a complex linked graph into a flat object. Consider a web annotation, which has a beautiful data model, but which results in nested or linked objects that are difficult to work with in a programming context:

{
    "@context": {
        "@base": "http://example.org/",
        "oa": "http://www.w3.org/ns/oa#",
        "hasBody": { "@id": "oa:hasBody", "@type": "@id" },
        "hasSource": { "@id": "oa:hasSource", "@type": "@id" }
    },
    "@id": "theAnnotation",
    "@type": "oa:Annotation",
    "hasBody": "theBody",
    "oa:hasTarget": {
        "hasSource": "theSource",
        "oa:hasSelector": {
            "@type": "oa:TextPositionSelector",
            "oa:start": 16,
            "oa:end": 25
        }
    }
}

It would be extremely convenient if there was something that would enable me to write this instead:

{
    "@context": "... (whatever goes in here)",
    "@id": "theAnnotation",
    "@type": "oa:Annotation",
    "hasBody": "theBody",
    "hasSource": "theSource",
    "start": 16,
    "end": 25
}

Is there anything in the JSON-LD standards that would help to achieve this? A well-hidden context feature? Framing? I would prefer a context solution if there is one.

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