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

@default in @context in JSON-LD core syntax #328

Open
lsimichael opened this issue Feb 11, 2020 · 2 comments
Open

@default in @context in JSON-LD core syntax #328

lsimichael opened this issue Feb 11, 2020 · 2 comments
Labels
defer-future-version Defer this issue until a future version of JSON-LD

Comments

@lsimichael
Copy link

lsimichael commented Feb 11, 2020

(See below)

@michaelcpuckett
Copy link

Hi, I have an idea for a new feature. I see there is a feature freeze for 1.1 but do not know how to submit a feature for 1.2

I am working with W3C's SHACL and there can be deeply nested nodes and properties. Each sh:node is a sh:NodeShape and each sh:property is a sh:PropertyShape, and it gets very repetitive to write out those @types each time.

I would like to be able to define a default @type for entities in the @context of a regular JSON-LD document, using the @default keyword. The default would be applied no matter how deeply nested.

I have read a discussion before that JSON-LD core syntax is not for adding information, because that is only for framing. But I hope that can be reconsidered. In my opinion this is not adding, just rearranging, since the information is provided in the @context.

(If this is impossible in the core syntax, even in a future 1.2 version, then perhaps there could be modifications made to framing to model infinite nesting.)

Here's an example in 1.1 syntax:

{
    "@context": {
        "schema": "http://schema.org/",
        "sh": "https://www.w3.org/TR/shacl/",
        "path": {
            "@id": "sh:path",
            "@type": "@id"
        },
        "class": {
            "@id": "sh:class",
            "@type": "@id"
        },
        "property": "sh:property",
        "node": "sh:node"
    },
    "@type": "sh:NodeShape",
    "class": "schema:Article",
    "property": [{
        "@type": "sh:PropertyShape",
        "path": "schema:author"
    }, {
        "@type": "sh:PropertyShape",
        "path": "schema:headline"
    }, {
        "@type": "sh:PropertyShape",
        "path": "schema:interactionStatistic",
        "node": {
            "@type": "sh:NodeShape",
            "class": "schema:InteractionCounter",
            "property": [{
                "@type": "PropertyShape",
                "path": "schema:userInteractionCount"
            }, {
                "@type": "PropertyShape",
                "path": "schema:interactionType",
                "node": {
                    "class": "schema:CommentAction"
                }
            }]
        }
    }]
}

And below would be my preferred syntax, with @default values provided in the @context.

{
    "@context": {
        "schema": "http://schema.org/",
        "sh": "https://www.w3.org/TR/shacl/",
        "path": {
            "@id": "sh:path",
            "@type": "@id"
        },
        "class": {
            "@id": "sh:class",
            "@type": "@id"
        },
        "property": {
            "@id": "sh:property",
            "@type": "sh:class",
            "@default": {
                "@type": "sh:PropertyShape"
            }
        },
        "node": {
            "@id": "sh:node",
            "@type": "sh:path",
            "@default": {
                "@type": "sh:NodeShape"
            }
        }
    },
    "@type": "sh:NodeShape",
    "class": "schema:Article",
    "property": [
        "schema:author",
        "schema:headline", {
            "path": "schema:interactionStatistic",
            "node": {
                "class": "schema:InteractionCounter",
                "property": [
                    "schema:userInteractionCount", {
                        "path": "schema:interactionType",
                        "node": "schema:CommentAction"
                    }
                ]
            }
        }
    ]
}

@gkellogg
Copy link
Member

This was considered in #76 and rejected as being out of scope. It certainly can be reconsidered in the future, as it is an often featured request. The solution for adding information to graphs is to use framing. See, example 23 which speaks to this specific use case.

@gkellogg gkellogg added the defer-future-version Defer this issue until a future version of JSON-LD label Feb 11, 2020
@pchampin pchampin moved this to Future Work in JSON-LD Management May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defer-future-version Defer this issue until a future version of JSON-LD
Projects
Status: Future Work
Development

No branches or pull requests

3 participants